aboutsummaryrefslogtreecommitdiff
path: root/src/main/stanza/ir-utils.stanza
diff options
context:
space:
mode:
authorazidar2016-01-07 17:15:31 -0800
committerazidar2016-01-16 14:28:18 -0800
commit4569194392122ae4715549b2f0b9fffff051b278 (patch)
treeecd079cefa6fb69d1f8c75bc0e75e38599bc0da4 /src/main/stanza/ir-utils.stanza
parent2d583abda146dad8e0260928dcb19ad7136216b6 (diff)
Fixed a bunch of tests, and minor bugs
Diffstat (limited to 'src/main/stanza/ir-utils.stanza')
-rw-r--r--src/main/stanza/ir-utils.stanza13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/stanza/ir-utils.stanza b/src/main/stanza/ir-utils.stanza
index 4581fe30..a2af082b 100644
--- a/src/main/stanza/ir-utils.stanza
+++ b/src/main/stanza/ir-utils.stanza
@@ -136,6 +136,17 @@ public defn exp-hash (e:Expression) -> Int :
val i = symbol-hash(to-symbol(to-string(e)))
turn-on-debug(false)
i
+
+;============= Useful functions ==============
+public defn create-mask (n:Symbol,dt:Type) -> Field :
+ Field{n,DEFAULT,_} $ match(dt) :
+ (t:VectorType) : VectorType(BoolType(),size(t))
+ (t:BundleType) :
+ val fields* = for f in fields(t) map :
+ Field(name(f),flip(f),BoolType())
+ BundleType(fields*)
+ (t:UIntType|SIntType) : BoolType()
+
;============== Exceptions =====================
public definterface PassException <: Exception
@@ -334,7 +345,7 @@ defmethod print (o:OutputStream, c:Stmt) :
else :
print-all(o, ["cmem " name(c) " : " type(c) "[" size(c) "]"])
(c:CDefMPort) :
- print-all(o, [direction(c) " mport " name(c) " = " mem(c) "[" index(c) "], " clk(c)])
+ print-all(o, [direction(c) " mport " name(c) " = " mem(c) "[" exps(c)[0] "], " exps(c)[1]])
if not c typeof Conditionally|Begin|Empty: print-debug(o,c)