mirror of
https://github.com/verilator/verilator.git
synced 2025-01-09 16:17:36 +00:00
Tests: Unsupported on parameters in functions, bug1624.
This commit is contained in:
parent
1a8b192e40
commit
11a1b201a9
7
test_regress/t/t_param_in_func_bad.out
Normal file
7
test_regress/t/t_param_in_func_bad.out
Normal file
@ -0,0 +1,7 @@
|
||||
%Error: t/t_param_in_func_bad.v:23: Unsupported: Parameters in functions.
|
||||
localparam logic[7:0] digits[10]
|
||||
^~~~~~
|
||||
%Error: t/t_param_in_func_bad.v:27: Can't find definition of variable: 'digits'
|
||||
return digits[d];
|
||||
^~~~~~
|
||||
%Error: Exiting due to
|
18
test_regress/t/t_param_in_func_bad.pl
Executable file
18
test_regress/t/t_param_in_func_bad.pl
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2019 by Wilson Snyder. This program is free software; you can
|
||||
# redistribute it and/or modify it under the terms of either the GNU
|
||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||
# Version 2.0.
|
||||
|
||||
scenarios(simulator => 1);
|
||||
|
||||
lint(
|
||||
fails => 1,
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
28
test_regress/t/t_param_in_func_bad.v
Normal file
28
test_regress/t/t_param_in_func_bad.v
Normal file
@ -0,0 +1,28 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2019 by Driss Hafdi.
|
||||
|
||||
module t (/*AUTOARG*/
|
||||
// Inputs
|
||||
clk
|
||||
);
|
||||
|
||||
input clk;
|
||||
|
||||
logic [7:0] digit = getDigit(4'd1);
|
||||
|
||||
initial begin
|
||||
if (digit != "1") $stop;
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
endmodule
|
||||
|
||||
function automatic logic[7:0] getDigit(logic[3:0] d);
|
||||
localparam logic[7:0] digits[10]
|
||||
= '{
|
||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
|
||||
};
|
||||
return digits[d];
|
||||
endfunction
|
Loading…
Reference in New Issue
Block a user