aboutsummaryrefslogtreecommitdiff
path: root/src/main/stanza/ir-utils.stanza
diff options
context:
space:
mode:
authorazidar2015-06-02 15:35:02 -0700
committerazidar2015-06-02 15:35:02 -0700
commiteb5ca3c967c929c8331fd17e04dbd9402e41e986 (patch)
tree8bd5b7e62b54376cbc6fc9a8b145a7e345d90b16 /src/main/stanza/ir-utils.stanza
parent13228ed1bf546ad351ecb82ee094eb71e3fe4749 (diff)
Changed Core.fir so dshl wasn't huge. Fixed padding pass to preserve correct low-firrtl syntax. Generates verilog that compiles, but is not correct
Diffstat (limited to 'src/main/stanza/ir-utils.stanza')
-rw-r--r--src/main/stanza/ir-utils.stanza13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/stanza/ir-utils.stanza b/src/main/stanza/ir-utils.stanza
index 1d209622..8b198c64 100644
--- a/src/main/stanza/ir-utils.stanza
+++ b/src/main/stanza/ir-utils.stanza
@@ -445,11 +445,12 @@ public defn merge!<?K,?V> (a:HashTable<?K,?V>, b:HashTable<K,V>) :
a[key(e)] = value(e)
public defn pow (x:Int,y:Int) -> Int :
- var x* = 1
- var y* = y
- while y* != 0 :
- x* = x* * x
- y* = y* - 1
- x*
+ var x* = to-long(1)
+ var y* = to-long(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*)