Set FST timescale correctly. (#2266)

The FST trace timescale used to be set in the constructor via
set_time_unit, but at that point we haven't normally opened the
file yet so it was just dropped. On top of that, we actually want
to use set_time_resolution... FST trace timescales now match the VCD.
This commit is contained in:
Geza Lore 2020-04-19 13:47:22 +01:00 committed by GitHub
parent 466535abdc
commit 6a54922044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 26 additions and 23 deletions

View File

@ -100,6 +100,7 @@ void VerilatedFst::open(const char* filename) VL_MT_UNSAFE {
m_assertOne.check();
m_fst = fstWriterCreate(filename, 1);
fstWriterSetPackType(m_fst, FST_WR_PT_LZ4);
fstWriterSetTimescaleFromString(m_fst, m_timeRes.c_str());
#ifdef VL_TRACE_THREADED
fstWriterSetParallelMode(m_fst, 1);
#endif

View File

@ -65,6 +65,8 @@ private:
// helpers
std::vector<char> m_valueStrBuffer;
std::string m_timeRes;
public:
explicit VerilatedFst(void* fst = NULL);
~VerilatedFst();
@ -77,11 +79,11 @@ public:
fstWriterClose(m_fst);
m_fst = NULL;
}
void set_time_unit(const char* unitp) { fstWriterSetTimescaleFromString(m_fst, unitp); }
void set_time_unit(const char*) {}
void set_time_unit(const std::string& unit) { set_time_unit(unit.c_str()); }
void set_time_resolution(const char*) {}
void set_time_resolution(const std::string& unit) { set_time_resolution(unit.c_str()); }
void set_time_resolution(const char* unitp) { m_timeRes = unitp; }
void set_time_resolution(const std::string& unit) { m_timeRes = unit; }
// double timescaleToDouble(const char* unitp);
// std::string doubleToTimescale(double value);

View File

@ -1,12 +1,12 @@
$date
Wed Dec 4 07:48:29 2019
Sun Apr 19 04:13:22 2020
$end
$version
fstWriter
$end
$timescale
1ns
1ps
$end
$scope module top $end
$var wire 1 ! clk $end

View File

@ -1,12 +1,12 @@
$date
Sun Oct 21 21:57:08 2018
Sun Apr 19 04:15:23 2020
$end
$version
fstWriter
$end
$timescale
1ns
1ps
$end
$scope module top $end
$var wire 1 ! clk $end

View File

@ -1,12 +1,12 @@
$date
Sun Apr 12 20:15:55 2020
Sun Apr 19 04:15:26 2020
$end
$version
fstWriter
$end
$timescale
1ns
1ps
$end
$scope module top $end
$var wire 1 ! clk $end

View File

@ -1,12 +1,12 @@
$date
Sun Apr 12 20:17:15 2020
Sun Apr 19 04:15:31 2020
$end
$version
fstWriter
$end
$timescale
1ns
1ps
$end
$scope module top $end
$var wire 1 ! clk $end

View File

@ -1,12 +1,12 @@
$date
Sun Apr 12 20:14:19 2020
Sun Apr 19 04:15:33 2020
$end
$version
fstWriter
$end
$timescale
1ns
1ps
$end
$scope module top $end
$var wire 1 ! clk $end

View File

@ -1,12 +1,12 @@
$date
Sun Apr 12 20:17:58 2020
Sun Apr 19 04:15:36 2020
$end
$version
fstWriter
$end
$timescale
1ns
1ps
$end
$scope module top $end
$var wire 1 ! clk $end

View File

@ -1,12 +1,12 @@
$date
Sun Apr 12 20:19:35 2020
Sun Apr 19 04:15:38 2020
$end
$version
fstWriter
$end
$timescale
1ns
1ps
$end
$scope module top $end
$var wire 1 ! clk $end

View File

@ -1,12 +1,12 @@
$date
Sat Apr 18 22:18:21 2020
Sun Apr 19 04:15:48 2020
$end
$version
fstWriter
$end
$timescale
1ns
1ps
$end
$scope module topa $end
$var wire 1 ! clk $end

View File

@ -1,12 +1,12 @@
$date
Sat Mar 7 18:27:58 2020
Sun Apr 19 04:15:51 2020
$end
$version
fstWriter
$end
$timescale
1ns
1ps
$end
$scope module topa $end
$var wire 1 ! clk $end

View File

@ -1,12 +1,12 @@
$date
Sat Apr 18 22:19:21 2020
Sun Apr 19 04:13:00 2020
$end
$version
fstWriter
$end
$timescale
1ns
1ps
$end
$scope module topa $end
$var wire 1 ! clk $end