3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-05-18 05:04:46 +00:00

Fix comments and add freq annotation in sim pass

This commit is contained in:
Alain Dargelas 2024-10-21 15:53:48 -07:00
parent fcfa2fff31
commit c2aa611e5d
2 changed files with 33 additions and 40 deletions

View file

@ -2355,8 +2355,7 @@ struct VCDWriter : public OutputWriter
}
if (!worker->timescale.empty())
vcdfile << stringf("$timescale %s $end\n", worker->timescale.c_str());
vcdfile << stringf("$timescale 1%s $end\n", worker->timescale.c_str());
worker->top->write_output_header(
[this](IdString name) { vcdfile << stringf("$scope module %s $end\n", log_id(name)); },
[this]() { vcdfile << stringf("$upscope $end\n");},
@ -2500,6 +2499,8 @@ struct AnnotateActivity : public OutputWriter {
SignalActivityDataMap::iterator itr = dataMap.find(clk);
std::vector<uint32_t> &clktoggleCounts = itr->second.toggleCounts;
double clk_period = real_timescale * (double)max_time / (clktoggleCounts[0] / 2);
double frequency = 1 / clk_period;
worker->top->module->set_string_attribute("$FREQUENCY", std::to_string(frequency));
if (debug) {
std::cout << "Clock toggle count: " << clktoggleCounts[0] << "\n";
std::cout << "Max time: " << max_time << "\n";