2025-05-24 23:59:23 +02:00
// DESCRIPTION: Verilator: Verilog Test module
//
2026-01-27 02:24:34 +01:00
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2025 Wilson Snyder
2025-05-24 23:59:23 +02:00
// SPDX-License-Identifier: CC0-1.0
2025-12-21 03:46:43 +01:00
// verilog_format: off
2025-05-24 23:59:23 +02:00
`define stop $stop
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got=%0x exp=%0x (%s !== %s)\n", `__FILE__,`__LINE__, (gotv), (expv), `"gotv`", `"expv`"); `stop; end while(0);
`define checks(gotv,expv) do if ((gotv) != (expv)) begin $write("%%Error: %s:%0d: got='%s' exp='%s'\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);
2025-12-21 03:46:43 +01:00
// verilog_format: on
2025-05-24 23:59:23 +02:00
class X ;
2026-03-03 13:21:24 +01:00
typedef enum int {
INITIAL ,
RUNNING ,
SUSPENDED ,
COMPLETING ,
DONE
} state_t ;
static
string
state_names [ state_t ] = ' {
INITIAL: " INITIAL " ,
RUNNING: " RUNNING " ,
SUSPENDED: " SUSPENDED " ,
COMPLETING: " COMPLETING " ,
DONE: " DONE "
} ;
protected state_t state ;
function new ( ) ;
this . state = INITIAL ;
`checks ( state_names [ this . state ] , " INITIAL " ) ;
this . state = RUNNING ;
`checks ( state_names [ this . state ] , " RUNNING " ) ;
endfunction
2025-05-24 23:59:23 +02:00
endclass
2025-12-21 03:46:43 +01:00
module t ;
2025-05-24 23:59:23 +02:00
2025-12-21 03:46:43 +01:00
initial begin
2026-02-09 00:20:28 +01:00
automatic X x = new ;
2025-12-21 03:46:43 +01:00
$finish ;
end
2025-05-24 23:59:23 +02:00
endmodule