Tests: Call debug earlier to allow command line override

This commit is contained in:
Wilson Snyder 2023-01-21 14:05:11 -05:00
parent c2bdd06fcc
commit a98eceb501
44 changed files with 88 additions and 67 deletions

View File

@ -29,13 +29,14 @@ void clockit(int clk1, int clk0) {
}
int main(int argc, char* argv[]) {
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
topp = new VM_PREFIX;
topp->check = 0;
clockit(0, 0);
main_time += 10;
Verilated::debug(0);
for (int i = 0; i < 2; i++) {
clockit(0, 0);
clockit(0, 1);

View File

@ -18,8 +18,8 @@
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
srand48(5);
const std::unique_ptr<Vt_comb_input_0> topp{new Vt_comb_input_0};

View File

@ -18,8 +18,8 @@
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
srand48(5);
const std::unique_ptr<Vt_comb_input_1> topp{new Vt_comb_input_1};

View File

@ -18,8 +18,8 @@
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
srand48(5);
const std::unique_ptr<Vt_comb_input_2> topp{new Vt_comb_input_2};

View File

@ -22,9 +22,10 @@ double sc_time_stamp() { return main_time; }
VM_PREFIX* topp = nullptr;
int main(int argc, char* argv[]) {
topp = new VM_PREFIX;
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
topp = new VM_PREFIX;
topp->eval();
VL_DO_DANGLING(delete topp, topp);

View File

@ -38,9 +38,10 @@ double sc_time_stamp() { return main_time; }
VM_PREFIX* topp = nullptr;
int main(int argc, char* argv[]) {
topp = new VM_PREFIX;
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
topp = new VM_PREFIX;
topp->eval();
dpix_task(); // Missing svSetScope

View File

@ -28,9 +28,10 @@ double sc_time_stamp() { return main_time; }
VM_PREFIX* topp = nullptr;
int main(int argc, char* argv[]) {
topp = new VM_PREFIX;
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
topp = new VM_PREFIX;
topp->eval();

View File

@ -40,9 +40,10 @@ double sc_time_stamp() { return main_time; }
VM_PREFIX* topp = nullptr;
int main(int argc, char* argv[]) {
topp = new VM_PREFIX;
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
topp = new VM_PREFIX;
topp->in = 1.1;
topp->eval();

View File

@ -114,8 +114,8 @@ int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
const std::unique_ptr<VM_PREFIX> topp{new VM_PREFIX{contextp.get(),
// Note null name - we're flattening it out

View File

@ -15,9 +15,10 @@
double sc_time_stamp() { return 0; }
int main(int argc, char* argv[]) {
Vt_enum_public* topp = new Vt_enum_public;
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
Vt_enum_public* topp = new Vt_enum_public;
// Make sure public tag worked
if (Vt_enum_public_p3::ZERO == Vt_enum_public_p3::ONE) {}

View File

@ -22,9 +22,10 @@ bool gotit = false;
void myfunction() { gotit = true; }
int main(int argc, char* argv[]) {
topp = new VM_PREFIX;
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
topp = new VM_PREFIX;
topp->eval();
if (!gotit) vl_fatal(__FILE__, __LINE__, "dut", "Never got call to myfunction");

View File

@ -18,8 +18,8 @@
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
srand48(5);
const std::unique_ptr<VM_PREFIX> topp{new VM_PREFIX{"top"}};

View File

@ -18,8 +18,8 @@
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
srand48(5);
const std::unique_ptr<VM_PREFIX> topp{new VM_PREFIX{"top"}};

View File

@ -13,9 +13,10 @@
double sc_time_stamp() { return 0; }
int main(int argc, char* argv[]) {
Vt_func_rand* topp = new Vt_func_rand;
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
Vt_func_rand* topp = new Vt_func_rand;
printf("\nTesting\n");
for (int i = 0; i < 10; i++) {

View File

@ -18,8 +18,8 @@ int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
// VL_USE_THREADS define is set in t_gantt_two.pl
contextp->threads(TEST_USE_THREADS);
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
std::unique_ptr<Vt_gantt_two> topap{new Vt_gantt_two{contextp.get(), "topa"}};
std::unique_ptr<Vt_gantt_two> topbp{new Vt_gantt_two{contextp.get(), "topb"}};

View File

@ -48,11 +48,11 @@ long long get_memory_usage() {
void make_and_destroy() {
#ifdef VL_NO_LEGACY
VerilatedContext* contextp = new VerilatedContext;
VM_PREFIX* topp = new VM_PREFIX{contextp};
contextp->debug(0);
VM_PREFIX* topp = new VM_PREFIX{contextp};
#else
VM_PREFIX* topp = new VM_PREFIX;
Verilated::debug(0);
VM_PREFIX* topp = new VM_PREFIX;
#endif
topp->eval();

View File

@ -17,6 +17,7 @@ QData MaskVal(int lbit, int hbit) {
int main(int argc, char* argv[]) {
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
Vt_math_imm2* sim = new Vt_math_imm2;
int lbit, hbit;

View File

@ -45,11 +45,12 @@ unsigned int StepSim(Vt_mem_slot* sim, unsigned int slot, unsigned int bit, unsi
}
int main(int argc, char* argv[]) {
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
Vt_mem_slot* sim = new Vt_mem_slot;
int slot, bit, i;
Verilated::debug(0);
// clear all bits in the array
for (slot = 0; slot < 3; slot++)
for (bit = 0; bit < 2; bit++) //

View File

@ -20,9 +20,10 @@ double sc_time_stamp() { return 0; }
int errors = 0;
int main(int argc, char* argv[]) {
Vt_multitop_sig* topp = new Vt_multitop_sig{""};
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
Vt_multitop_sig* topp = new Vt_multitop_sig{""};
{
topp->a__02Ein = 0;

View File

@ -27,9 +27,10 @@ void check(QData got, QData exp) {
}
int main(int argc, char* argv[]) {
topp = new VM_PREFIX;
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
topp = new VM_PREFIX;
topp->a0 = 0;
topp->eval();

View File

@ -15,9 +15,10 @@
double sc_time_stamp() { return 0; }
int main(int argc, char* argv[]) {
Vt_param_public* topp = new Vt_param_public;
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
Vt_param_public* topp = new Vt_param_public;
// Make sure public tag worked
if (static_cast<int>(Vt_param_public_t::TOP_PARAM) != 30) {

View File

@ -16,8 +16,8 @@ std::unique_ptr<Vt_public_clk> topp;
int main(int argc, char** argv) {
vluint64_t sim_time = 1100;
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
srand48(5);
topp.reset(new Vt_public_clk("top"));

View File

@ -16,8 +16,8 @@ std::unique_ptr<Vt_public_seq> topp;
int main(int argc, char** argv) {
vluint64_t sim_time = 1100;
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
srand48(5);
topp.reset(new Vt_public_seq("top"));

View File

@ -23,9 +23,10 @@ int errors = 0;
double sc_time_stamp() { return main_time; }
int main(int argc, char* argv[]) {
// No need to make a model: topp = new VM_PREFIX;
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
// No need to make a model: topp = new VM_PREFIX;
{
VerilatedSave os;
os.open("/No/such_file_as_this");

View File

@ -23,10 +23,11 @@ const char* trace_name() {
}
int main(int argc, char** argv) {
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
Verilated::debug(0);
Verilated::traceEverOn(true);
Verilated::commandArgs(argc, argv);
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
std::unique_ptr<VerilatedVcdC> tfp{new VerilatedVcdC};
top->trace(tfp.get(), 99);

View File

@ -23,10 +23,11 @@ const char* trace_name() {
}
int main(int argc, char** argv) {
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
Verilated::debug(0);
Verilated::traceEverOn(true);
Verilated::commandArgs(argc, argv);
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
std::unique_ptr<VerilatedFstC> tfp{new VerilatedFstC};
top->trace(tfp.get(), 99);

View File

@ -20,10 +20,11 @@ double sc_time_stamp() { return (double)main_time; }
const unsigned long long dt_2 = 3;
int main(int argc, char** argv) {
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
Verilated::debug(0);
Verilated::traceEverOn(true);
Verilated::commandArgs(argc, argv);
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
#if defined(T_TRACE_DUMPVARS_DYN_VCD_0) || defined(T_TRACE_DUMPVARS_DYN_VCD_1)
std::unique_ptr<VerilatedVcdC> tfp{new VerilatedVcdC};

View File

@ -28,10 +28,11 @@ double sc_time_stamp() { return (double)main_time; }
const unsigned long long dt_2 = 3;
int main(int argc, char** argv) {
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
Verilated::debug(0);
Verilated::traceEverOn(true);
Verilated::commandArgs(argc, argv);
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
std::unique_ptr<VerilatedVcdC> tfp{new VerilatedVcdC};
top->trace(tfp.get(), 99);

View File

@ -26,10 +26,11 @@ double sc_time_stamp() { return (double)main_time; }
const unsigned long long dt_2 = 3;
int main(int argc, char** argv) {
VM_PREFIX* top = new VM_PREFIX{"top"};
Verilated::debug(0);
Verilated::traceEverOn(true);
Verilated::commandArgs(argc, argv);
VM_PREFIX* top = new VM_PREFIX{"top"};
VerilatedVcdC* tfp = new VerilatedVcdC;
top->trace(tfp, 99);

View File

@ -17,10 +17,11 @@ unsigned long long main_time = 0;
double sc_time_stamp() { return (double)main_time; }
int main(int argc, char** argv) {
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
Verilated::debug(0);
Verilated::traceEverOn(true);
Verilated::commandArgs(argc, argv);
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
std::unique_ptr<VerilatedVcdC> tfp{new VerilatedVcdC};
top->trace(tfp.get(), 99);

View File

@ -30,8 +30,8 @@ int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
contextp->traceEverOn(true);
srand48(5);
ap = new VM_PREFIX{contextp.get(), "topa"};

View File

@ -28,11 +28,12 @@ VM_PREFIX* ap;
Vt_trace_two_b* bp;
int sc_main(int argc, char** argv) {
Verilated::debug(0);
Verilated::traceEverOn(true);
Verilated::commandArgs(argc, argv);
sc_signal<bool> clk;
sc_time sim_time(1100, SC_NS);
Verilated::commandArgs(argc, argv);
Verilated::traceEverOn(true);
Verilated::debug(0);
srand48(5);
ap = new VM_PREFIX{"topa"};
bp = new Vt_trace_two_b{"topb"};

View File

@ -33,12 +33,11 @@ bool check() {
}
int main() {
bool pass = true;
Verilated::debug(0);
tb = new VM_PREFIX{"tb"};
// loop through every possibility and check the result
bool pass = true;
for (tb->SEL = 0; tb->SEL < 2; tb->SEL++) {
for (tb->A = 0; tb->A < 4; tb->A++) {
tb->eval();

View File

@ -44,12 +44,12 @@ bool check() {
}
int main() {
bool pass = true;
Verilated::debug(0);
tb = new Vt_tri_pullup{"tb"};
// loop through every possibility and check the result
bool pass = true;
for (tb->OE = 0; tb->OE < 2; tb->OE++) {
for (tb->A = 0; tb->A < 2; tb->A++) {
tb->eval();

View File

@ -42,12 +42,12 @@ bool check() {
}
int main() {
bool pass = true;
Verilated::debug(0);
tb = new Vt_tri_select{"tb"};
// loop through every possibility and check the result
bool pass = true;
for (tb->OE1 = 0; tb->OE1 < 2; tb->OE1++) {
for (tb->OE2 = 0; tb->OE2 < 2; tb->OE2++) {
for (tb->A1 = 0; tb->A1 < 4; tb->A1++) {

View File

@ -21,6 +21,7 @@ double sc_time_stamp() { return main_time; }
int main(int argc, char** argv) {
Verilated::debug(0);
Verilated::commandArgs(argc, argv);
VM_PREFIX* topp = new VM_PREFIX{""}; // Note null name - we're flattening it out

View File

@ -147,8 +147,8 @@ int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 100;
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
const std::unique_ptr<VM_PREFIX> topp{new VM_PREFIX{contextp.get(),
// Note null name - we're flattening it out

View File

@ -243,8 +243,8 @@ int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
const std::unique_ptr<VM_PREFIX> topp{new VM_PREFIX{contextp.get(),
// Note null name - we're flattening it out

View File

@ -254,8 +254,8 @@ int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
// we're going to be checking for these errors do don't crash out
contextp->fatalOnVpiError(0);

View File

@ -175,8 +175,8 @@ int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
// we're going to be checking for these errors do don't crash out
contextp->fatalOnVpiError(0);

View File

@ -243,8 +243,8 @@ int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
// we're going to be checking for these errors do don't crash out
contextp->fatalOnVpiError(0);

View File

@ -28,8 +28,8 @@ int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
const std::unique_ptr<VM_PREFIX> topp{new VM_PREFIX{contextp.get(),
// Note null name - we're flattening it out

View File

@ -697,8 +697,8 @@ int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
const std::unique_ptr<VM_PREFIX> topp{new VM_PREFIX{contextp.get(),
// Note null name - we're flattening it out

View File

@ -109,8 +109,8 @@ int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;
contextp->commandArgs(argc, argv);
contextp->debug(0);
contextp->commandArgs(argc, argv);
const std::unique_ptr<VM_PREFIX> topp{new VM_PREFIX{contextp.get(),
// Note null name - we're flattening it out