trait Num[T <: Data] extends NumIntf[T]
Abstract trait defining operations available on numeric-like hardware data types.
- T
the underlying type of the number
- Source
- Num.scala
- Grouped
- Alphabetic
- By Inheritance
- Num
- NumIntf
- SourceInfoDoc
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def do_%(that: T)(implicit sourceInfo: SourceInfo): T
- Definition Classes
- NumIntf
- abstract def do_*(that: T)(implicit sourceInfo: SourceInfo): T
- Definition Classes
- NumIntf
- abstract def do_+(that: T)(implicit sourceInfo: SourceInfo): T
- Definition Classes
- NumIntf
- abstract def do_-(that: T)(implicit sourceInfo: SourceInfo): T
- Definition Classes
- NumIntf
- abstract def do_/(that: T)(implicit sourceInfo: SourceInfo): T
- Definition Classes
- NumIntf
- abstract def do_<(that: T)(implicit sourceInfo: SourceInfo): Bool
- Definition Classes
- NumIntf
- abstract def do_<=(that: T)(implicit sourceInfo: SourceInfo): Bool
- Definition Classes
- NumIntf
- abstract def do_>(that: T)(implicit sourceInfo: SourceInfo): Bool
- Definition Classes
- NumIntf
- abstract def do_>=(that: T)(implicit sourceInfo: SourceInfo): Bool
- Definition Classes
- NumIntf
- abstract def do_abs(implicit sourceInfo: SourceInfo): T
- Definition Classes
- NumIntf
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final macro def %(that: T): T
Modulo operator
Modulo operator
- that
a hardware type
- returns
the remainder of this numeric-like type divided by
that
- Definition Classes
- NumIntf
- Note
This method generates a fully combinational divider which can result in significant cycle time and area costs.
- final macro def *(that: T): T
Multiplication operator
Multiplication operator
- that
a hardware type
- returns
the product of this numeric-like type and
that
- Definition Classes
- NumIntf
- Note
The width of the returned hardware type is
,width of this
+width of that
.This method generates a fully combinational multiplier which can result in significant cycle time and area costs.
- final macro def +(that: T): T
Addition operator
Addition operator
- that
a hardware type
- returns
the sum of this numeric-like type and
that
- Definition Classes
- NumIntf
- Note
The width of the returned hardware type is
max(width of this, width of that)
.
- final macro def -(that: T): T
Subtraction operator
Subtraction operator
- that
a hardware type
- returns
the difference of this numeric-like type less
that
- Definition Classes
- NumIntf
- Note
The width of the returned hardware type is
max(width of this, width of that) + 1
.
- def ->[B](y: B): (Num[T], B)
- final macro def /(that: T): T
Division operator
Division operator
- that
a hardware type
- returns
the quotient of this numeric-like type divided by
that
- Definition Classes
- NumIntf
- To do
full rules
- Note
This method generates a fully combinational divider which can result in significant cycle time and area costs.
- final macro def <(that: T): Bool
Less than operator
Less than operator
- that
a hardware type
- returns
a hardware Bool asserted if this numeric-like type is less than
that
- Definition Classes
- NumIntf
- final macro def <=(that: T): Bool
Less than or equal to operator
Less than or equal to operator
- that
a hardware type
- returns
a hardware Bool asserted if this numeric-like type is less than or equal to
that
- Definition Classes
- NumIntf
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final macro def >(that: T): Bool
Greater than operator
Greater than operator
- that
a hardware component
- returns
a hardware Bool asserted if this numeric-like type is greater than
that
- Definition Classes
- NumIntf
- final macro def >=(that: T): Bool
Greater than or equal to operator
Greater than or equal to operator
- that
a hardware component
- returns
a hardware Bool asserted if this numeric-like type is greather than or equal to
that
- Definition Classes
- NumIntf
- def _maxImpl(that: T)(implicit sourceInfo: SourceInfo): T
- Attributes
- protected
- def _minImpl(that: T)(implicit sourceInfo: SourceInfo): T
- Attributes
- protected
- final macro def abs: T
Absolute value operator
Absolute value operator
- returns
a hardware type with a value equal to the absolute value of this numeric-like type
- Definition Classes
- NumIntf
- Note
The width of the returned hardware type is unchanged, i.e., the
width of this
.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def do_max(that: T)(implicit sourceInfo: SourceInfo): T
- Definition Classes
- NumIntf
- def do_min(that: T)(implicit sourceInfo: SourceInfo): T
- Definition Classes
- NumIntf
- def ensuring(cond: (Num[T]) => Boolean, msg: => Any): Num[T]
- def ensuring(cond: (Num[T]) => Boolean): Num[T]
- def ensuring(cond: Boolean, msg: => Any): Num[T]
- def ensuring(cond: Boolean): Num[T]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final macro def max(that: T): T
Maximum operator
Maximum operator
- that
a hardware type
- returns
a hardware type with a value equal to the minimum value of this numeric-like type and
that
- Definition Classes
- NumIntf
- Note
The width of the returned hardware type is
max(width of this, width of that)
.
- final macro def min(that: T): T
Minimum operator
Minimum operator
- that
a hardware numeric-like type
- returns
a hardware type with a value equal to the minimum value of this numeric-like type and
that
- Definition Classes
- NumIntf
- Note
The width of the returned hardware type is
max(width of this, width of that)
.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Shadowed Implicit Value Members
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from Num[T] toany2stringadd[Num[T]] performed by method any2stringadd in scala.Predef.
- Shadowing
- This implicitly inherited member is shadowed by one or more members in this class.
To access this member you can use a type ascription:(num: any2stringadd[Num[T]]).+(other)
- Definition Classes
- any2stringadd
Deprecated Value Members
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from Num[T] toStringFormat[Num[T]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (Num[T], B)
- Implicit
- This member is added by an implicit conversion from Num[T] toArrowAssoc[Num[T]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.
Arithmetic
Arithmetic hardware operators
Comparison
Comparison hardware operators
Ungrouped
SourceInfoTransformMacro
These internal methods are not part of the public-facing API!
The equivalent public-facing methods do not have the do_
prefix or have the same name. Use and look at the
documentation for those. If you want left shift, use <<
, not do_<<
. If you want conversion to a
Seq of Bools look at the asBools
above, not the one below. Users can safely ignore
every method in this group!
🐉🐉🐉 Here be dragons... 🐉🐉🐉
These do_X
methods are used to enable both implicit passing of SourceInfo
while also supporting chained apply methods. In effect all "normal" methods that you, as a user, will use in your
designs, are converted to their "hidden", do_*
, via macro transformations. Without using macros here, only one
of the above wanted behaviors is allowed (implicit passing and chained applies)---the compiler interprets a
chained apply as an explicit 'implicit' argument and will throw type errors.
The "normal", public-facing methods then take no SourceInfo. However, a macro transforms this public-facing method
into a call to an internal, hidden do_*
that takes an explicit SourceInfo by inserting an
implicitly[SourceInfo]
as the explicit argument.
This is the documentation for Chisel.
Package structure
The chisel3 package presents the public API of Chisel. It contains the concrete core types
UInt
,SInt
,Bool
,Clock
, andReg
, the abstract typesBits
,Aggregate
, andData
, and the aggregate typesBundle
andVec
.The Chisel package is a compatibility layer that attempts to provide chisel2 compatibility in chisel3.
Utility objects and methods are found in the
util
package.The
testers
package defines the basic interface for chisel testers.