verilator/test_regress/t/t_const_string_func.v

23 lines
584 B
Systemverilog
Raw Normal View History

// DESCRIPTION: Verilator: constant string functions
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2023 Wilson Snyder
// SPDX-License-Identifier: CC0-1.0
2026-03-03 13:21:24 +01:00
module t;
2026-03-03 13:21:24 +01:00
function automatic string foo_func();
foo_func = "FOO";
foo_func = $sformatf("%sBAR", foo_func);
for (int i = 0; i < 4; i++) foo_func = $sformatf("%s%0d", foo_func, i);
endfunction
2026-03-03 13:21:24 +01:00
localparam string the_foo = foo_func();
2026-03-03 13:21:24 +01:00
initial begin
if (the_foo != "FOOBAR0123") $stop;
$write("*-* All Finished *-*\n");
$finish;
end
endmodule