2023-07-21 09:29:11 +02:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2023 by Antmicro Ltd.
// SPDX-License-Identifier: CC0-1.0
2024-02-09 00:39:13 +01: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-07-21 09:29:11 +02:00
2025-09-13 15:28:43 +02:00
module t ;
2023-07-21 09:29:11 +02:00
int a ;
function int assign5 ;
a = 5 ;
return 5 ;
endfunction
function int assign3 ;
a = 3 ;
return 3 ;
endfunction
function int incr ;
a + + ;
return a ;
endfunction
function int assign5_return_arg ( int x ) ;
a = 5 ;
return x ;
endfunction
int i ;
initial begin
a = 1 ;
i = assign5 ( ) + assign3 ( ) + incr ( ) ;
`checkd ( a , 4 ) ; `checkd ( i , 12 ) ;
a = 1 ;
i = assign5_return_arg ( assign3 ( ) + incr ( ) ) ;
`checkd ( a , 5 ) ; `checkd ( i , 7 ) ;
$write ( " *-* All Finished *-* \n " ) ;
$finish ;
end
endmodule