From f65d98a00d821f304a6abff0e47261656f673994 Mon Sep 17 00:00:00 2001 From: Alain Dargelas Date: Mon, 2 Dec 2024 20:15:53 -0800 Subject: [PATCH 1/3] Simulation information for macro power --- passes/cmds/activity.cc | 2 +- passes/sat/sim.cc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/passes/cmds/activity.cc b/passes/cmds/activity.cc index fdc2495a5..2ebf513d0 100644 --- a/passes/cmds/activity.cc +++ b/passes/cmds/activity.cc @@ -178,7 +178,7 @@ struct ActivityPropPass : public Pass { ActivityProp worker(module); totalNbBitsWithActivity += worker.getNbBitsWithActivity(); } - log("Collected %d bits with activity", totalNbBitsWithActivity); + log("Collected %d bits with activity\n", totalNbBitsWithActivity); log_flush(); } } ActivityPropPass; diff --git a/passes/sat/sim.cc b/passes/sat/sim.cc index ec14ef2ea..8b82cc696 100644 --- a/passes/sat/sim.cc +++ b/passes/sat/sim.cc @@ -2541,6 +2541,9 @@ struct AnnotateActivity : public OutputWriter { double clk_period = real_timescale * (double)max_time / (clktoggleCounts[0] / 2.0); 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)); if (debug) { std::cout << "Clock toggle count: " << clktoggleCounts[0] << "\n"; std::cout << "Max time: " << max_time << "\n"; From fe684f5fd2d58acf3c2fe200376dacf68d1566b2 Mon Sep 17 00:00:00 2001 From: Alain Dargelas Date: Tue, 3 Dec 2024 09:35:11 -0800 Subject: [PATCH 2/3] Precision fix --- passes/sat/sim.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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"; From 350b04daa32e9057ae8782afc447d9fd3ed0fd22 Mon Sep 17 00:00:00 2001 From: Alain Dargelas Date: Tue, 3 Dec 2024 13:00:14 -0800 Subject: [PATCH 3/3] Ignore unused modules --- frontends/verific/verific.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/frontends/verific/verific.cc b/frontends/verific/verific.cc index 81c72205e..308078e69 100644 --- a/frontends/verific/verific.cc +++ b/frontends/verific/verific.cc @@ -3544,6 +3544,7 @@ struct VerificPass : public Pass { // RuntimeFlags::SetVar("veri_break_loops", 0); // SILIMATE: add to avoid breaking loops RuntimeFlags::SetVar("veri_optimize_wide_selector", 1); // SILIMATE: add to optimize wide selector RuntimeFlags::SetVar("veri_ignore_assertion_statements", 1); // SILIMATE: add to ignore SVA/asserts + RuntimeFlags::SetVar("verilog_ignore_unnecessary_modules_in_v_files", 1); // SILIMATE: add to ignore unnecessary modules #endif #ifdef VERIFIC_VHDL_SUPPORT RuntimeFlags::SetVar("vhdl_extract_dualport_rams", 0);