Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Conversion/ImportVerilog/Structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ struct ModuleVisitor : public BaseVisitor {
outputValues.push_back(val);
} else {
// For input ports, if the value is a ref (from VariableOp/NetOp),
// read it to get the rvalue.
if (isa<moore::RefType>(val.getType()))
// read it to get the rvalue, unless the port itself expects a ref.
if (isa<moore::RefType>(val.getType()) && !isa<moore::RefType>(fp.type))
val = moore::ReadOp::create(builder, loc, val);
inputValues.push_back(val);
}
Expand Down
23 changes: 22 additions & 1 deletion test/Conversion/ImportVerilog/basic.sv
Original file line number Diff line number Diff line change
Expand Up @@ -4789,4 +4789,25 @@ module TopTwoPorts;
IfaceModport i1();
IfaceModport i2();
TwoPortsSameType dut(.a(i1), .b(i2));
endmodule
endmodule

// The test from sv-test
interface test_bus;
logic test_pad;
endinterface: test_bus

// CHECK-LABEL: moore.module private @sub(in %iface_test_pad : !moore.ref<l1>) {
// CHECK: moore.output
// CHECK: }
module sub(test_bus iface);
endmodule

// CHECK-LABEL: moore.module @top() {
// CHECK: %iface_test_pad = moore.variable : <l1>
// CHECK: moore.instance "sub" @sub(iface_test_pad: %iface_test_pad: !moore.ref<l1>) -> ()
// CHECK: moore.output
// CHECK: }
module top;
test_bus iface();
sub sub (.iface);
endmodule
Loading