From d0cdd3b4c3713bb7454868fac7fa9c43bae2332c Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Fri, 1 Jun 2018 12:16:11 -0700 Subject: Literals set their ref so they no longer get named (#826) Fixes #763 Add tests for #763 and #472 This has a few implications * Constructing a literal no longer increments _T_ suffixes * Internally, wrapping a literal Bits in Node(...) will work * Literal Bools work in withReset/withClockAndReset--- chiselFrontend/src/main/scala/chisel3/core/Bits.scala | 3 +++ 1 file changed, 3 insertions(+) (limited to 'chiselFrontend') diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala index b3091db3..dd99d822 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala @@ -67,6 +67,9 @@ sealed abstract class Bits(width: Width, override val litArg: Option[LitArg]) // Arguments for: self-checking code (can't do arithmetic on bits) // Arguments against: generates down to a FIRRTL UInt anyways + // If this is a literal, setRef so that we don't allocate a name + litArg.foreach(setRef) + // Only used for in a few cases, hopefully to be removed private[core] def cloneTypeWidth(width: Width): this.type -- cgit v1.2.3