mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-29 01:03:29 +02:00
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.
46 lines
1015 B
Verilog
46 lines
1015 B
Verilog
|
|
program main;
|
|
|
|
function string sum_array(string array[]);
|
|
int idx;
|
|
sum_array = "";
|
|
for (idx = 0 ; idx < array.size() ; idx = idx+1)
|
|
sum_array = {sum_array, array[idx]};
|
|
endfunction // sum_array
|
|
|
|
string obj[];
|
|
string foo;
|
|
initial begin
|
|
foo = sum_array('{});
|
|
if (foo != "") begin
|
|
$display("FAILED -- sum of empty array returns %0s", foo);
|
|
$finish;
|
|
end
|
|
|
|
obj = new[3];
|
|
obj = '{"1", "2", "3"};
|
|
foo = sum_array(obj);
|
|
if (foo != "123") begin
|
|
$display("FAILED -- sum of '{\"1\",\"2\",\"3\"} is %0s", foo);
|
|
$finish;
|
|
end
|
|
|
|
obj = new[3] ('{"A", "B", "C"});
|
|
foo = sum_array(obj);
|
|
if (foo != "ABC") begin
|
|
$display("FAILED -- sum of '{\"A\",\"B\",\"C\"} is %0s", foo);
|
|
$finish;
|
|
end
|
|
|
|
obj = new[3] ("A");
|
|
foo = sum_array(obj);
|
|
if (foo != "AAA") begin
|
|
$display("FAILED -- sum of \"AAA\" is %0s", foo);
|
|
$finish;
|
|
end
|
|
|
|
$display("PASSED");
|
|
end // initial begin
|
|
|
|
endprogram // main
|