Internals: Detab and fix spacing style issues in tests and scripts. No functional change.

This commit is contained in:
Wilson Snyder 2019-05-07 22:34:09 -04:00
parent 37c8cc82b2
commit f818ddc71c
77 changed files with 3109 additions and 3102 deletions

View File

@ -34,7 +34,8 @@ public:
m_simulators.verilator = true; m_simulators.verilator = true;
} else if (0 == strcmp(m_info.product, "Verilator")) { } else if (0 == strcmp(m_info.product, "Verilator")) {
m_simulators.icarus = true; m_simulators.icarus = true;
} else if (0 == strncmp(m_info.product, "Chronologic Simulation VCS", strlen("Chronologic Simulation VCS"))) { } else if (0 == strncmp(m_info.product, "Chronologic Simulation VCS",
strlen("Chronologic Simulation VCS"))) {
m_simulators.vcs = true; m_simulators.vcs = true;
} else { } else {
printf("%%Warning: %s:%d: Unknown simulator in TestSimulator.h: %s\n", printf("%%Warning: %s:%d: Unknown simulator in TestSimulator.h: %s\n",

View File

@ -24,7 +24,7 @@ class TestVpiHandle {
public: public:
TestVpiHandle() : m_handle(NULL), m_free(true) { } TestVpiHandle() : m_handle(NULL), m_free(true) { }
TestVpiHandle(vpiHandle h) : m_handle(h), m_free(true) { } TestVpiHandle(vpiHandle h) : m_handle(h), m_free(true) { }
~TestVpiHandle() { if (m_handle && m_free) { vpi_free_object(m_handle); m_handle=NULL; } } // icarus has yet to catch up with 1800-2009 ~TestVpiHandle() { if (m_handle && m_free) { vpi_free_object(m_handle); m_handle=NULL; } }
operator vpiHandle() const { return m_handle; } operator vpiHandle() const { return m_handle; }
inline TestVpiHandle& operator= (vpiHandle h) { m_handle = h; return *this; } inline TestVpiHandle& operator= (vpiHandle h) { m_handle = h; return *this; }
TestVpiHandle& nofree() { TestVpiHandle& nofree() {

View File

@ -38,7 +38,7 @@ static void checkFinish(const char *msg) {
vl_fatal(__FILE__, __LINE__, "dut", msg); vl_fatal(__FILE__, __LINE__, "dut", msg);
exit(1); exit(1);
} }
} // checkFinish () }
// Convenience function to log the value of a register in hex. Only in verbose // Convenience function to log the value of a register in hex. Only in verbose
@ -50,7 +50,7 @@ static void logReg(int clk,
#ifdef TEST_VERBOSE #ifdef TEST_VERBOSE
cout << "clk = " << clk << ", " << desc << " = " << val << note << endl; cout << "clk = " << clk << ", " << desc << " = " << val << note << endl;
#endif #endif
} // logReg () }
// Convenience function to log the value of a register in hex. Only in verbose // Convenience function to log the value of a register in hex. Only in verbose
@ -67,16 +67,15 @@ static void logRegHex (int clk,
<< setfill(' ') << setw(0) << dec << note << endl; << setfill(' ') << setw(0) << dec << note << endl;
#endif #endif
} // logRegHex () }
// Convenience function to check we got an expected result. Silent on success. // Convenience function to check we got an expected result. Silent on success.
static void checkResult (bool p, static void checkResult(bool p, const char *msg_fail) {
const char *msg_fail) {
if (!p) { if (!p) {
vl_fatal(__FILE__, __LINE__, "dut", msg_fail); vl_fatal(__FILE__, __LINE__, "dut", msg_fail);
} }
} // checkResult () }
// Main function instantiates the model and steps through the test. // Main function instantiates the model and steps through the test.
@ -714,8 +713,7 @@ int main () {
// Tidy up // Tidy up
dut->final(); dut->final();
cout << "*-* All Finished *-*" << endl;; cout << "*-* All Finished *-*" << endl;;
}
} // main ()
// Local Variables: // Local Variables:
// c-file-style:"cc-mode" // c-file-style:"cc-mode"

View File

@ -121,7 +121,7 @@ int _mon_check_range(TestVpiHandle& handle, int size, int left, int right) {
int _mon_check_memory() { int _mon_check_memory() {
int cnt; int cnt;
TestVpiHandle mem_h, lcl_h; TestVpiHandle mem_h, lcl_h;
vpiHandle iter_h; // icarus does not like auto free of iterator handles vpiHandle iter_h; // Icarus does not like auto free of iterator handles
s_vpi_value value = { s_vpi_value value = {
vpiIntVal, .value = {.integer = 0} vpiIntVal, .value = {.integer = 0}
}; };
@ -220,7 +220,8 @@ int main(int argc, char **argv, char **env) {
double sim_time = 1100; double sim_time = 1100;
Verilated::commandArgs(argc, argv); Verilated::commandArgs(argc, argv);
Verilated::debug(0); Verilated::debug(0);
Verilated::fatalOnVpiError(0); // we're going to be checking for these errors do don't crash out // we're going to be checking for these errors do don't crash out
Verilated::fatalOnVpiError(0);
VM_PREFIX* topp = new VM_PREFIX(""); // Note null name - we're flattening it out VM_PREFIX* topp = new VM_PREFIX(""); // Note null name - we're flattening it out
@ -266,4 +267,3 @@ int main(int argc, char **argv, char **env) {
} }
#endif #endif

View File

@ -151,7 +151,8 @@ int main(int argc, char **argv, char **env) {
double sim_time = 1100; double sim_time = 1100;
Verilated::commandArgs(argc, argv); Verilated::commandArgs(argc, argv);
Verilated::debug(0); Verilated::debug(0);
Verilated::fatalOnVpiError(0); // we're going to be checking for these errors do don't crash out // we're going to be checking for these errors do don't crash out
Verilated::fatalOnVpiError(0);
VM_PREFIX* topp = new VM_PREFIX(""); // Note null name - we're flattening it out VM_PREFIX* topp = new VM_PREFIX(""); // Note null name - we're flattening it out

View File

@ -904,12 +904,19 @@ sub VPOW { # Power is a signed operation
$_[0]{val}=$o; $_[0]{val}=$o;
print "VV = $o\n"; print "VV = $o\n";
} }
sub VRANGE { #print "RANGE ",$_[1]->to_Hex,' ',$_[2]->to_Hex,' ',$_[3]->to_Hex," \n"; sub VRANGE {
return VRANGE_CONST($_[0],$_[1],$_[2]->Word_Read(0),$_[3]->Word_Read(0), $_[4]); } #print "RANGE ",$_[1]->to_Hex,' ',$_[2]->to_Hex,' ',$_[3]->to_Hex," \n";
return VRANGE_CONST($_[0], $_[1], $_[2]->Word_Read(0),
$_[3]->Word_Read(0), $_[4]);
}
sub VBITSELP { sub VBITSELP {
return VRANGE_CONST($_[0],$_[1],$_[2]->Word_Read(0)+$_[3]->Word_Read(0)-1, $_[2]->Word_Read(0), $_[4]); } return VRANGE_CONST($_[0], $_[1], $_[2]->Word_Read(0)+$_[3]->Word_Read(0)-1,
$_[2]->Word_Read(0), $_[4]);
}
sub VBITSELM { sub VBITSELM {
return VRANGE_CONST($_[0],$_[1],$_[2]->Word_Read(0), $_[2]->Word_Read(0)-$_[3]->Word_Read(0)+1, $_[4]); } return VRANGE_CONST($_[0],$_[1],$_[2]->Word_Read(0),
$_[2]->Word_Read(0)-$_[3]->Word_Read(0)+1, $_[4]);
}
sub VRANGE_CONST { sub VRANGE_CONST {
# to, from, msb, lsb, variable_lsb_to_subtract # to, from, msb, lsb, variable_lsb_to_subtract
#print "RANGE ",$_[1]->to_Hex,' ',$_[2],' ',$_[3],' ',$_[4]," \n"; #print "RANGE ",$_[1]->to_Hex,' ',$_[2],' ',$_[3],' ',$_[4]," \n";