2020-04-05 15:30: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: 2020 Wilson Snyder
2020-04-05 15:30:23 +02:00
// SPDX-License-Identifier: CC0-1.0
2026-06-03 20:55:00 +02:00
// verilog_format: off
`define stop $stop
`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);
// verilog_format: on
2025-09-13 15:28:43 +02:00
module t ;
2020-04-05 15:30:23 +02:00
2026-03-08 23:26:40 +01:00
class Cls ;
typedef enum {
A = 10 ,
B = 20 ,
C = 30
} en_t ;
2026-06-03 20:55:00 +02:00
en_t en ;
endclass
class WideCls ;
typedef enum logic [ 95 : 0 ] {
A = 96 'h1 ,
B = 96 'h2
} en_t ;
en_t en ;
2026-03-08 23:26:40 +01:00
endclass
2020-04-05 15:30:23 +02:00
2026-03-08 23:26:40 +01:00
initial begin
Cls c ;
2026-06-03 20:55:00 +02:00
WideCls w ;
string s ;
2026-03-08 23:26:40 +01:00
if ( c . A ! = 10 ) $stop ;
2026-06-03 20:55:00 +02:00
c = new ;
c . en = c . B ;
if ( c . en ! = 20 ) $stop ;
s = $sformatf ( " %p " , c ) ;
`checks ( s , " '{en:'h14} " ) ;
w = new ;
w . en = w . B ;
s = $sformatf ( " %p " , w ) ;
`checks ( s , " '{en:'h2} " ) ;
2026-03-08 23:26:40 +01:00
$write ( " *-* All Finished *-* \n " ) ;
$finish ;
end
2020-04-05 15:30:23 +02:00
endmodule