8266 at 驱动_时钟块信号的驱动与接收

request信号定义为测试端输出,待测设计端输入。

接口定义:

// interface

这里定义了两个在时钟clk上升沿触发的时钟块tcb和dcb,分别用在两个modport分组中,TESTTCB和DUTDCB。

另外,针对后面说到的两种情形,先定义好4个模块:

// drive signal in clock block

情形一 测试端驱动request信号,通过时钟块向外输出request信号。

测试平台顶层模块如下:

module 

在时钟块内的request信号原始波形如图中 /top/arbif/tcb/request。通过时钟块驱动后,DUT端收到的信号波形如图中 /top/arbif/request。

44f1321d247b8f9c718a30c6cc7a9cc0.png

接收端DUT monitor到的输出如下:

cabeacb274d245338bb0e94bad26ea22.png

注意到在两个时钟周期(上升沿)之间产生的值2丢失了!(因为在第三个时钟周期的上升沿产生了新值3。是这样解释的吗?)

情形二 接收端通过时钟块接收request信号。

测试平台顶层模块如下:

module 

request信号输出波形如图中 /top/arbif/request。接收端通过时钟块采样信号波形如图中 /top/arbif/dcb/request。

657d515636db7bfe59e3b1dabc5a6624.png

接收端monitor的结果如下:

f833fe7946f84a5b6301f8bdd1f8a544.png

第三个时钟周期上升沿采样到的是上升沿到来之前获得接口数据2。只在下一个时钟周期(上升沿)采样到数据3。

怎么理解这种差异?

IEEE Std 1800-2017, Ch.14.3(Clocking block declaration) and Ch.14.4(Input and output skews):

"Unless otherwise specified, the default input skew is 1step and the default output skew is 0. A step is a special time unit whose value is defined in 3.14.3. A 1step input skew allows input signals to sample their steady-state values in the time step immediately before the clock event (i.e., in the preceding Postponed region)."

"Input (or inout) signals are sampled at the designated clock event. If an input skew is specified, then the signal is sampled at skew time units before the clock event. Similarly, output (or inout) signals are driven skew simulation time units after the corresponding clock event. Figure 14-1 shows the basic sample and drive timing for a positive edge clock."

5f34d16f3a58038b0c6a3dbf4b2edeec.png

...

"An input skew of 1step indicates that the signal is to be sampled at the end of the previous time step. In other words, the value sampled is always the signal's last value immediately before the corresponding clock edge."

...

"Inputs with explicit #0 skew shall be sampled at the same time as their corresponding clocking event, but to avoid races, they are sampled in the Observed region. Likewise, clocking block outputs with no skew (or explicit #0 skew) shall be driven at the same time as their specified clocking event, in the Re-NBA region."

关于timing region,参阅 IEEE Std for SystemVerilog, Ch.4 Scheduling semantics

因此

情形一,tcb时钟块的request信号做为输出信号,默认output skew为0,即在时钟上升沿时刻的Re-NBA时区驱动,此时request信号已经更新的新值3,故而输出给DUT是3。导致从外部看到中间的值2丢失。

在情形二中,dcb时钟块的request信号做为输入信号,默认input skew是1step,采样的始终是时钟边缘之前的最后的值,即值2。

思考一下,在链接页面有如下截屏(如果没有更新的话)。仿真的结果是否有问题?

SystemVerilog Clocking Blocks Part II​www.chipverify.com
ca09ee7ebae75e1c618e6e5801e11673.png

cb45c8086a5c0e890c59f413ae3d0b34.png
gnt[3:0]输出依次是 x, 4, 1, 9, 3, d, ... ,clk上升沿在3和d之间

cb_0: input #0 gnt;

cb_1: input #1step gnt;

cb_2: input #1 gnt;

cb_3: input #2 gnt;

以上都是@(posedge clk)

按照标准文档,Figure 14-1,作为input,采样发生在时钟沿之前。

12fefa3da290d6152e0df8fcb4974c50.png

所以,cb_2, cb_3得到的应当是分别提前1,2个时间单位之前的值,即分别是0x9, 0x1。cb_1得到的是当前时钟沿之前的值,即0x3。而特别的,cb_0: input #0 gnt, 则是对应时钟时刻的Observed region的值,得到的是时钟沿后面的值,即0xd。

所以最后的输出应该是:

cb_3.gnt = 0x1
cb_2.gnt = 0x9
cb_1.gnt = 0x3
cb_0.gnt = 0xd

用modelsim跑下来的结果,也的确如此。(使用modelsim仿真时,如果Objects窗口找不到clk信号,可能是因为仿真优化的原因。关掉优化选项 -- 有些事当时搞清楚了,一段时间回头再做,又不知所措。还是写下来吧!)

ef6a4aee07d8ccd14a33612ebe833a17.png

fc5fd4b54441ad93a57ff5a1a4d72f0c.png
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值