Merge pull request #918 from larsclausen/fix-single-element-array-ports
Fix connecting single element array ports
This commit is contained in:
commit
9cb3d53633
|
|
@ -1538,7 +1538,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
|
||||||
// array, then there should be no sub-ports and
|
// array, then there should be no sub-ports and
|
||||||
// the r-value expression is processed
|
// the r-value expression is processed
|
||||||
// differently.
|
// differently.
|
||||||
if (prts.size() >= 1 && prts[0]->pin_count()>1) {
|
if (prts.size() >= 1 && prts[0]->unpacked_dimensions() > 0) {
|
||||||
ivl_assert(*this, prts.size()==1);
|
ivl_assert(*this, prts.size()==1);
|
||||||
elaborate_unpacked_port(des, scope, prts[0], pins[idx],
|
elaborate_unpacked_port(des, scope, prts[0], pins[idx],
|
||||||
ptype, rmod, idx);
|
ptype, rmod, idx);
|
||||||
|
|
@ -1703,7 +1703,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
|
||||||
// differently. Note that we are calling it the
|
// differently. Note that we are calling it the
|
||||||
// "r-value" expression, but since this is an
|
// "r-value" expression, but since this is an
|
||||||
// output port, we assign to it from the internal object.
|
// output port, we assign to it from the internal object.
|
||||||
if (prts[0]->pin_count() > 1) {
|
if (prts[0]->unpacked_dimensions() > 0) {
|
||||||
elaborate_unpacked_port(des, scope, prts[0], pins[idx],
|
elaborate_unpacked_port(des, scope, prts[0], pins[idx],
|
||||||
ptype, rmod, idx);
|
ptype, rmod, idx);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
// Check that connecting a module port array with a single element is supported
|
||||||
|
|
||||||
|
module M (
|
||||||
|
input [7:0] in[0:0],
|
||||||
|
output [7:0] out[0:0]
|
||||||
|
);
|
||||||
|
|
||||||
|
assign out[0] = in[0];
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module test;
|
||||||
|
|
||||||
|
reg [7:0] A[0:0];
|
||||||
|
wire [7:0] B[0:0];
|
||||||
|
|
||||||
|
M i_m (
|
||||||
|
.in(A),
|
||||||
|
.out(B)
|
||||||
|
);
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
A[0] = 10;
|
||||||
|
#1
|
||||||
|
if (B[0] === 10) begin
|
||||||
|
$display("PASSED");
|
||||||
|
end else begin
|
||||||
|
$display("FAILED");
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
|
@ -26,6 +26,7 @@ dumpfile vvp_tests/dumpfile.json
|
||||||
final3 vvp_tests/final3.json
|
final3 vvp_tests/final3.json
|
||||||
macro_str_esc vvp_tests/macro_str_esc.json
|
macro_str_esc vvp_tests/macro_str_esc.json
|
||||||
memsynth1 vvp_tests/memsynth1.json
|
memsynth1 vvp_tests/memsynth1.json
|
||||||
|
module_port_array1 vvp_tests/module_port_array1.json
|
||||||
param-width vvp_tests/param-width.json
|
param-width vvp_tests/param-width.json
|
||||||
param-width-vlog95 vvp_tests/param-width-vlog95.json
|
param-width-vlog95 vvp_tests/param-width-vlog95.json
|
||||||
pr1388974 vvp_tests/pr1388974.json
|
pr1388974 vvp_tests/pr1388974.json
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"type" : "normal",
|
||||||
|
"source" : "module_port_array1.v",
|
||||||
|
"iverilog-args" : [ "-g2009" ]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue