From 74e16d85c547c3b6065deaf491776a5830d174ac Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Sat, 18 Apr 2020 23:54:02 +0100 Subject: [PATCH] Fix FST trace initial time stamp. (#2264) If the first dump was not at time zero, then the FST trace used to contain the initial values as if they were set at time zero. Now they only appear at the time the first dump call is actually made, and hence match the VCD trace exactly. --- include/verilated_fst_c.cpp | 2 +- test_regress/t/t_trace_two_dumpfst_cc.out | 11 ++++++----- test_regress/t/t_trace_two_portfst_cc.out | 11 ++++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/verilated_fst_c.cpp b/include/verilated_fst_c.cpp index afbf007ea..68f7becf4 100644 --- a/include/verilated_fst_c.cpp +++ b/include/verilated_fst_c.cpp @@ -230,6 +230,7 @@ void VerilatedFst::dump(vluint64_t timeui) { return; } m_minNextDumpTime = timeui + 1; + fstWriterEmitTimeChange(m_fst, timeui); if (VL_UNLIKELY(m_fullDump)) { m_fullDump = false; // No more need for next dump to be full for (vluint32_t ent = 0; ent < m_callbacks.size(); ++ent) { @@ -238,7 +239,6 @@ void VerilatedFst::dump(vluint64_t timeui) { } return; } - fstWriterEmitTimeChange(m_fst, timeui); for (vluint32_t ent = 0; ent < m_callbacks.size(); ++ent) { VerilatedFstCallInfo* cip = m_callbacks[ent]; (cip->m_changecb)(this, cip->m_userthis, cip->m_code); diff --git a/test_regress/t/t_trace_two_dumpfst_cc.out b/test_regress/t/t_trace_two_dumpfst_cc.out index b956e40cd..70134be06 100755 --- a/test_regress/t/t_trace_two_dumpfst_cc.out +++ b/test_regress/t/t_trace_two_dumpfst_cc.out @@ -1,5 +1,5 @@ $date - Mon Apr 6 08:10:23 2020 + Sat Apr 18 22:18:21 2020 $end $version @@ -21,10 +21,11 @@ $upscope $end $upscope $end $enddefinitions $end $dumpvars -1! -b00000000000000000000000000000001 " -b00000000000000000000000000000000 # +#10 b00000000000000000000000000000001 $ +b00000000000000000000000000000000 # +b00000000000000000000000000000001 " +1! #15 0! #20 @@ -83,5 +84,5 @@ b00000000000000000000000000001010 " 0! #110 1! -b00000000000000000000000000001011 " b00000000000000000000000000001100 # +b00000000000000000000000000001011 " diff --git a/test_regress/t/t_trace_two_portfst_cc.out b/test_regress/t/t_trace_two_portfst_cc.out index 60ff90a86..cb4a741f0 100755 --- a/test_regress/t/t_trace_two_portfst_cc.out +++ b/test_regress/t/t_trace_two_portfst_cc.out @@ -1,5 +1,5 @@ $date - Mon Apr 6 08:24:52 2020 + Sat Apr 18 22:19:21 2020 $end $version @@ -21,10 +21,11 @@ $upscope $end $upscope $end $enddefinitions $end $dumpvars -1! -b00000000000000000000000000000001 " -b00000000000000000000000000000000 # +#10 b00000000000000000000000000000001 $ +b00000000000000000000000000000000 # +b00000000000000000000000000000001 " +1! #15 0! #20 @@ -83,5 +84,5 @@ b00000000000000000000000000001010 " 0! #110 1! -b00000000000000000000000000001011 " b00000000000000000000000000001100 # +b00000000000000000000000000001011 "