mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-23 12:48:54 +00:00
Display simulation time data
This commit is contained in:
parent
a6959d30df
commit
543feb75cb
3 changed files with 27 additions and 2 deletions
|
@ -21,10 +21,30 @@
|
|||
|
||||
USING_YOSYS_NAMESPACE
|
||||
|
||||
|
||||
FstData::FstData(std::string filename) : ctx(nullptr)
|
||||
{
|
||||
const std::vector<std::string> g_units = { "s", "ms", "us", "ns", "ps", "fs", "as", "zs" };
|
||||
ctx = (fstReaderContext *)fstReaderOpen(filename.c_str());
|
||||
timescale = pow(10.0, (int)fstReaderGetTimescale(ctx));
|
||||
int scale = (int)fstReaderGetTimescale(ctx);
|
||||
timescale = pow(10.0, scale);
|
||||
timescale_str = "";
|
||||
int unit = 0;
|
||||
int zeros = 0;
|
||||
if (scale > 0) {
|
||||
zeros = scale;
|
||||
} else {
|
||||
if ((scale % 3) == 0) {
|
||||
zeros = (-scale % 3);
|
||||
unit = (-scale / 3);
|
||||
} else {
|
||||
zeros = 3 - (-scale % 3);
|
||||
unit = (-scale / 3) + 1;
|
||||
}
|
||||
}
|
||||
for (int i=0;i<zeros; i++) timescale_str += "0";
|
||||
if (zeros>0)timescale_str += " ";
|
||||
timescale_str += g_units[unit];
|
||||
extractVarNames();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue