Skip to content

Commit bd82f18

Browse files
jackkoenigkammoh
authored andcommitted
Fix UInt unary negation ScalaDoc (chipsalliance#4829)
Deprecate invalid unary operator unary_-%.
1 parent bf5895b commit bd82f18

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

core/src/main/scala-2/chisel3/BitsIntf.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ private[chisel3] trait BitsIntf extends ToBoolable { self: Bits =>
277277
private[chisel3] trait UIntIntf { self: UInt =>
278278

279279
// TODO: refactor to share documentation with Num or add independent scaladoc
280-
/** Unary negation (expanding width)
280+
/** Unary negation (constant width)
281281
*
282282
* @return a $coll equal to zero minus this $coll
283283
* $constantWidth
@@ -287,16 +287,18 @@ private[chisel3] trait UIntIntf { self: UInt =>
287287

288288
/** Unary negation (constant width)
289289
*
290-
* @return a $coll equal to zero minus this $coll shifted right by one.
290+
* @return a $coll equal to zero minus this $coll
291291
* $constantWidth
292292
* @group Arithmetic
293293
*/
294+
@deprecated("Use unary_- which has the same behavior", "Chisel 6.8.0")
294295
final def unary_-% : UInt = macro SourceInfoTransform.noArg
295296

296297
/** @group SourceInfoTransformMacro */
297298
def do_unary_-(implicit sourceInfo: SourceInfo): UInt = _impl_unary_-
298299

299300
/** @group SourceInfoTransformMacro */
301+
@deprecated("Use unary_- which has the same behavior", "Chisel 6.8.0")
300302
def do_unary_-%(implicit sourceInfo: SourceInfo): UInt = _impl_unary_-%
301303

302304
override def do_+(that: UInt)(implicit sourceInfo: SourceInfo): UInt = _impl_+(that)
@@ -553,12 +555,14 @@ private[chisel3] trait SIntIntf { self: SInt =>
553555
* $constantWidth
554556
* @group Arithmetic
555557
*/
558+
@deprecated("Use unary_- which has the same behavior", "Chisel 6.8.0")
556559
final def unary_-% : SInt = macro SourceInfoTransform.noArg
557560

558561
/** @group SourceInfoTransformMacro */
559562
def do_unary_-(implicit sourceInfo: SourceInfo): SInt = _impl_unary_-
560563

561564
/** @group SourceInfoTransformMacro */
565+
@deprecated("Use unary_- which has the same behavior", "Chisel 6.8.0")
562566
def do_unary_-%(implicit sourceInfo: SourceInfo): SInt = _impl_unary_-%
563567

564568
/** add (default - no growth) operator */

core/src/main/scala-3/chisel3/BitsIntf.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ private[chisel3] trait BitsIntf extends ToBoolable { self: Bits =>
190190
private[chisel3] trait UIntIntf { self: UInt =>
191191

192192
// TODO: refactor to share documentation with Num or add independent scaladoc
193-
/** Unary negation (expanding width)
193+
/** Unary negation (constant width)
194194
*
195195
* @return a $coll equal to zero minus this $coll
196196
* $constantWidth
@@ -204,6 +204,7 @@ private[chisel3] trait UIntIntf { self: UInt =>
204204
* $constantWidth
205205
* @group Arithmetic
206206
*/
207+
@deprecated("Use unary_- which has the same behavior", "Chisel 6.8.0")
207208
def unary_-%(using SourceInfo): UInt = _impl_unary_-%
208209

209210
override def +(that: UInt): UInt = _impl_+(that)
@@ -398,10 +399,11 @@ private[chisel3] trait SIntIntf { self: SInt =>
398399

399400
/** Unary negation (constant width)
400401
*
401-
* @return a hardware $coll equal to zero minus `this` shifted right by one
402+
* @return a hardware $coll equal to zero minus `this` $coll
402403
* $constantWidth
403404
* @group Arithmetic
404405
*/
406+
@deprecated("Use unary_- which has the same behavior", "Chisel 6.8.0")
405407
def unary_-%(using SourceInfo): SInt = _impl_unary_-%
406408

407409
/** add (default - no growth) operator */

0 commit comments

Comments
 (0)