2023-07-21 09:29:11 +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: 2023 Antmicro Ltd
2023-07-21 09:29:11 +02:00
// SPDX-License-Identifier: CC0-1.0
2026-03-08 23:26:40 +01:00
// verilog_format: off
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);
2026-03-08 23:26:40 +01:00
// verilog_format: on
2023-07-21 09:29:11 +02:00
2025-09-13 15:28:43 +02:00
module t ;
2026-03-08 23:26:40 +01: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 ;
2023-07-21 09:29:11 +02:00
2026-03-08 23:26:40 +01:00
initial begin
a = 1 ;
i = assign5 ( ) + assign3 ( ) + incr ( ) ;
`checkd ( a , 4 ) ;
`checkd ( i , 12 ) ;
2023-07-21 09:29:11 +02:00
2026-03-08 23:26:40 +01:00
a = 1 ;
i = assign5_return_arg ( assign3 ( ) + incr ( ) ) ;
`checkd ( a , 5 ) ;
`checkd ( i , 7 ) ;
2023-07-21 09:29:11 +02:00
2026-03-08 23:26:40 +01:00
$write ( " *-* All Finished *-* \n " ) ;
$finish ;
end
2023-07-21 09:29:11 +02:00
endmodule