2023-03-13 22:03:53 -04:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
2024-02-08 18:39:13 -05:00
`define stop $stop
`define checkd(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got=%0d exp=%0d\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);
2023-03-13 22:03:53 -04:00
module t ( /*AUTOARG*/ );
typedef struct {
int b [ $ ];
} st_t ;
function automatic st_t bar ();
// verilator no_inline_task
for ( int i = 0 ; i < 4 ; ++ i ) begin
bar . b . push_back ( i );
end
endfunction // bar
st_t res ;
initial begin
res = bar ();
`checkd ( res . b [ 0 ], 0 );
`checkd ( res . b [ 1 ], 1 );
`checkd ( res . b [ 2 ], 2 );
`checkd ( res . b [ 3 ], 3 );
$write ( "*-* All Finished *-* \n " );
$finish ;
end
endmodule