默认链路闭合模型 (dbu_closure)
本节介绍占用总线链路收发器管道第一阶段的默认模型的功能和实现。该模型名为 dbu_closure。源代码位于 <reldir>/models/std/links 目录下的文件 dbu_closure.ps.c 中。
调用上下文
每当总线发射机发起传输时,会为连接到总线的每个总线接收机独立计算闭合。闭合模型在管道传输延迟模型完成后由仿真内核调用。调用时的模拟时间是数据包传输的开始时间。闭合表示感兴趣的总线发射机到达特定总线接收机的能力。因此,如果闭合阶段失败——即表示没有闭合——则不会为发射机-接收机对调用剩余的管道阶段。
对每个数据包调用闭合模型的结果是一个整数值,解释为表示发射机和接收机之间闭合的布尔值。OPC_TRUE 值表示发射机能够到达接收机,而 OPC_FALSE 值表示仿真内核无法进行通信。仿真内核期望将此结果放入数据包的 OPC_TDA_BU_CLOSURE 传输数据属性中。
闭合假设
在大多数情况下,总线链路为连接到其上的所有收发器提供完全连接。因此,闭合阶段通常不会被设计为对可以通信的发射机-接收机对施加限制。这是默认模型 dbu_closure 所提供的功能,它在所有情况下都返回 OPC_TRUE 作为闭合。dbu_closure 的源代码如下图所示。
图 4:管道过程 dbu_closure 的源代码
/* dbu_closure.ps.c */
/* Default link closure model for bus link Transceiver Pipeline */
/**********************************/
/* Copyright (c) 2013 */
/* Riverbed Technology, Inc. */
/* All Rights Reserved. */
/**********************************/
#include "opnet.h"
#if defined (__cplusplus)
extern "C"
#endif
void
dbu_closure (Packet * pkptr)
{
/** For bus links the default closure model assumes **/
/** all stations on the bus can reach all others. **/
FIN (dbu_closure (pkptr));
/* Place closure status in packet transmission data block. */
op_td_set_int (pkptr, OPC_TDA_BU_CLOSURE, OPC_TRUE);
FOUT
}