gpt4 book ai didi

trace - 为什么 SystemC trace 不能捕捉到最后一个波形?

转载 作者:行者123 更新时间:2023-12-04 20:37:37 27 4
gpt4 key购买 nike

这是我的程序:

#include <systemc.h>

int sc_main(int argc, char* argv[])
{
sc_signal<sc_logic> a, b, c, d;

// trace file creation
sc_trace_file *tf = sc_create_vcd_trace_file("test");

//tf->set_time_unit(1, SC_PS);
sc_trace(tf, a, "A");
sc_trace(tf, b, "B");
sc_trace(tf, c, "C");
sc_trace(tf, d, "D");

sc_start(0, SC_PS);

bool a_tmp = false;
bool b_tmp = true;
int c_tmp = 0;
int d_tmp = 1;

a = sc_logic(a_tmp);
b = sc_logic(b_tmp);
c = sc_logic(c_tmp);
d = static_cast<sc_logic>(d_tmp);
sc_start(1, SC_PS);

a = SC_LOGIC_1; b = SC_LOGIC_1;
c = SC_LOGIC_0; d = SC_LOGIC_1;
sc_start(1, SC_PS);

a = SC_LOGIC_0; b = SC_LOGIC_0;
c = SC_LOGIC_1; d = SC_LOGIC_0;
sc_start(1, SC_PS);

a = SC_LOGIC_1; b = SC_LOGIC_0;
c = SC_LOGIC_1; d = SC_LOGIC_0;
sc_start(1, SC_PS);

sc_close_vcd_trace_file(tf);

return 0;
}

很奇怪,3~4ps之间的波形已经丢失了,没有被VCD文件捕捉到。那是什么原因?即使将 a,b,c,d 更改为变量也无法解决此问题。

最佳答案

我刚刚试过你的代码,这是我得到的跟踪文件( test.vcd ):

$date
Sep 07, 2015 20:30:28
$end

$version
SystemC 2.3.1-Accellera --- Nov 29 2014 15:29:06
$end

$timescale
1 ps
$end

$scope module SystemC $end
$var wire 1 aaaaa A $end
$var wire 1 aaaab B $end
$var wire 1 aaaac C $end
$var wire 1 aaaad D $end
$upscope $end
$enddefinitions $end

$comment
All initial values are dumped below at time 0 sec = 0 timescale units.
$end

$dumpvars
xaaaaa
xaaaab
xaaaac
xaaaad
$end

#0
0aaaaa
1aaaab
0aaaac
1aaaad

#1
1aaaaa

#2
0aaaaa
0aaaab
1aaaac
0aaaad

#3
1aaaaa

这对我来说是正确的。下表显示了相同的数据:
            a    b    c    d
at 0 ps (0) (1) (0) (1)
at 1 ps (1) 1 0 1
at 2 ps (0) (0) (1) (0)
at 3 ps (1) 0 1 0
at 4 ps No more stimulus, simulation ends

() denotes a changed value

关于trace - 为什么 SystemC trace 不能捕捉到最后一个波形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32422161/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com