2024-03-02 15:07:32 +01:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2023 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
2025-12-21 03:46:43 +01:00
// verilog_format: off
2024-03-02 15:07:32 +01:00
`define stop $stop
2025-12-21 03:46:43 +01:00
`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
2024-03-02 15:07:32 +01:00
2025-09-13 15:28:43 +02:00
module t ;
2024-03-02 15:07:32 +01:00
initial begin
int res [ ] ;
int a [ * ] = ' { 1 : 100 , 2 : 200 , 3 : 300 } ;
// TODO results not known to be correct
res = a . map ( el ) with ( el = = 2 ) ;
`checkh ( res . size , 3 ) ;
`checkh ( res [ 0 ] , 0 ) ;
`checkh ( res [ 1 ] , 1 ) ;
`checkh ( res [ 2 ] , 0 ) ;
end
endmodule