aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test/resources/blackboxes/AdderExtModule.v8
-rw-r--r--src/test/resources/blackboxes/MultiExtModuleTester.fir36
-rw-r--r--src/test/resources/blackboxes/SimpleExtModule.v8
-rw-r--r--src/test/resources/blackboxes/SimpleExtModuleTester.fir20
-rw-r--r--src/test/scala/firrtlTests/ExtModuleSpec.scala34
5 files changed, 106 insertions, 0 deletions
diff --git a/src/test/resources/blackboxes/AdderExtModule.v b/src/test/resources/blackboxes/AdderExtModule.v
new file mode 100644
index 00000000..1841814e
--- /dev/null
+++ b/src/test/resources/blackboxes/AdderExtModule.v
@@ -0,0 +1,8 @@
+
+module AdderExtModule(
+ input [15:0] foo,
+ output [15:0] bar
+);
+ assign bar = foo + 1;
+endmodule
+
diff --git a/src/test/resources/blackboxes/MultiExtModuleTester.fir b/src/test/resources/blackboxes/MultiExtModuleTester.fir
new file mode 100644
index 00000000..7c1adab2
--- /dev/null
+++ b/src/test/resources/blackboxes/MultiExtModuleTester.fir
@@ -0,0 +1,36 @@
+circuit MultiExtModuleTester :
+ extmodule SimpleExtModule :
+ input foo : UInt<16>
+ output bar : UInt<16>
+
+ extmodule AdderExtModule :
+ input foo : UInt<16>
+ output bar : UInt<16>
+
+ module MultiExtModuleTester :
+ input clk : Clock
+ input reset : UInt<1>
+
+ inst dut1 of SimpleExtModule
+ inst dut2 of SimpleExtModule
+ inst dut3 of AdderExtModule
+
+ dut1.foo <= UInt(1234)
+ dut2.foo <= UInt(5678)
+ dut3.foo <= UInt(100)
+
+ when not(reset) :
+ when neq(dut1.bar, UInt(1234)) :
+ printf(clk, not(reset), "Assertion failed\nTest Failed!\n")
+ stop(clk, not(reset), 1)
+ else :
+ when neq(dut2.bar, UInt(5678)) :
+ printf(clk, not(reset), "Assertion failed\nTest Failed!\n")
+ stop(clk, not(reset), 1)
+ else :
+ when neq(dut3.bar, UInt(101)) :
+ printf(clk, not(reset), "Assertion failed\nTest Failed!\n")
+ stop(clk, not(reset), 1)
+ else :
+ stop(clk, not(reset), 0)
+
diff --git a/src/test/resources/blackboxes/SimpleExtModule.v b/src/test/resources/blackboxes/SimpleExtModule.v
new file mode 100644
index 00000000..03a9db44
--- /dev/null
+++ b/src/test/resources/blackboxes/SimpleExtModule.v
@@ -0,0 +1,8 @@
+
+module SimpleExtModule(
+ input [15:0] foo,
+ output [15:0] bar
+);
+ assign bar = foo;
+endmodule
+
diff --git a/src/test/resources/blackboxes/SimpleExtModuleTester.fir b/src/test/resources/blackboxes/SimpleExtModuleTester.fir
new file mode 100644
index 00000000..4d99bff2
--- /dev/null
+++ b/src/test/resources/blackboxes/SimpleExtModuleTester.fir
@@ -0,0 +1,20 @@
+circuit SimpleExtModuleTester :
+ extmodule SimpleExtModule :
+ input foo : UInt<16>
+ output bar : UInt<16>
+
+ module SimpleExtModuleTester :
+ input clk : Clock
+ input reset : UInt<1>
+
+ inst dut of SimpleExtModule
+
+ dut.foo <= UInt(1234)
+
+ when not(reset) :
+ when neq(dut.bar, UInt(1234)) :
+ printf(clk, not(reset), "Assertion failed\nTest Failed!\n")
+ stop(clk, not(reset), 1)
+ else :
+ stop(clk, not(reset), 0)
+
diff --git a/src/test/scala/firrtlTests/ExtModuleSpec.scala b/src/test/scala/firrtlTests/ExtModuleSpec.scala
new file mode 100644
index 00000000..ba36e5f2
--- /dev/null
+++ b/src/test/scala/firrtlTests/ExtModuleSpec.scala
@@ -0,0 +1,34 @@
+/*
+Copyright (c) 2014 - 2016 The Regents of the University of
+California (Regents). All Rights Reserved. Redistribution and use in
+source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+ * Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the following
+ two paragraphs of disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ two paragraphs of disclaimer in the documentation and/or other materials
+ provided with the distribution.
+ * Neither the name of the Regents nor the names of its contributors
+ may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF
+ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION
+TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+MODIFICATIONS.
+*/
+
+package firrtlTests
+
+class SimpleExtModuleExecutionTest extends ExecutionTest("SimpleExtModuleTester", "/blackboxes",
+ Seq("SimpleExtModule"))
+class MultiExtModuleExecutionTest extends ExecutionTest("MultiExtModuleTester", "/blackboxes",
+ Seq("SimpleExtModule", "AdderExtModule"))
+