From 52e86c95b1819b57caca8bdd4e20ac09b4065d05 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 17 Jan 2019 13:55:25 -0800 Subject: [PATCH 1/5] Fix scaladoc for UInt.unary_! It performs the operation (x === 0.U), just like in C. The scaladoc incorrectly described it as performing the operation !x(0). (Obviously, these are equivalent for Bool, but not for UInt in general). --- chiselFrontend/src/main/scala/chisel3/core/Bits.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala index cf015e60700..bf1f7f63f89 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala @@ -852,7 +852,7 @@ sealed class UInt private[core] (width: Width) extends Bits(width) with Num[UInt /** Unary not * - * @return a hardware [[Bool]] asserted if the least significant bit of this $coll is zero + * @return a hardware [[Bool]] asserted if this $coll equals zero * @group Bitwise */ final def unary_! () : Bool = macro SourceInfoTransform.noArg From 8e683de37bf92674f85a20b679f4cf64bcbe4dd7 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 17 Jan 2019 14:38:47 -0800 Subject: [PATCH 2/5] Fix width-inference description of Bits.<< --- chiselFrontend/src/main/scala/chisel3/core/Bits.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala index bf1f7f63f89..bbe6f7e21c0 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala @@ -323,7 +323,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi * * @param that a hardware component * @return this $coll dynamically shifted left by `that` many places, shifting in zeros from the right - * @note The width of the returned $coll is `width of this + pow(2, width of that)`. + * @note The width of the returned $coll is `width of this + pow(2, width of that) - 1`. * @group Bitwise */ final def << (that: UInt): Bits = macro SourceInfoWhiteboxTransform.thatArg From e2154d174e0c67d712d786f44966cd15562dfffb Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 17 Jan 2019 14:45:12 -0800 Subject: [PATCH 3/5] Improve description of UInt.asSInt --- chiselFrontend/src/main/scala/chisel3/core/Bits.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala index bbe6f7e21c0..335eb7e4f4e 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala @@ -384,10 +384,10 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi def do_asBools(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Seq[Bool] = Seq.tabulate(this.getWidth)(i => this(i)) - /** Reinterpret this $coll as a [[SInt]] + /** Reinterpret this $coll as an [[SInt]] * - * @note The value is not guaranteed to be preserved. For example, a [[UInt]] of width 3 and value 7 (0b111) would - * become a [[SInt]] with value -1. + * @note The arithmetic value is not preserved if the most-significant bit is set. For example, a [[UInt]] of + * width 3 and value 7 (0b111) would become an [[SInt]] of width 3 and value -1. */ final def asSInt(): SInt = macro SourceInfoTransform.noArg From cc21e9cd9509563bc952d37294e08812a283ca9f Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 17 Jan 2019 15:45:22 -0800 Subject: [PATCH 4/5] Make combinational-multiplier warning less vague --- chiselFrontend/src/main/scala/chisel3/core/Bits.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala index 335eb7e4f4e..4ba5aed494a 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala @@ -475,9 +475,9 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi * @define coll numeric-like type * @define numType hardware type * @define canHaveHighCost can result in significant cycle time and area costs - * @define canGenerateA This method can generate a - * @define singleCycleMul @note $canGenerateA single-cycle multiplier which $canHaveHighCost. - * @define singleCycleDiv @note $canGenerateA single-cycle divider which $canHaveHighCost. + * @define canGenerateA This method generates a + * @define singleCycleMul @note $canGenerateA fully combinational multiplier which $canHaveHighCost. + * @define singleCycleDiv @note $canGenerateA fully combinational divider which $canHaveHighCost. * @define maxWidth @note The width of the returned $numType is `max(width of this, width of that)`. * @define maxWidthPlusOne @note The width of the returned $numType is `max(width of this, width of that) + 1`. * @define sumWidth @note The width of the returned $numType is `width of this` + `width of that`. From 62879d16563896baecd469df98bd08298c430252 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 17 Jan 2019 15:45:37 -0800 Subject: [PATCH 5/5] Unary_- is truncating --- chiselFrontend/src/main/scala/chisel3/core/Bits.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala index 4ba5aed494a..abc7b5838e6 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala @@ -655,7 +655,7 @@ sealed class UInt private[core] (width: Width) extends Bits(width) with Num[UInt /** Unary negation (expanding width) * * @return a $coll equal to zero minus this $coll - * $expandingWidth + * $constantWidth * @group Arithmetic */ final def unary_- (): UInt = macro SourceInfoTransform.noArg @@ -969,7 +969,7 @@ sealed class SInt private[core] (width: Width) extends Bits(width) with Num[SInt /** Unary negation (expanding width) * * @return a hardware $coll equal to zero minus this $coll - * $expandingWidth + * $constantWidth * @group Arithmetic */ final def unary_- (): SInt = macro SourceInfoTransform.noArg