aboutsummaryrefslogtreecommitdiffstats
path: root/tests/svinterfaces/load_and_derive.sv
diff options
context:
space:
mode:
authorRupert Swarbrick <rswarbrick@gmail.com>2021-07-14 17:27:13 +0100
committerZachary Snow <zachary.j.snow@gmail.com>2021-07-14 22:54:50 -0400
commit1aab608cffa19332dc5cf722def7413b16f5ee54 (patch)
tree8322d8c3232069dd5d11d5f4f43b3aa863a12e56 /tests/svinterfaces/load_and_derive.sv
parent7d50b8332204d79fac531134f29a0ab3d5bde04c (diff)
downloadyosys-1aab608cffa19332dc5cf722def7413b16f5ee54.tar.gz
yosys-1aab608cffa19332dc5cf722def7413b16f5ee54.tar.bz2
yosys-1aab608cffa19332dc5cf722def7413b16f5ee54.zip
Add a test for interfaces on modules loaded on-demand
Diffstat (limited to 'tests/svinterfaces/load_and_derive.sv')
-rw-r--r--tests/svinterfaces/load_and_derive.sv20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/svinterfaces/load_and_derive.sv b/tests/svinterfaces/load_and_derive.sv
new file mode 100644
index 000000000..0de0de3b3
--- /dev/null
+++ b/tests/svinterfaces/load_and_derive.sv
@@ -0,0 +1,20 @@
+// This test checks that we correctly elaborate interfaces in modules, even if they are loaded on
+// demand. The "ondemand" module is defined in ondemand.sv in this directory and will be read as
+// part of the hierarchy pass.
+
+interface iface;
+ logic [7:0] x;
+ logic [7:0] y;
+endinterface
+
+module dut (input logic [7:0] x, output logic [7:0] y);
+ iface intf();
+ assign intf.x = x;
+ assign y = intf.y;
+
+ ondemand u(.intf);
+endmodule
+
+module ref (input logic [7:0] x, output logic [7:0] y);
+ assign y = ~x;
+endmodule