aboutsummaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorAlbert Magyar2020-02-12 22:21:44 -0800
committerAlbert Magyar2020-02-13 09:25:53 -0800
commit555d1e4397f9e750b186f4c07ef3172b7ee39c0d (patch)
tree8b1d307fe1db309fd39f603157c8798b6b584315 /regress
parent6e94ecb8b5da29e3a07d0117d27bb5fa58271678 (diff)
Add Ops equiv check to stress degenerate binary op ConstProp
* Send in the Yosys
Diffstat (limited to 'regress')
-rw-r--r--regress/Ops.fir54
1 files changed, 54 insertions, 0 deletions
diff --git a/regress/Ops.fir b/regress/Ops.fir
new file mode 100644
index 00000000..51cffad5
--- /dev/null
+++ b/regress/Ops.fir
@@ -0,0 +1,54 @@
+circuit Ops:
+ module Ops:
+ input sel: UInt<4>
+ input is: SInt<8>
+ input iu: UInt<8>
+ output os: SInt<14>
+ output ou: UInt<13>
+ output obool: UInt<1>
+
+ os <= SInt(0)
+ ou <= UInt(0)
+ obool <= UInt(0)
+
+ when eq(sel, UInt(0)):
+ os <= add(is, is)
+ ou <= add(iu, iu)
+ else:
+ when eq(sel, UInt(1)):
+ os <= sub(is, is)
+ ou <= sub(iu, iu)
+ else:
+ when eq(sel, UInt(2)):
+ os <= mux(eq(is, SInt(0)), SInt(1), div(is, is))
+ ou <= mux(eq(iu, UInt(0)), UInt(1), div(iu, iu))
+ else:
+ when eq(sel, UInt(3)):
+ os <= rem(is, is)
+ ou <= rem(iu, iu)
+ else:
+ when eq(sel, UInt(4)):
+ ou <= add(and(is, is), and(iu, iu))
+ else:
+ when eq(sel, UInt(5)):
+ ou <= add(or(is, is), or(iu, iu))
+ else:
+ when eq(sel, UInt(4)):
+ ou <= add(xor(is, is), xor(iu, iu))
+ else:
+ when eq(sel, UInt(5)):
+ ou <= add(eq(is, is), eq(iu, iu))
+ else:
+ when eq(sel, UInt(4)):
+ ou <= add(neq(is, is), neq(iu, iu))
+ else:
+ when eq(sel, UInt(5)):
+ ou <= add(geq(is, is), geq(iu, iu))
+ else:
+ when eq(sel, UInt(4)):
+ ou <= add(leq(is, is), leq(iu, iu))
+ else:
+ when eq(sel, UInt(5)):
+ ou <= add(gt(is, is), gt(iu, iu))
+ else:
+ ou <= add(lt(is, is), lt(iu, iu))