Fix VCD timestamps (#1469)

* Fix VCD timestamps.

VCD simulation timestamps are integers.
eb71c31cf1 changed them to doubles which
causes the files to be unreadable.

* Fix VCD byte values

no spaces allowed between b and the bits.  Value will be left-extended
with zeros.
This commit is contained in:
Rick Altherr 2024-06-20 17:27:06 -07:00 committed by GitHub
parent 59d4760976
commit b95c52dc85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -71,7 +71,7 @@ static void vcd_output_if_changed_byte(ofstream &fp, uint8_t data, int pin, char
{ {
if (prev_value[pin] != data) { if (prev_value[pin] != data) {
prev_value[pin] = data; prev_value[pin] = data;
fp << "b" << fmt::format("{0:8b}", data) << " " << symbol << endl; fp << "b" << fmt::format("{0:b}", data) << " " << symbol << endl;
} }
} }
@ -130,7 +130,7 @@ void scsimon_generate_value_change_dump(const string &filename, const vector<sha
<< "$end" << endl; << "$end" << endl;
for (shared_ptr<DataSample> cur_sample : data_capture_array) { for (shared_ptr<DataSample> cur_sample : data_capture_array) {
vcd_ofstream << "#" << (double)cur_sample->GetTimestamp() * ScsiMon::ns_per_loop << endl; vcd_ofstream << "#" << (uint64_t)((double)cur_sample->GetTimestamp() * ScsiMon::ns_per_loop) << endl;
vcd_output_if_changed_bool(vcd_ofstream, cur_sample->GetBSY(), PIN_BSY, SYMBOL_PIN_BSY); vcd_output_if_changed_bool(vcd_ofstream, cur_sample->GetBSY(), PIN_BSY, SYMBOL_PIN_BSY);
vcd_output_if_changed_bool(vcd_ofstream, cur_sample->GetSEL(), PIN_SEL, SYMBOL_PIN_SEL); vcd_output_if_changed_bool(vcd_ofstream, cur_sample->GetSEL(), PIN_SEL, SYMBOL_PIN_SEL);
vcd_output_if_changed_bool(vcd_ofstream, cur_sample->GetCD(), PIN_CD, SYMBOL_PIN_CD); vcd_output_if_changed_bool(vcd_ofstream, cur_sample->GetCD(), PIN_CD, SYMBOL_PIN_CD);