Skip to content

Commit e21badd

Browse files
committed
Add "sim -q" option
Signed-off-by: Claire Xenia Wolf <[email protected]>
1 parent be32de1 commit e21badd

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

passes/sat/sim.cc

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ struct OutputWriter
7777
struct SimShared
7878
{
7979
bool debug = false;
80+
bool verbose = true;
8081
bool hide_internal = true;
8182
bool writeback = false;
8283
bool zinit = false;
@@ -181,7 +182,7 @@ struct SimInstance
181182
if ((shared->fst) && !(shared->hide_internal && wire->name[0] == '$')) {
182183
fstHandle id = shared->fst->getHandle(scope + "." + RTLIL::unescape_id(wire->name));
183184
if (id==0 && wire->name.isPublic())
184-
log_warning("Unable to found wire %s in input file.\n", (scope + "." + RTLIL::unescape_id(wire->name)).c_str());
185+
log_warning("Unable to find wire %s in input file.\n", (scope + "." + RTLIL::unescape_id(wire->name)).c_str());
185186
fst_handles[wire] = id;
186187
}
187188

@@ -764,7 +765,7 @@ struct SimInstance
764765
IdString name = qsig.as_wire()->name;
765766
fstHandle id = shared->fst->getHandle(scope + "." + RTLIL::unescape_id(name));
766767
if (id==0 && name.isPublic())
767-
log_warning("Unable to found wire %s in input file.\n", (scope + "." + RTLIL::unescape_id(name)).c_str());
768+
log_warning("Unable to find wire %s in input file.\n", (scope + "." + RTLIL::unescape_id(name)).c_str());
768769
if (id!=0) {
769770
Const fst_val = Const::from_string(shared->fst->valueOf(id));
770771
set_state(qsig, fst_val);
@@ -919,7 +920,7 @@ struct SimWorker : SimShared
919920

920921
if (debug)
921922
log("\n===== 0 =====\n");
922-
else
923+
else if (verbose)
923924
log("Simulating cycle 0.\n");
924925

925926
set_inports(reset, State::S1);
@@ -936,7 +937,7 @@ struct SimWorker : SimShared
936937
{
937938
if (debug)
938939
log("\n===== %d =====\n", 10*cycle + 5);
939-
else
940+
else if (verbose)
940941
log("Simulating cycle %d.\n", (cycle*2)+1);
941942
set_inports(clock, State::S0);
942943
set_inports(clockn, State::S1);
@@ -946,7 +947,7 @@ struct SimWorker : SimShared
946947

947948
if (debug)
948949
log("\n===== %d =====\n", 10*cycle + 10);
949-
else
950+
else if (verbose)
950951
log("Simulating cycle %d.\n", (cycle*2)+2);
951952

952953
set_inports(clock, State::S1);
@@ -1063,7 +1064,8 @@ struct SimWorker : SimShared
10631064

10641065
try {
10651066
fst->reconstructAllAtTimes(fst_clock, startCount, stopCount, [&](uint64_t time) {
1066-
log("Co-simulating %s %d [%lu%s].\n", (all_samples ? "sample" : "cycle"), cycle, (unsigned long)time, fst->getTimescaleString());
1067+
if (verbose)
1068+
log("Co-simulating %s %d [%lu%s].\n", (all_samples ? "sample" : "cycle"), cycle, (unsigned long)time, fst->getTimescaleString());
10671069
bool did_something = false;
10681070
for(auto &item : inputs) {
10691071
std::string v = fst->valueOf(item.second);
@@ -1172,7 +1174,8 @@ struct SimWorker : SimShared
11721174
state = 3;
11731175
break;
11741176
default:
1175-
log("Simulating cycle %d.\n", cycle);
1177+
if (verbose)
1178+
log("Simulating cycle %d.\n", cycle);
11761179
top->setState(inputs, line);
11771180
if (cycle) {
11781181
set_inports(clock, State::S1);
@@ -1253,7 +1256,8 @@ struct SimWorker : SimShared
12531256
curr_cycle = -1; // force detect change
12541257

12551258
if (curr_cycle != prev_cycle) {
1256-
log("Simulating cycle %d.\n", cycle);
1259+
if (verbose)
1260+
log("Simulating cycle %d.\n", cycle);
12571261
set_inports(clock, State::S1);
12581262
set_inports(clockn, State::S0);
12591263
update();
@@ -1623,6 +1627,9 @@ struct SimPass : public Pass {
16231627
log(" -sim-gate\n");
16241628
log(" co-simulation, x in FST can match any value in simulation\n");
16251629
log("\n");
1630+
log(" -q\n");
1631+
log(" disable per-cycle/sample log message\n");
1632+
log("\n");
16261633
log(" -d\n");
16271634
log(" enable debug output\n");
16281635
log("\n");
@@ -1695,6 +1702,10 @@ struct SimPass : public Pass {
16951702
worker.hide_internal = false;
16961703
continue;
16971704
}
1705+
if (args[argidx] == "-q") {
1706+
worker.verbose = false;
1707+
continue;
1708+
}
16981709
if (args[argidx] == "-d") {
16991710
worker.debug = true;
17001711
continue;

0 commit comments

Comments
 (0)