forked from github/verilator
Add error on real to non-real output pins (#2690).
This commit is contained in:
parent
5898c22b3b
commit
82fc142c1c
2
Changes
2
Changes
@ -13,6 +13,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
|
||||
|
||||
**** Report UNUSED on parameters, localparam and genvars (#2627). [Charles Eric LaForest]
|
||||
|
||||
**** Add error on real to non-real output pins (#2690). [Peter Monsson]
|
||||
|
||||
**** Fix passing parameter type instantiations by position number.
|
||||
|
||||
**** Fix DPI open array handling issues.
|
||||
|
@ -4183,6 +4183,8 @@ private:
|
||||
<< conDTypep->prettyDTypeNameQ() << " data type.");
|
||||
} else if (nodep->modVarp()->isTristate()) {
|
||||
if (pinwidth != conwidth) {
|
||||
// Ideally should call pinReconnectSimple which would tolerate this
|
||||
// then have a conversion warning
|
||||
nodep->v3warn(E_UNSUPPORTED,
|
||||
"Unsupported: " << ucfirst(nodep->prettyOperatorName())
|
||||
<< " to inout signal requires " << pinwidth
|
||||
@ -4191,7 +4193,14 @@ private:
|
||||
<< " generates " << conwidth << " bits.");
|
||||
// otherwise would need some mess to force both sides to proper size
|
||||
}
|
||||
} else if (nodep->modVarp()->direction().isWritable()
|
||||
&& ((conDTypep->isDouble() && !modDTypep->isDouble())
|
||||
|| (!conDTypep->isDouble() && modDTypep->isDouble()))) {
|
||||
nodep->v3warn(E_UNSUPPORTED,
|
||||
"Unsupported: " << ucfirst(nodep->prettyOperatorName())
|
||||
<< " connects real to non-real");
|
||||
}
|
||||
|
||||
// Check if an interface is connected to a non-interface and vice versa
|
||||
if ((VN_IS(modDTypep, IfaceRefDType) && !VN_IS(conDTypep, IfaceRefDType))
|
||||
|| (VN_IS(conDTypep, IfaceRefDType) && !VN_IS(modDTypep, IfaceRefDType))) {
|
||||
|
5
test_regress/t/t_inst_pin_realnreal.out
Executable file
5
test_regress/t/t_inst_pin_realnreal.out
Executable file
@ -0,0 +1,5 @@
|
||||
%Error-UNSUPPORTED: t/t_inst_pin_realnreal.v:51:32: Unsupported: Output port connection 'out' connects real to non-real
|
||||
: ... In instance t.netlist
|
||||
51 | pga_model pga0(.in, .gain, .out(pga_out));
|
||||
| ^~~
|
||||
%Error: Exiting due to
|
23
test_regress/t/t_inst_pin_realnreal.pl
Executable file
23
test_regress/t/t_inst_pin_realnreal.pl
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env 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.
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
scenarios(simulator => 1);
|
||||
|
||||
compile(
|
||||
fails => $Self->{vlt_all},
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
|
||||
execute(
|
||||
check_finished => 1,
|
||||
) if !$Self->{vlt_all};
|
||||
|
||||
ok(1);
|
||||
1;
|
76
test_regress/t/t_inst_pin_realnreal.v
Normal file
76
test_regress/t/t_inst_pin_realnreal.v
Normal file
@ -0,0 +1,76 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2020 by Peter Monsson.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
module t (/*AUTOARG*/
|
||||
// Inputs
|
||||
clk
|
||||
);
|
||||
|
||||
input clk;
|
||||
integer cyc; initial cyc=1;
|
||||
|
||||
wire gain = 1'b0;
|
||||
real in;
|
||||
always_comb in = (cyc-4) * 1.0;
|
||||
wire cmp;
|
||||
|
||||
adc_netlist netlist(.clk, .in, .gain, .cmp);
|
||||
|
||||
always @ (posedge clk) begin
|
||||
if (cyc!=0) begin
|
||||
cyc <= cyc + 1;
|
||||
$display("cyc=%0d cmp=%d", cyc, cmp);
|
||||
if (cyc == 3) begin
|
||||
if (cmp != 0) $stop;
|
||||
end
|
||||
else if (cyc == 4) begin
|
||||
if (cmp != 1) $stop;
|
||||
end
|
||||
else if (cyc == 5) begin
|
||||
if (cmp != 0) $stop;
|
||||
end
|
||||
else if (cyc == 10) begin
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
module adc_netlist(clk, in, gain, cmp);
|
||||
input clk;
|
||||
input real in;
|
||||
input gain;
|
||||
output cmp;
|
||||
|
||||
wire pga_out; //TODO: convert to real or support real
|
||||
pga_model pga0(.in, .gain, .out(pga_out));
|
||||
comparator_model cmp0(.clk, .in(pga_out), .cmp);
|
||||
|
||||
endmodule
|
||||
|
||||
module pga_model(in, gain, out);
|
||||
input real in;
|
||||
input gain;
|
||||
output real out;
|
||||
|
||||
always_comb begin
|
||||
out = in * 3.0;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
module comparator_model(clk, in, cmp);
|
||||
input clk;
|
||||
input real in;
|
||||
output logic cmp;
|
||||
|
||||
always_ff @(posedge clk) begin
|
||||
cmp <= in > 0.0;
|
||||
end
|
||||
|
||||
endmodule
|
Loading…
Reference in New Issue
Block a user