aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorazidar2015-08-17 15:11:01 -0700
committerazidar2015-08-17 15:11:01 -0700
commit934c9953718dea1c12d8517ee5526cdbe5035a5e (patch)
treed675b29f7ba80b97f5f98e1d9831d8cdcaf443f3
parent13c6ff8f7a91ddaaf1cddf17dc090eff9664e811 (diff)
Removed leading zeros from UInt constants
-rw-r--r--src/main/stanza/bigint.stanza3
-rw-r--r--test/features/BigInt.fir10
2 files changed, 12 insertions, 1 deletions
diff --git a/src/main/stanza/bigint.stanza b/src/main/stanza/bigint.stanza
index ad4a5bde..bc13bdbf 100644
--- a/src/main/stanza/bigint.stanza
+++ b/src/main/stanza/bigint.stanza
@@ -39,7 +39,8 @@ public defn BigInt (len: Int) :
;println(digit)
val hex = as-hex(digit)
;println(hex)
- str = string-join([str hex])
+ if str == "h" and hex == "0" and (i + 4 < len) : false
+ else : str = string-join([str hex])
string-join([ "\"" str "\""])
defmethod to-bin (this) -> String :
string-join $
diff --git a/test/features/BigInt.fir b/test/features/BigInt.fir
new file mode 100644
index 00000000..225f1d8b
--- /dev/null
+++ b/test/features/BigInt.fir
@@ -0,0 +1,10 @@
+; RUN: firrtl -i %s -o %s.v -X verilog -p c 2>&1 | tee %s.out | FileCheck %s
+circuit Top :
+ module Top :
+ node x = UInt("h2")
+ node y = UInt("h100000")
+ node z = UInt("h00")
+
+;CHECK: node x = UInt("h2")
+;CHECK: node z = UInt("h0")
+;CHECK: Done!