From 934c9953718dea1c12d8517ee5526cdbe5035a5e Mon Sep 17 00:00:00 2001 From: azidar Date: Mon, 17 Aug 2015 15:11:01 -0700 Subject: Removed leading zeros from UInt constants --- src/main/stanza/bigint.stanza | 3 ++- test/features/BigInt.fir | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/features/BigInt.fir 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! -- cgit v1.2.3