A repeat concatenation cannot be used as a net l-value
This commit is contained in:
parent
5e7e7622b4
commit
00fcd58fab
|
|
@ -52,8 +52,10 @@ NetNet* PEConcat::elaborate_lnet_common_(Design*des, NetScope*scope,
|
|||
unsigned errors = 0;
|
||||
|
||||
if (repeat_) {
|
||||
cerr << get_fileline() << ": sorry: I do not know how to"
|
||||
" elaborate repeat concatenation nets." << endl;
|
||||
cerr << repeat_->get_fileline() << ": error: "
|
||||
<< "repeat concatenations are not allowed in net l-values."
|
||||
<< endl;
|
||||
des->errors += 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
./ivltests/br_gh1178a.v:12: error: repeat concatenations are not allowed in net l-values.
|
||||
./ivltests/br_gh1178a.v:12: error: Inout port expression must support continuous assignment.
|
||||
./ivltests/br_gh1178a.v:12: : Port 2 (w) of net_connect is connected to {'sd2{bus}}
|
||||
2 error(s) during elaboration.
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
module net_connect #(parameter WIDTH=1) (w, w);
|
||||
inout wire[WIDTH-1:0] w;
|
||||
endmodule
|
||||
|
||||
|
||||
module ReplicateMod (
|
||||
inout wire [3:0] bus,
|
||||
inout wire [7:0] replicated
|
||||
);
|
||||
// It is illegal to connect a replication to an output or inout port.
|
||||
net_connect #(.WIDTH(8)) net_connect (replicated, ({2{bus}}));
|
||||
endmodule
|
||||
|
||||
|
||||
module tb;
|
||||
logic [3:0] bus;
|
||||
wire [7:0] replicated;
|
||||
wire [3:0] wire__bus = bus;
|
||||
ReplicateMod dut(.bus(wire__bus), .replicated(replicated));
|
||||
initial $display("FAILED: this should be a compilation error.");
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
module net_connect #(parameter WIDTH=1) (w, w);
|
||||
inout wire[WIDTH-1:0] w;
|
||||
endmodule
|
||||
|
||||
|
||||
module ReplicateMod (
|
||||
inout wire [3:0] bus,
|
||||
inout wire [7:0] replicated
|
||||
);
|
||||
net_connect #(.WIDTH(8)) net_connect (replicated, ({bus, bus}));
|
||||
endmodule
|
||||
|
||||
|
||||
module tb;
|
||||
logic passed;
|
||||
logic [3:0] bus;
|
||||
wire [7:0] replicated;
|
||||
wire [3:0] wire__bus = bus;
|
||||
|
||||
ReplicateMod dut(.bus(wire__bus), .replicated(replicated));
|
||||
|
||||
initial begin
|
||||
passed = 1'b1;
|
||||
bus = 4'h3;
|
||||
#1
|
||||
if(replicated !== 8'h33) begin
|
||||
passed = 1'b0;
|
||||
$display("FAILED: Expected 'h33, but found 'h%x with inputs 'h%x", replicated, bus);
|
||||
end
|
||||
#1
|
||||
bus = 4'hc;
|
||||
#1
|
||||
if(replicated !== 8'hcc) begin
|
||||
passed = 1'b0;
|
||||
$display("FAILED: Expected 'hcc, but found 'h%x with inputs 'h%x", replicated, bus);
|
||||
end
|
||||
#1
|
||||
if (passed) $display("PASSED");
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
module net_connect #(parameter WIDTH=1) (wo, w);
|
||||
output wire[WIDTH-1:0] wo;
|
||||
input wire[WIDTH-1:0] w;
|
||||
assign wo = w;
|
||||
endmodule
|
||||
|
||||
|
||||
module ReplicateMod (
|
||||
input wire [3:0] bus,
|
||||
output wire [7:0] replicated
|
||||
);
|
||||
net_connect #(.WIDTH(8)) net_connect (replicated, ({2{bus}}));
|
||||
endmodule
|
||||
|
||||
|
||||
module tb;
|
||||
logic passed;
|
||||
logic [3:0] bus;
|
||||
wire [7:0] replicated;
|
||||
wire [3:0] wire__bus = bus;
|
||||
|
||||
ReplicateMod dut(.bus(wire__bus), .replicated(replicated));
|
||||
|
||||
initial begin
|
||||
passed = 1'b1;
|
||||
bus = 4'h3;
|
||||
#1
|
||||
if(replicated !== 8'h33) begin
|
||||
passed = 1'b0;
|
||||
$display("FAILED: Expected 'h33, but found 'h%x with inputs 'h%x", replicated, bus);
|
||||
end
|
||||
#1
|
||||
bus = 4'hc;
|
||||
#1
|
||||
if(replicated !== 8'hcc) begin
|
||||
passed = 1'b0;
|
||||
$display("FAILED: Expected 'hcc, but found 'h%x with inputs 'h%x", replicated, bus);
|
||||
end
|
||||
#1
|
||||
if (passed) $display("PASSED");
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -353,6 +353,9 @@ br_gh788 normal,-gno-io-range-error,-Wno-anachronisms ivltests gold=br_gh788.go
|
|||
br_gh793 normal ivltests
|
||||
br_gh827 normal ivltests gold=br_gh827.gold
|
||||
br_gh889 normal,-gspecify ivltests gold=br_gh889.gold
|
||||
br_gh1178a CE ivltests gold=br_gh1178a.gold
|
||||
br_gh1178b normal ivltests
|
||||
br_gh1178c normal ivltests
|
||||
br_ml20150315 normal ivltests gold=br_ml_20150315.gold
|
||||
br_ml20150321 CE ivltests
|
||||
br_mw20171108 normal ivltests
|
||||
|
|
|
|||
Loading…
Reference in New Issue