diff --git a/passes/sat/sim.cc b/passes/sat/sim.cc index 8b82cc696..0fb4018d5 100644 --- a/passes/sat/sim.cc +++ b/passes/sat/sim.cc @@ -28,6 +28,8 @@ #include "kernel/fmt.h" #include +#include +#include USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN @@ -2542,8 +2544,9 @@ struct AnnotateActivity : public OutputWriter { double frequency = 1.0 / clk_period; worker->top->module->set_string_attribute("$FREQUENCY", std::to_string(frequency)); worker->top->module->set_string_attribute("$DURATION", std::to_string(max_time)); - // Timescale is scaled by 1e12 so it can be retrieved (not 0) in Python due to precision limitation during conversion - worker->top->module->set_string_attribute("$TIMESCALE", std::to_string(real_timescale * 1e12)); + std::stringstream ss; + ss << std::setprecision(4) << real_timescale; + worker->top->module->set_string_attribute("$TIMESCALE", ss.str()); if (debug) { std::cout << "Clock toggle count: " << clktoggleCounts[0] << "\n"; std::cout << "Max time: " << max_time << "\n";