2025-10-08 15:39:50 +02:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2025 by Antmicro.
// SPDX-License-Identifier: CC0-1.0
2025-12-21 03:46:43 +01:00
// verilog_format: off
2025-10-08 15:39:50 +02:00
`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)
2025-12-21 03:46:43 +01:00
// verilog_format: on
2025-10-08 15:39:50 +02:00
typedef struct packed {
logic sig1 ;
logic sig2 ;
logic not_forced ;
} s1 ;
module t ( clk ) ;
input clk ;
s1 s1inst ;
logic a = 1 'b0 ;
logic b ;
initial force s1inst . sig1 = a ;
always @ ( posedge clk ) begin
force s1inst . sig2 = 1 'b1 ;
force s1inst . sig1 = b ;
`checkh ( s1inst . sig1 , b ) ;
`checkh ( s1inst . sig2 , 1 'b1 ) ;
$finish ;
end
endmodule