Tests: Unsupported on parameters in functions, bug1624.

This commit is contained in:
Driss Hafdi 2019-12-06 18:51:18 -05:00 committed by Wilson Snyder
parent 1a8b192e40
commit 11a1b201a9
3 changed files with 53 additions and 0 deletions

View 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

View 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;

View 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