forked from github/verilator
Tests: Better example, test for null file in vcd open
This commit is contained in:
parent
4df9d70e4a
commit
a51e95d052
@ -39,7 +39,7 @@ int main(int argc, char **argv, char **env) {
|
||||
top->clk = 0;
|
||||
top->passed = 0;
|
||||
|
||||
while (main_time < 60 && !top->passed) {
|
||||
while (main_time < 60 && !top->passed && !Verilated::gotFinish()) {
|
||||
|
||||
if ((main_time % 10) == 3) { // Toggle clock
|
||||
top->clk = 1;
|
||||
@ -55,7 +55,7 @@ int main(int argc, char **argv, char **env) {
|
||||
|
||||
top->eval(); // Evaluate model
|
||||
#if VM_TRACE
|
||||
tfp->dump (main_time); // Create waveform trace for this timestamp
|
||||
if (tfp) tfp->dump (main_time); // Create waveform trace for this timestamp
|
||||
#endif
|
||||
|
||||
// Read outputs
|
||||
@ -70,7 +70,7 @@ int main(int argc, char **argv, char **env) {
|
||||
top->final();
|
||||
|
||||
#if VM_TRACE
|
||||
tfp->close();
|
||||
if (tfp) tfp->close();
|
||||
#endif
|
||||
|
||||
if (!top->passed) {
|
||||
|
@ -807,7 +807,7 @@ sub _make_main {
|
||||
|
||||
if ($self->{trace}) {
|
||||
$fh->print("#if VM_TRACE\n");
|
||||
$fh->print(" tfp->close();\n");
|
||||
$fh->print(" if (tfp) tfp->close();\n");
|
||||
$fh->print("#endif //VM_TRACE\n");
|
||||
}
|
||||
$fh->print("\n");
|
||||
@ -840,7 +840,7 @@ sub _print_advance_time {
|
||||
print $fh " ${set}eval();\n";
|
||||
if ($self->{trace} && !$self->{sp}) {
|
||||
$fh->print("#if VM_TRACE\n");
|
||||
$fh->print(" tfp->dump (main_time);\n");
|
||||
$fh->print(" if (tfp) tfp->dump (main_time);\n");
|
||||
$fh->print("#endif //VM_TRACE\n");
|
||||
}
|
||||
}
|
||||
|
@ -134,11 +134,11 @@ int sc_main(int argc, char* argv[]) {
|
||||
cout <<("Test beginning...\n");
|
||||
|
||||
reset_l = 1;
|
||||
while (VL_TIME_Q() < 60 && !passed) {
|
||||
while (VL_TIME_Q() < 60 && !passed && !Verilated::gotFinish()) {
|
||||
#if WAVES
|
||||
// Flush the wave files each cycle so we can immediately see the output
|
||||
// Don't do this in "real" programs, do it in a abort() handler instead
|
||||
tfp->flush();
|
||||
if (tfp) tfp->flush();
|
||||
#endif
|
||||
if (VL_TIME_Q() > 10) {
|
||||
reset_l = 1; // Deassert reset
|
||||
@ -157,7 +157,7 @@ int sc_main(int argc, char* argv[]) {
|
||||
//==========
|
||||
// Close Waves
|
||||
#if WAVES
|
||||
tfp->close();
|
||||
if (tfp) tfp->close();
|
||||
#endif
|
||||
|
||||
if (!passed) {
|
||||
|
Loading…
Reference in New Issue
Block a user