Files
iverilog/ivtest/ivltests/array_string.v
T
Stephen Williams cea237b407 Add ivtest to the iverilog source tree
By adding ivtest to the iverilog source tree, it is easier to keep
the regression test synchronized with the source that is being tested.
This should be especially helpful for PRs that add a new feature, and
have a matching ivtest PR with the regression test for that feature.
2022-01-15 10:18:50 -08:00

27 lines
493 B
Verilog

module main;
localparam AMAX = 3;
string foo [0:AMAX];
localparam STRIDE = 2;
string source = "a0b1c2d3";
int idx;
initial begin
for (idx = 0 ; idx <= AMAX ; idx = idx+1) begin
foo[idx] = source.substr(idx*STRIDE+0, idx*STRIDE+STRIDE-1);
$display("foo[%0d] = %0s", idx, foo[idx]);
end
if (foo[2] != "c2") begin
$display("FAILED -- foo[2] = %0s", foo[2]);
$finish;
end
$display("PASSED");
$finish;
end
endmodule // main