diff options
| author | azidar | 2015-08-17 15:11:01 -0700 |
|---|---|---|
| committer | azidar | 2015-08-17 15:11:01 -0700 |
| commit | 934c9953718dea1c12d8517ee5526cdbe5035a5e (patch) | |
| tree | d675b29f7ba80b97f5f98e1d9831d8cdcaf443f3 | |
| parent | 13c6ff8f7a91ddaaf1cddf17dc090eff9664e811 (diff) | |
Removed leading zeros from UInt constants
| -rw-r--r-- | src/main/stanza/bigint.stanza | 3 | ||||
| -rw-r--r-- | test/features/BigInt.fir | 10 |
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! |
