object Utils extends LazyLogging
- Source
- Utils.scala
- Alphabetic
- By Inheritance
- Utils
- LazyLogging
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- case class DeclarationNotFoundException(msg: String) extends FirrtlUserException with Product with Serializable
- type NodeMap = HashMap[String, Expression]
Maps node name to value
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val BoolType: UIntType
- def and(e1: Expression, e2: Expression): Expression
Applies the firrtl And primop.
Applies the firrtl And primop. Automatically constant propagates when one of the expressions is True or False.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def combine(circuits: Seq[Circuit]): Circuit
Combines several separate circuit modules (typically emitted by -e or -p compiler options) into a single circuit
- def create_exps(e: Expression): Seq[Expression]
- def create_exps(n: String, t: Type): Seq[Expression]
- def dec2string(v: BigDecimal): String
- def diff(e1: Expression, e2: Expression): Seq[(Expression, Expression)]
Walks two expression trees and returns a sequence of tuples of where they differ
- def distinctBy[A, B](xs: List[A])(f: (A) => B): List[A]
Selects all the elements of this list ignoring the duplicates as determined by == after applying the transforming function f
Selects all the elements of this list ignoring the duplicates as determined by == after applying the transforming function f
- Note
In Scala Standard Library starting in 2.13
- def eq(e1: Expression, e2: Expression): Expression
Applies the firrtl Eq primop.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def error(str: String, cause: Throwable = null): Nothing
- def expandPrefixes(name: String, prefixDelim: String = "_"): Seq[String]
Expand a name into its prefixes, e.g., 'foo_barbaz' becomes 'Seq[foo_, foo_bar, foo_barbaz]'. This can be used to produce better names when generating prefix unique names.
Expand a name into its prefixes, e.g., 'foo_barbaz' becomes 'Seq[foo_, foo_bar, foo_barbaz]'. This can be used to produce better names when generating prefix unique names.
- name
a signal name
- prefixDelim
a prefix delimiter (default is "_")
- returns
the signal name and any prefixes
- def expandRef(e: Expression): Seq[Expression]
Like create_exps, but returns intermediate Expressions as well
- def field_flip(v: Type, s: String): Orientation
- def field_type(v: Type, s: String): Type
- def flow(e: Expression): Flow
- def getAllRefs(expr: Expression): Seq[Reference]
Finds all root References in a nested Expression
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getDeclaration(m: Module, expr: Expression): IsDeclaration
Gets the root declaration of an expression
Gets the root declaration of an expression
- m
the firrtl.ir.Module to search
- expr
the firrtl.ir.Expression that refers to some declaration
- returns
the firrtl.ir.IsDeclaration of
expr
- Exceptions thrown
DeclarationNotFoundException
if no declaration ofexpr
is found
- def getGroundZero(tpe: GroundType): Expression
Returns an Expression equal to zero for a given GroundType
Returns an Expression equal to zero for a given GroundType
- Note
Does not support AnalogType nor IntervalType
- def getKids(e: Expression): Seq[Expression]
Returns children Expressions of e
- def getLogger: Logger
- Definition Classes
- LazyLogging
- def getSIntWidth(s: BigInt): Int
- def getThrowable(maybeException: Option[Throwable], first: Boolean): Throwable
Unwind the causal chain until we hit the initial exception (which may be the first).
Unwind the causal chain until we hit the initial exception (which may be the first).
- maybeException
- possible exception triggering the error,
- first
- true if we want the first (eldest) exception in the chain,
- returns
first or last Throwable in the chain.
- def getUIntWidth(u: BigInt): Int
- def get_field(v: Type, s: String): Field
- def get_flow(p: Port): Flow
- def get_flow(s: Statement): Flow
- def get_info(s: Statement): Info
- def get_point(e: Expression): Int
- def get_size(t: Type): Int
- def get_valid_points(t1: Type, t2: Type, flip1: Orientation, flip2: Orientation): Seq[(Int, Int)]
- def groupByIntoSeq[A, K](xs: Iterable[A])(f: (A) => K): Seq[(K, Seq[A])]
Similar to Seq.groupBy except that it preserves ordering of elements within each group
- def hasFlip(t: Type): Boolean
Returns true if t, or any subtype, contains a flipped field
Returns true if t, or any subtype, contains a flipped field
- t
type firrtl.ir.Type to be checked
- returns
if t contains firrtl.ir.Flip
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def implies(e1: Expression, e2: Expression): Expression
implies(e1, e2) = or(not(e1), e2).
implies(e1, e2) = or(not(e1), e2). Automatically constant propagates when one of the expressions is True or False.
- def inline(nodeMap: NodeMap, stop: (String) => Boolean = x: String => false)(e: Expression): Expression
Returns an inlined expression (replacing node references with values), stopping on a stopping condition or until the reference is not a node
- def isBitExtract(expr: Expression): Boolean
Returns true if Expression is a Bits PrimOp, false otherwise
- def isBitExtract(op: PrimOp): Boolean
Returns true if PrimOp is a BitExtraction, false otherwise
- def isCast(expr: Expression): Boolean
Returns true if Expression is a casting PrimOp, false otherwise
- def isCast(op: PrimOp): Boolean
Returns true if PrimOp is a cast, false otherwise
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isLiteral(e: Expression): Boolean
Returns true iff the expression is a Literal or a Literal cast to a different type.
- def isTemp(str: String): Boolean
- def kind(e: Expression): Kind
- val logger: Logger
- Attributes
- protected
- Definition Classes
- LazyLogging
- def maskBigInt(value: BigInt, width: Int): BigInt
Returns the value masked with the width.
Returns the value masked with the width.
This supports truncating negative values as well as values that are too wide for the width
- def max(a: BigInt, b: BigInt): BigInt
- def mergeRef(root: Expression, body: Expression): Expression
Adds a root reference to some SubField/SubIndex chain
- def min(a: BigInt, b: BigInt): BigInt
- def module_type(m: DefModule): BundleType
- def mux(cond: Expression, tval: Expression, fval: Expression): Expression
Builds a Mux expression with the correct type.
- def mux_type(t1: Type, t2: Type): Type
- def mux_type(e1: Expression, e2: Expression): Type
- def mux_type_and_widths(t1: Type, t2: Type): Type
- def mux_type_and_widths(e1: Expression, e2: Expression): Type
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def niceName(depth: Int)(e: Expression): String
- def niceName(e: Expression): String
Provide a nice name to create a temporary *
- def not(e: Expression): Expression
Applies the firrtl Not primop.
Applies the firrtl Not primop. Automatically constant propagates when the expressions is True or False.
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- val one: UIntLiteral
- def or(e1: Expression, e2: Expression): Expression
Applies the firrtl Or primop.
Applies the firrtl Or primop. Automatically constant propagates when one of the expressions is True or False.
- def orderAgnosticEquality(a: Circuit, b: Circuit): Boolean
Checks if two circuits are equal regardless of their ordering of module definitions
- def pow_minus_one(a: BigInt, b: BigInt): BigInt
- def splitRef(e: Expression): (WRef, Expression)
Splits an Expression into root Ref and tail
Splits an Expression into root Ref and tail
Given: SubField(SubIndex(SubField(Ref("a", UIntType(IntWidth(32))), "b"), 2), "c") Returns: (Ref("a"), SubField(SubIndex(Ref("b"), 2), "c")) a.b[2].c -> (a, b[2].c)
, Given: SubField(SubIndex(Ref("b"), 2), "c") Returns: (Ref("b"), SubField(SubIndex(EmptyExpression, 2), "c")) b[2].c -> (b, EMPTY[2].c)
- Note
This function only supports RefLikeExpressions: Reference, SubField, SubIndex, and SubAccess
Examples: - def squashEmpty(s: Statement): Statement
Removes all firrtl.ir.EmptyStmt statements and condenses firrtl.ir.Block statements.
- def stmtToType(s: Statement): BundleType
Creates a Bundle Type from a Stmt
- def sub_type(v: Type): Type
- def swap(f: Orientation): Orientation
- def swap(d: Direction): Direction
- def swap(g: Flow): Flow
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def throwInternalError(message: String = "", exception: Option[Exception] = None): Nothing
Throw an internal error, possibly due to an exception.
Throw an internal error, possibly due to an exception.
- message
- possible string to emit,
- exception
- possible exception triggering the error.
- def time[R](block: => R): (Double, R)
- def times(f1: Orientation, f2: Orientation): Orientation
- def times(flip: Orientation, g: Flow): Flow
- def times(g: Flow, flip: Orientation): Flow
- def times(d: Direction, g: Flow): Direction
- def times(g: Flow, d: Direction): Direction
- def times(d: Direction, flip: Orientation): Direction
- def toString(): String
- Definition Classes
- AnyRef → Any
- def toTarget(main: String, module: String)(expression: Expression): ReferenceTarget
- implicit def toWrappedExpression(x: Expression): WrappedExpression
- def to_dir(o: Orientation): Direction
- def to_dir(g: Flow): Direction
- def to_flip(g: Flow): Orientation
- def to_flip(d: Direction): Orientation
- def to_flow(d: Direction): Flow
- def trim(v: BigDecimal): BigDecimal
- val v_keywords: Set[String]
- 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()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- val zero: UIntLiteral
- object False
- object True
This is the documentation for Firrtl.