2023-02-14 02:58:49 +01: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.
2026-02-01 19:44:20 +01:00
// SPDX-FileCopyrightText: 2026 Wilson Snyder
2023-02-14 02:58:49 +01:00
// SPDX-License-Identifier: CC0-1.0
2026-02-01 19:44:20 +01:00
// verilog_format: off
`define stop $stop
`define checkh(gotv, expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);
// verilog_format: on
2025-09-13 15:28:43 +02:00
module t ;
2023-02-14 02:58:49 +01:00
2026-02-01 19:44:20 +01:00
parameter P = 4 'h5 ;
2023-02-14 02:58:49 +01:00
2026-02-01 19:44:20 +01:00
typedef struct { // Must be unpacked -- existing error check
// Update ctor_var_reset to check instead of making a constructor
bit [ 3 : 0 ] m_lo = P ;
bit [ 93 : 0 ] m_mid = '1 ; // Wide
bit [ 3 : 0 ] m_hi ;
} s_t ;
s_t s ;
2023-02-14 02:58:49 +01:00
2026-02-01 19:44:20 +01:00
initial begin
$display ( " %p " , s ) ;
`checkh ( s . m_lo , 4 'h5 ) ;
`checkh ( s . m_mid , ~ 94 'h0 ) ;
`checkh ( s . m_hi , 4 'h0 ) ;
s . m_mid = 94 'ha ;
s . m_hi = 4 'hb ;
$display ( " %p " , s ) ;
`checkh ( s . m_lo , 4 'h5 ) ;
`checkh ( s . m_mid , 94 'ha ) ;
`checkh ( s . m_hi , 4 'hb ) ;
2023-02-14 02:58:49 +01:00
2026-02-01 19:44:20 +01:00
$write ( " *-* All Finished *-* \n " ) ;
$finish ;
end
2023-02-14 02:58:49 +01:00
endmodule