aboutsummaryrefslogtreecommitdiff
path: root/src/main/stanza/ir-utils.stanza
diff options
context:
space:
mode:
authorAdam Izraelevitz2015-07-17 16:49:22 -0700
committerAdam Izraelevitz2015-07-17 16:49:22 -0700
commit70567d4d57ac178660fbef0ef660069b52857562 (patch)
treeac0ed0127ddb99a72cbc760f6be97b99c574d018 /src/main/stanza/ir-utils.stanza
parent98bb81d9d99150a80c77ed8f22d44748a02df628 (diff)
Datapath compiles with Chisel 2.0 -> FIRRTL -> Verilog!
Had to separate initialization check pass Need to write dead code elimination pass Added LongWidth to support dshl that are huge
Diffstat (limited to 'src/main/stanza/ir-utils.stanza')
-rw-r--r--src/main/stanza/ir-utils.stanza12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/stanza/ir-utils.stanza b/src/main/stanza/ir-utils.stanza
index bd8a0fd6..9a983cff 100644
--- a/src/main/stanza/ir-utils.stanza
+++ b/src/main/stanza/ir-utils.stanza
@@ -117,6 +117,7 @@ defmethod print (o:OutputStream, w:Width) :
match(w) :
(w:UnknownWidth) : "?"
(w:IntWidth) : width(w)
+ (w:LongWidth) : width(w)
defmethod print (o:OutputStream, op:PrimOp) :
print{o, _} $
@@ -451,13 +452,12 @@ public defn merge!<?K,?V> (a:HashTable<?K,?V>, b:HashTable<K,V>) :
for e in b do :
a[key(e)] = value(e)
-public defn pow (x:Int,y:Int) -> Int :
+public defn pow (x:Long,y:Long) -> Long :
var x* = to-long(1)
- var y* = to-long(y)
+ var y* = y
while y* != to-long(0) :
- x* = x* * to-long(x)
- y* = y* - to-long(1)
- if x* > to-long(2147483647) : error("Value too big for Int")
- else : to-int $ to-string(x*)
+ x* = times(x*,x)
+ y* = minus(y*,to-long(1))
+ x*