2014-05-10 16:40:35 +00:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
|
|
|
//
|
|
|
|
// DESCRIPTION: Verilator: Verilog Test module
|
|
|
|
//
|
2020-03-21 15:24:24 +00:00
|
|
|
// This file ONLY is placed under the Creative Commons Public Domain, for
|
|
|
|
// any use, without warranty, 2010 by Wilson Snyder.
|
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
2014-05-10 16:40:35 +00:00
|
|
|
|
|
|
|
#include <verilated.h>
|
2022-08-05 09:56:57 +00:00
|
|
|
|
2014-05-10 16:40:35 +00:00
|
|
|
#include "Vt_order_quad.h"
|
|
|
|
|
|
|
|
//======================================================================
|
|
|
|
|
|
|
|
unsigned int main_time = 0;
|
|
|
|
|
2019-11-10 01:35:12 +00:00
|
|
|
double sc_time_stamp() { return main_time; }
|
2014-05-10 16:40:35 +00:00
|
|
|
|
2020-08-15 14:12:55 +00:00
|
|
|
VM_PREFIX* topp = nullptr;
|
2014-05-10 16:40:35 +00:00
|
|
|
bool fail = false;
|
|
|
|
|
2018-08-25 13:52:45 +00:00
|
|
|
void check(QData got, QData exp) {
|
2014-05-10 16:40:35 +00:00
|
|
|
if (got != exp) {
|
2022-01-01 21:04:20 +00:00
|
|
|
VL_PRINTF("%%Error: got=0x%" PRIx64 " exp=0x%" PRIx64 "\n", got, exp);
|
2019-05-08 02:34:09 +00:00
|
|
|
fail = true;
|
2014-05-10 16:40:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-10 01:35:12 +00:00
|
|
|
int main(int argc, char* argv[]) {
|
2014-05-10 16:40:35 +00:00
|
|
|
Verilated::debug(0);
|
2023-01-21 19:05:11 +00:00
|
|
|
Verilated::commandArgs(argc, argv);
|
|
|
|
|
|
|
|
topp = new VM_PREFIX;
|
2014-05-10 16:40:35 +00:00
|
|
|
|
|
|
|
topp->a0 = 0;
|
|
|
|
topp->eval();
|
2020-05-29 00:32:07 +00:00
|
|
|
check(topp->y, 0x0ULL);
|
2014-05-10 16:40:35 +00:00
|
|
|
|
|
|
|
topp->a0 = 15;
|
|
|
|
topp->eval();
|
2020-05-29 00:32:07 +00:00
|
|
|
check(topp->y, 0x3c00000000ULL);
|
2014-05-10 16:40:35 +00:00
|
|
|
|
|
|
|
if (!fail) {
|
2019-05-08 02:34:09 +00:00
|
|
|
VL_PRINTF("*-* All Finished *-*\n");
|
|
|
|
topp->final();
|
2014-05-10 16:40:35 +00:00
|
|
|
} else {
|
2019-11-10 01:35:12 +00:00
|
|
|
vl_fatal(__FILE__, __LINE__, "top", "Unexpected results\n");
|
2014-05-10 16:40:35 +00:00
|
|
|
}
|
2020-11-17 11:37:55 +00:00
|
|
|
|
|
|
|
VL_DO_DANGLING(delete topp, topp);
|
2014-05-10 16:40:35 +00:00
|
|
|
return 0;
|
|
|
|
}
|