mirror of
https://github.com/verilator/verilator.git
synced 2025-01-19 12:54:02 +00:00
Tests: New scope-relevant tests, towards bug1305.
This commit is contained in:
parent
07e6bc17db
commit
00214f738f
3
test_regress/t/t_clk_scope_bad.out
Normal file
3
test_regress/t/t_clk_scope_bad.out
Normal file
@ -0,0 +1,3 @@
|
||||
%Warning-CLKDATA: t/t_clk_scope_bad.v:35: Clock used as data (on rhs of assignment) in sequential block clk
|
||||
%Warning-CLKDATA: Use "/* verilator lint_off CLKDATA */" and lint_on around source to disable this message.
|
||||
%Error: Exiting due to
|
19
test_regress/t/t_clk_scope_bad.pl
Executable file
19
test_regress/t/t_clk_scope_bad.pl
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003-2009 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);
|
||||
|
||||
compile(
|
||||
v_flags2 => ["--lint-only"],
|
||||
fails => 1,
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
37
test_regress/t/t_clk_scope_bad.v
Normal file
37
test_regress/t/t_clk_scope_bad.v
Normal file
@ -0,0 +1,37 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2019 by Wilson Snyder.
|
||||
|
||||
module t (/*AUTOARG*/
|
||||
// Outputs
|
||||
out,
|
||||
// Inputs
|
||||
clk, in
|
||||
);
|
||||
|
||||
input clk;
|
||||
input [2:0] in;
|
||||
output [2:0] out;
|
||||
|
||||
logic [2:0] r_in;
|
||||
always_ff @ (posedge clk) r_in <= in;
|
||||
|
||||
flop p0 (.clk(clk), .d(r_in[0]), .q(out[0]));
|
||||
flop p2 (.clk(r_in[1]), .d(clk), .q(out[1]));
|
||||
flop p1 (.clk(clk), .d(r_in[2]), .q(out[2]));
|
||||
|
||||
endmodule
|
||||
|
||||
module flop
|
||||
(
|
||||
input d,
|
||||
input clk,
|
||||
output logic q);
|
||||
|
||||
// verilator no_inline_module
|
||||
|
||||
always_ff @ (posedge clk) begin
|
||||
q <= d;
|
||||
end
|
||||
endmodule
|
3
test_regress/t/t_param_scope_bad.out
Normal file
3
test_regress/t/t_param_scope_bad.out
Normal file
@ -0,0 +1,3 @@
|
||||
%Warning-CASEOVERLAP: t/t_param_scope_bad.v:27: Case values overlap (example pattern 0x2)
|
||||
%Warning-CASEOVERLAP: Use "/* verilator lint_off CASEOVERLAP */" and lint_on around source to disable this message.
|
||||
%Error: Exiting due to
|
19
test_regress/t/t_param_scope_bad.pl
Executable file
19
test_regress/t/t_param_scope_bad.pl
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003-2009 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);
|
||||
|
||||
compile(
|
||||
v_flags2 => ["--lint-only"],
|
||||
fails => 1,
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
31
test_regress/t/t_param_scope_bad.v
Normal file
31
test_regress/t/t_param_scope_bad.v
Normal file
@ -0,0 +1,31 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2019 by Wilson Snyder.
|
||||
|
||||
module t (/*AUTOARG*/
|
||||
// Inputs
|
||||
value
|
||||
);
|
||||
input [1:0] value;
|
||||
|
||||
sub #(.CASEVAL(2'h0)) p0 (.value);
|
||||
sub #(.CASEVAL(2'h1)) p1 (.value);
|
||||
sub #(.CASEVAL(2'h2)) p2 (.value);
|
||||
sub #(.CASEVAL(2'h3)) p3 (.value);
|
||||
|
||||
endmodule
|
||||
|
||||
module sub
|
||||
(
|
||||
input [1:0] value);
|
||||
|
||||
parameter [1:0] CASEVAL = 2'h0;
|
||||
always_comb begin
|
||||
case (value)
|
||||
CASEVAL: ;
|
||||
2'h2: $stop;
|
||||
default: ;
|
||||
endcase
|
||||
end
|
||||
endmodule
|
Loading…
Reference in New Issue
Block a user