bug fix and cleanups

This commit is contained in:
Miodrag Milanovic 2022-02-04 10:01:06 +01:00
parent 7ef6da4c7d
commit 6db23de7b1
3 changed files with 8 additions and 8 deletions

View File

@ -174,7 +174,7 @@ static void reconstruct_clb_attimes(void *user_data, uint64_t pnt_time, fstHandl
void FstData::reconstruct_callback_attimes(uint64_t pnt_time, fstHandle pnt_facidx, const unsigned char *pnt_value, uint32_t /* plen */) void FstData::reconstruct_callback_attimes(uint64_t pnt_time, fstHandle pnt_facidx, const unsigned char *pnt_value, uint32_t /* plen */)
{ {
if (sample_times_ndx > sample_times.size()) return; if (sample_times_ndx >= sample_times.size()) return;
uint64_t time = sample_times[sample_times_ndx]; uint64_t time = sample_times[sample_times_ndx];
// if we are past the timestamp // if we are past the timestamp

View File

@ -752,7 +752,7 @@ struct SimInstance
} else if (shared->sim_mode == SimulationMode::gate && !fst_val.is_fully_def()) { // FST data contains X } else if (shared->sim_mode == SimulationMode::gate && !fst_val.is_fully_def()) { // FST data contains X
for(int i=0;i<fst_val.size();i++) { for(int i=0;i<fst_val.size();i++) {
if (fst_val[i]!=State::Sx && fst_val[i]!=sim_val[i]) { if (fst_val[i]!=State::Sx && fst_val[i]!=sim_val[i]) {
log_warning("Signal '%s' in file '%s' in simulation '%s'\n", log_id(item.first), log_signal(fst_val), log_signal(sim_val)); log_warning("Signal '%s' in file %s in simulation %s\n", log_id(item.first), log_signal(fst_val), log_signal(sim_val));
retVal = true; retVal = true;
break; break;
} }
@ -760,14 +760,14 @@ struct SimInstance
} else if (shared->sim_mode == SimulationMode::gold && !sim_val.is_fully_def()) { // sim data contains X } else if (shared->sim_mode == SimulationMode::gold && !sim_val.is_fully_def()) { // sim data contains X
for(int i=0;i<sim_val.size();i++) { for(int i=0;i<sim_val.size();i++) {
if (sim_val[i]!=State::Sx && fst_val[i]!=sim_val[i]) { if (sim_val[i]!=State::Sx && fst_val[i]!=sim_val[i]) {
log_warning("Signal '%s' in file '%s' in simulation '%s'\n", log_id(item.first), log_signal(fst_val), log_signal(sim_val)); log_warning("Signal '%s' in file %s in simulation %s\n", log_id(item.first), log_signal(fst_val), log_signal(sim_val));
retVal = true; retVal = true;
break; break;
} }
} }
} else { } else {
if (fst_val!=sim_val) { if (fst_val!=sim_val) {
log_warning("Signal '%s' in file '%s' in simulation '%s'\n", log_id(item.first), log_signal(fst_val), log_signal(sim_val)); log_warning("Signal '%s' in file %s in simulation '%s'\n", log_id(item.first), log_signal(fst_val), log_signal(sim_val));
retVal = true; retVal = true;
} }
} }
@ -1048,9 +1048,9 @@ struct SimWorker : SimShared
fst->reconstructAllAtTimes(samples); fst->reconstructAllAtTimes(samples);
bool initial = true; bool initial = true;
int cycle = 0; int cycle = 0;
log("Co-simulation from %zu%s to %zu%s\n", startCount, fst->getTimescaleString(), stopCount, fst->getTimescaleString()); log("Co-simulation from %lu%s to %lu%s\n", (unsigned long)startCount, fst->getTimescaleString(), (unsigned long)stopCount, fst->getTimescaleString());
for(auto &time : samples) { for(auto &time : samples) {
log("Co-simulating cycle %d [%zu%s].\n", cycle, time, fst->getTimescaleString()); log("Co-simulating cycle %d [%lu%s].\n", cycle, (unsigned long)time, fst->getTimescaleString());
for(auto &item : inputs) { for(auto &item : inputs) {
std::string v = fst->valueAt(item.second, time); std::string v = fst->valueAt(item.second, time);
top->set_state(item.first, Const::from_string(v)); top->set_state(item.first, Const::from_string(v));

View File

@ -1,9 +1,9 @@
read_verilog grom_computer.v grom_cpu.v alu.v ram_memory.v; read_verilog grom_computer.v grom_cpu.v alu.v ram_memory.v;
prep -top grom_computer; prep -top grom_computer;
sim -clock clk -reset reset -fst grom.fst -vcd grom.vcd -a -n 80 sim -clock clk -reset reset -fst grom.fst -vcd grom.vcd -n 80
sim -clock clk -r grom.fst -scope grom_computer -start 25ns -stop 100ns -sim-cmp sim -clock clk -r grom.fst -scope grom_computer -start 25ns -stop 100ns -sim-cmp
sim -clock clk -r grom.fst -scope grom_computer -stop 100ns -sim-gold sim -clock clk -r grom.fst -scope grom_computer -stop 100ns -sim-gold
sim -clock clk -r grom.fst -scope grom_computer -n 10 -sim-gate -a sim -clock clk -r grom.fst -scope grom_computer -n 10 -sim-gate