aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ecp5/common.v
diff options
context:
space:
mode:
authorSergeyDegtyar <sndegtyar@gmail.com>2019-08-28 09:47:03 +0300
committerSergeyDegtyar <sndegtyar@gmail.com>2019-08-28 09:47:03 +0300
commit2270ead09fb4695442c66fe5c06445235f390f2b (patch)
tree31d55d4e9a9b8af8ca515777af28df492e86f2af /tests/ecp5/common.v
parent980830f7b82f2a974f43580f61e917f99fbb4e7e (diff)
downloadyosys-2270ead09fb4695442c66fe5c06445235f390f2b.tar.gz
yosys-2270ead09fb4695442c66fe5c06445235f390f2b.tar.bz2
yosys-2270ead09fb4695442c66fe5c06445235f390f2b.zip
Add tests for ecp5
Diffstat (limited to 'tests/ecp5/common.v')
-rw-r--r--tests/ecp5/common.v47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/ecp5/common.v b/tests/ecp5/common.v
new file mode 100644
index 000000000..5446f0817
--- /dev/null
+++ b/tests/ecp5/common.v
@@ -0,0 +1,47 @@
+module assert_dff(input clk, input test, input pat);
+ always @(posedge clk)
+ begin
+ #1;
+ if (test != pat)
+ begin
+ $display("ERROR: ASSERTION FAILED in %m:",$time);
+ $stop;
+ end
+ end
+endmodule
+
+module assert_tri(input en, input A, input B);
+ always @(posedge en)
+ begin
+ #1;
+ if (A !== B)
+ begin
+ $display("ERROR: ASSERTION FAILED in %m:",$time," ",A," ",B);
+ $stop;
+ end
+ end
+endmodule
+
+module assert_Z(input clk, input A);
+ always @(posedge clk)
+ begin
+ #1;
+ if (A === 1'bZ)
+ begin
+ $display("ERROR: ASSERTION FAILED in %m:",$time," ",A);
+ $stop;
+ end
+ end
+endmodule
+
+module assert_comb(input A, input B);
+ always @(*)
+ begin
+ #1;
+ if (A !== B)
+ begin
+ $display("ERROR: ASSERTION FAILED in %m:",$time," ",A," ",B);
+ $stop;
+ end
+ end
+endmodule