CIRCT 24.0.0git
Loading...
Searching...
No Matches
circt::firrtl Namespace Reference

Namespaces

namespace  detail
namespace  direction
namespace  instance_like_impl
namespace  impl
namespace  PreserveAggregate
 Configure which aggregate values will be preserved by the LowerTypes pass.
namespace  PreserveValues
 Configure which values will be explicitly preserved by the DropNames pass.
namespace  patterns

Classes

class  InstanceInfo
class  FieldRefCache
 Caching version of getFieldRefFromValue. More...
struct  FIRParserOptions
struct  FIRVersion
 The FIRRTL specification version. More...
struct  TargetToken
 Stores an index into an aggregate. More...
struct  TokenAnnoTarget
 The parsed annotation path. More...
struct  AnnoPathValue
struct  AnnoTargetCache
 Cache AnnoTargets for a module's named things. More...
struct  CircuitTargetCache
 Cache AnnoTargets for a circuit's modules, walked as needed. More...
struct  WiringProblem
 A representation of a deferred Wiring problem consisting of a source that should be connected to a sink. More...
struct  LegacyWiringProblem
 A representation of a legacy Wiring problem consisting of a signal source that should be connected to one or many sinks. More...
struct  ModuleModifications
 A store of pending modifications to a FIRRTL module associated with solving one or more WiringProblems. More...
struct  HierPathCache
 A cache of existing HierPathOps, mostly used to facilitate HierPathOp reuse. More...
struct  ApplyState
 State threaded through functions for resolving and applying annotations. More...
struct  AnnoRecord
 ===-------------------------------------------------------------------—===// LowerAnnotations ===-------------------------------------------------------------------—===// More...
class  Annotation
 This class provides a read-only projection of an annotation. More...
class  AnnotationSet
 This class provides a read-only projection over the MLIR attributes that represent a set of annotations. More...
class  AnnotationSetIterator
struct  AnnoTarget
 An annotation target is used to keep track of something that is targeted by an Annotation. More...
struct  OpAnnoTarget
 This represents an annotation targeting a specific operation. More...
struct  PortAnnoTarget
 This represents an annotation targeting a specific port of a module, memory, or instance. More...
class  FieldSource
 To use this class, retrieve a cached copy from the analysis manager: auto &fieldsource = getAnalysis<FieldSource>(getOperation());. More...
class  InstanceGraph
 This graph tracks modules and where they are instantiated. More...
struct  GenericIntrinsic
 Helper class for checking and extracting information from the generic instrinsic op. More...
class  IntrinsicConverter
 Base class for Intrinsic Converters. More...
class  IntrinsicOpConverter
class  IntrinsicLowerings
 Lowering helper which collects all intrinsic converters. More...
struct  IntrinsicLoweringDialectInterface
 A dialect interface to provide lowering conversions. More...
struct  IntrinsicLoweringInterfaceCollection
struct  FIRRTLIntrinsicLoweringDialectInterface
struct  PortInfo
 This holds the name and type that describes the module's ports. More...
class  SameOperandsIntTypeKind
 A binary operation where the operands have the same integer kind. More...
struct  FirMemory
struct  FIRRTLReducePatternDialectInterface
 A dialect interface to provide reduction patterns to a reducer tool. More...
struct  RecursiveTypeProperties
 A collection of bits indicating the recursive properties of a type. More...
class  FIRRTLType
class  FIRRTLBaseType
class  WidthQualifiedTypeTrait
 Trait for types which have a width. More...
class  IntType
 This is the common base class between SIntType and UIntType. More...
class  PropertyType
struct  ClassElement
class  ContainAliasableTypes
 A struct to check if there is a type derived from FIRRTLBaseType. More...
class  ContainAliasableTypes< BaseTy >
class  FIRRTLTypeSwitch
 This class implements the same functionality as TypeSwitch except that it uses firrtl::type_dyn_cast for dynamic cast. More...
class  FIRRTLTypeSwitch< T, void >
 Specialization of FIRRTLTypeSwitch for void returning callables. More...
class  BaseTypeAliasOr
class  TieOffCache
 Helper class to cache tie-off values for different FIRRTL types. More...
class  InstanceChoiceMacroTable
class  ExprVisitor
 ExprVisitor is a visitor for FIRRTL expression nodes. More...
class  StmtVisitor
 ExprVisitor is a visitor for FIRRTL statement nodes. More...
class  DeclVisitor
 ExprVisitor is a visitor for FIRRTL declaration nodes. More...
class  StmtExprVisitor
 StmtExprVisitor is a visitor for FIRRTL operation that has an optional result. More...
class  FIRRTLVisitor
 FIRRTLVisitor allows you to visit all of the expr/stmt/decls with one class declaration. More...
struct  ClockEdge
class  GatedClockConversion
 Sink gated-clock enables into ops across module boundaries. More...
struct  LayerSetCompare
 Compares two SymbolRefAttr lexicographically, returning true if LHS should be ordered before RHS. More...
struct  CircuitNamespace
 The namespace of a CircuitOp, generally inhabited by modules. More...
class  NLATable
 This table tracks nlas and what modules participate in them. More...
struct  OwningModuleCache
 This implements an analysis to determine which module owns a given path operation. More...
class  FIRToken
 This represents a specific token for .fir files. More...
class  FIRLexer
 This implements a lexer for .fir files. More...
class  FIRLexerCursor
 This is the state captured for a lexer cursor. More...

Typedefs

using InstanceRecord = igraph::InstanceRecord
using InstanceGraphNode = igraph::InstanceGraphNode
using InstancePathCache = igraph::InstancePathCache
using FIRRTLValue = mlir::TypedValue<FIRRTLType>
using FIRRTLBaseValue = mlir::TypedValue<FIRRTLBaseType>
using FIRRTLPropertyValue = mlir::TypedValue<PropertyType>
using WalkDriverCallback
 Walk all the drivers of a value, passing in the connect operations drive the value.
using GetNamespaceCallback
using LayerSet = SmallSet<SymbolRefAttr, 4, LayerSetCompare>

Enumerations

enum class  VerificationFlavor { None , IfElseFatal , Immediate , SVA }
enum class  Direction { In , Out }
 This represents the direction of a single port. More...
enum class  ConnectBehaviorKind { LastConnect , StaticSingleConnect }
enum class  Flow : uint8_t { None , Source , Sink , Duplex }
enum class  DeclKind { Port , Instance , Other }
enum class  ReadPortSubfield { addr , en , clk , data }
enum class  WritePortSubfield {
  addr , en , clk , data ,
  mask
}
enum class  ReadWritePortSubfield {
  addr , en , clk , rdata ,
  wmode , wdata , wmask
}
enum class  EdgeKind { Alias , Gate , InstanceIn , InstanceOut }
enum class  CompanionMode { Bind , Instantiate , Drop }
enum class  InferDomainsMode { Check , Infer , InferAll }
 The mode for the InferDomains pass. More...

Functions

llvm::raw_ostream & operator<< (llvm::raw_ostream &os, const InstanceInfo::LatticeValue &value)
mlir::LogicalResult exportFIRFile (mlir::ModuleOp module, llvm::raw_ostream &os, std::optional< size_t > targetLineLength, FIRVersion version)
void registerToFIRFileTranslation ()
mlir::OwningOpRef< mlir::ModuleOp > importFIRFile (llvm::SourceMgr &sourceMgr, mlir::MLIRContext *context, mlir::TimingScope &ts, FIRParserOptions options={})
std::pair< bool, std::optional< mlir::LocationAttr > > maybeStringToLocation (llvm::StringRef spelling, bool skipParsing, mlir::StringAttr &locatorFilenameCache, FileLineColLoc &fileLineColLocCache, MLIRContext *context)
void registerFromFIRFileTranslation ()
constexpr FIRVersion minimumFIRVersion (2, 0, 0)
 The current minimum version of FIRRTL that the parser supports.
constexpr FIRVersion nextFIRVersion (7, 0, 0)
 The next version of FIRRTL that is not yet released.
template<typename T>
T & operator<< (T &os, FIRVersion version)
template<typename T>
static T & operator<< (T &os, const AnnoPathValue &path)
template<typename T>
static T & operator<< (T &os, const OpAnnoTarget &target)
template<typename T>
static T & operator<< (T &os, const PortAnnoTarget &target)
template<typename T>
static T & operator<< (T &os, const AnnoTarget &target)
std::string canonicalizeTarget (StringRef target)
 Return an input target string in canonical form.
std::optional< TokenAnnoTarget > tokenizePath (StringRef origTarget)
 Parse a FIRRTL annotation path into its constituent parts.
std::optional< AnnoPathValue > resolveEntities (TokenAnnoTarget path, CircuitOp circuit, SymbolTable &symTbl, CircuitTargetCache &cache)
 Convert a parsed target string to a resolved target structure.
std::optional< AnnoPathValue > resolvePath (StringRef rawPath, CircuitOp circuit, SymbolTable &symTbl, CircuitTargetCache &cache)
 Resolve a string path to a named item inside a circuit.
LogicalResult applyGCTView (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state)
LogicalResult applyGCTDataTaps (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state)
LogicalResult applyGCTMemTaps (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state)
LogicalResult applyTraceName (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state)
 Expand a TraceNameAnnotation (which has don't touch semantics) into a TraceAnnotation (which does NOT have don't touch semantics) and separate DontTouchAnnotations for targets that are not modules, external modules, or instances (as these targets are not valid for a don't touch).
LogicalResult applyWiring (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state)
 Consume SourceAnnotation and SinkAnnotation, storing into state.
template<typename A>
A tryGetAsBase (DictionaryAttr dict, Attribute root, StringRef key, Location loc, Twine whatSpecific, Twine whatFull, Twine path=Twine())
 Implements the same behavior as DictionaryAttr::getAs to return the value of a specific type associated with a key in a dictionary.
template<typename A>
A tryGetAs (DictionaryAttr dict, Attribute root, StringRef key, Location loc, Twine clazz, Twine path=Twine())
 Implements the same behavior as DictionaryAttr::getAs to return the value of a specific type associated with a key in a dictionary.
LogicalResult registerAnnotationRecord (StringRef annoClass, AnnoRecord annoRecord, const std::function< void(llvm::Twine)> &errorHandler={})
 Register external annotation records.
std::optional< AnnoPathValue > stdResolve (DictionaryAttr anno, ApplyState &state)
 ===-------------------------------------------------------------------—===// Standard Utility Resolvers ===-------------------------------------------------------------------—===//
std::optional< AnnoPathValue > tryResolve (DictionaryAttr anno, ApplyState &state)
 Resolves with target, if it exists. If not, resolves to the circuit.
LogicalResult applyWithoutTargetImpl (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state, bool allowNonLocal)
 ===-------------------------------------------------------------------—===// Standard Utility Appliers ===-------------------------------------------------------------------—===//
template<bool allowNonLocal, bool allowPortAnnoTarget, typename T, typename... Tr>
static LogicalResult applyWithoutTarget (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state)
 An applier which puts the annotation on the target and drops the 'target' field from the annotation.
template<bool allowNonLocal, typename T, typename... Tr>
static LogicalResult applyWithoutTarget (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state)
template<bool allowNonLocal = false>
static LogicalResult applyWithoutTarget (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state)
 An applier which puts the annotation on the target and drops the 'target' field from the annotaiton.
StringRef getAnnotationAttrName ()
 Return the name of the attribute used for annotations on FIRRTL ops.
StringRef getPortAnnotationAttrName ()
 Return the name of the attribute used for port annotations on FIRRTL ops.
ArrayAttr getAnnotationsIfPresent (Operation *op)
llvm::raw_ostream & operator<< (llvm::raw_ostream &os, const Direction &dir)
 Prints the Direction to the stream as either "in" or "out".
LogicalResult verifyModuleLikeOpInterface (FModuleLike module)
 Verification hook for verifying module like operations.
bool hasDroppableName (Operation *op)
 Return true if the name is droppable.
bool isExpression (Operation *op)
 Return true if the specified operation is a firrtl expression.
size_t getNumPorts (Operation *op)
 Return the number of ports in a module-like thing (modules, memories, etc).
bool isConstant (Operation *op)
 Return true if the specified operation has a constant value.
bool isConstant (Value value)
 Return true if the specified value is a constant.
bool isDuplexValue (Value val)
 Returns true if the value results from an expression with duplex flow.
Flow swapFlow (Flow flow)
 Get a flow's reverse.
constexpr bool isValidSrc (Flow flow)
constexpr bool isValidDst (Flow flow)
Flow foldFlow (Value val, Flow accumulatedFlow=Flow::Source)
 Compute the flow for a Value, val, as determined by the FIRRTL specification.
DeclKind getDeclarationKind (Value val)
MemDirAttr operator| (MemDirAttr lhs, MemDirAttr rhs)
 Allow 'or'ing MemDirAttr.
MemDirAttr & operator|= (MemDirAttr &lhs, MemDirAttr rhs)
StringAttr getInnerSymName (Operation *op)
 Return the StringAttr for the inner_sym name, if it exists.
bool hasDontTouch (Value value)
 Check whether a block argument ("port") or the operation defining a value has a DontTouch annotation, or a symbol that should prevent certain types of canonicalizations.
bool hasDontTouch (Operation *op)
 Check whether an operation has a DontTouch annotation, or a symbol that should prevent certain types of canonicalizations.
MatchingConnectOp getSingleConnectUserOf (Value value)
 Scan all the uses of the specified value, checking to see if there is exactly one connect that has the value as its destination.
void registerReducePatternDialectInterface (mlir::DialectRegistry &registry)
 Register the FIRRTL Reduction pattern dialect interface to the given registry.
bool isConst (Type type)
 Returns true if this is a 'const' type whose value is guaranteed to be unchanging at circuit execution time.
bool containsConst (Type type)
 Returns true if the type is or contains a 'const' type whose value is guaranteed to be unchanging at circuit execution time.
bool hasZeroBitWidth (FIRRTLType type)
 Return true if the type has zero bit width.
bool areTypesEquivalent (FIRRTLType destType, FIRRTLType srcType, bool destOuterTypeIsConst=false, bool srcOuterTypeIsConst=false, bool requireSameWidths=false)
 Returns whether the two types are equivalent.
bool areTypesWeaklyEquivalent (FIRRTLType destType, FIRRTLType srcType, bool destFlip=false, bool srcFlip=false, bool destOuterTypeIsConst=false, bool srcOuterTypeIsConst=false)
 Returns true if two types are weakly equivalent.
bool areTypesConstCastable (FIRRTLType destType, FIRRTLType srcType, bool srcOuterTypeIsConst=false)
 Returns whether the srcType can be const-casted to the destType.
bool areTypesRefCastable (Type dstType, Type srcType)
 Return true if destination ref type can be cast from source ref type, per FIRRTL spec rules they must be identical or destination has more general versions of the corresponding type in the source.
bool isTypeLarger (FIRRTLBaseType dstType, FIRRTLBaseType srcType)
 Returns true if the destination is at least as wide as a source.
bool areAnonymousTypesEquivalent (FIRRTLBaseType lhs, FIRRTLBaseType rhs)
 Return true if anonymous types of given arguments are equivalent by pointer comparison.
bool areAnonymousTypesEquivalent (mlir::Type lhs, mlir::Type rhs)
mlir::Type getPassiveType (mlir::Type anyBaseFIRRTLType)
bool isTypeInOut (mlir::Type type)
 Returns true if the given type has some flipped (aka unaligned) dataflow.
bool hasHardwareElements (FIRRTLType type)
 Return true if the given type contains any elements of hardware types.
llvm::hash_code hash_value (const ClassElement &element)
std::optional< int64_t > getBitWidth (FIRRTLBaseType type, bool ignoreFlip=false)
ParseResult parseNestedType (FIRRTLType &result, AsmParser &parser)
 Parse a FIRRTLType.
ParseResult parseNestedBaseType (FIRRTLBaseType &result, AsmParser &parser)
ParseResult parseNestedPropertyType (PropertyType &result, AsmParser &parser)
void printNestedType (Type type, AsmPrinter &os)
 Print a type defined by this dialect.
template<typename... BaseTy>
bool type_isa (Type type)
template<typename... BaseTy>
bool type_isa_and_nonnull (Type type)
template<typename BaseTy>
BaseTy type_cast (Type type)
template<typename BaseTy>
BaseTy type_dyn_cast (Type type)
template<typename BaseTy>
BaseTy type_dyn_cast_or_null (Type type)
void emitConnect (OpBuilder &builder, Location loc, Value lhs, Value rhs, bool warnOnTruncation=false)
 Emit a connect between two values.
void emitConnect (ImplicitLocOpBuilder &builder, Value lhs, Value rhs, bool warnOnTruncation=false)
void emitConnect (ImplicitLocOpBuilder &builder, Value lhs, Value rhs, llvm::function_ref< Location()> getDiagLoc, bool warnOnTruncation=false)
 Emit a connect between two values.
IntegerAttr getIntAttr (Type type, const APInt &value)
 Utiility for generating a constant attribute.
IntegerAttr getIntZerosAttr (Type type)
 Utility for generating a constant zero attribute.
IntegerAttr getIntOnesAttr (Type type)
 Utility for generating a constant all ones attribute.
bool preservesInitial (IntegerAttr initial, std::optional< APInt > foldedValue=std::nullopt)
 Return true if replacing a register carrying the time-zero initial value with foldedValue does not change the register's time-zero behavior.
PropAssignOp getPropertyAssignment (FIRRTLPropertyValue value)
 Return the single assignment to a Property value.
Value getDriverFromConnect (Value val)
 Return the module-scoped driver of a value only looking through one connect.
Value getValueSource (Value val, bool lookThroughWires, bool lookThroughNodes, bool lookThroughCasts)
 Return the value that drives another FIRRTL value within module scope.
Value getModuleScopedDriver (Value val, bool lookThroughWires, bool lookThroughNodes, bool lookThroughCasts)
 Return the value that drives another FIRRTL value within module scope.
template<typename A, typename... B>
static bool isModuleScopedDrivenBy (Value val, bool lookThroughWires, bool lookThroughNodes, bool lookThroughCasts)
 Return true if a value is module-scoped driven by a value of a specific type.
bool walkDrivers (FIRRTLBaseValue value, bool lookThroughWires, bool lookThroughNodes, bool lookThroughCasts, WalkDriverCallback callback)
FieldRef getFieldRefFromValue (Value value, bool lookThroughCasts=false)
 Get the FieldRef from a value.
FieldRef getDeltaRef (Value value, bool lookThroughCasts=false)
 Get the delta indexing from a value, as a FieldRef.
std::pair< std::string, bool > getFieldName (const FieldRef &fieldRef, bool nameSafe=false)
 Get a string identifier representing the FieldRef.
Value getValueByFieldID (ImplicitLocOpBuilder builder, Value value, unsigned fieldID)
 This gets the value targeted by a field id.
void walkGroundTypes (FIRRTLType firrtlType, llvm::function_ref< void(uint64_t, FIRRTLBaseType, bool)> fn)
 Walk leaf ground types in the firrtlType and apply the function fn.
hw::InnerSymTarget getTargetFor (FieldRef ref)
 Return the inner sym target for the specified value and fieldID.
FieldRef getFieldRefForTarget (const hw::InnerSymTarget &ist)
 Get FieldRef pointing to the specified inner symbol target, which must be valid.
std::pair< hw::InnerSymAttr, StringAttr > getOrAddInnerSym (MLIRContext *context, hw::InnerSymAttr attr, uint64_t fieldID, llvm::function_ref< hw::InnerSymbolNamespace &()> getNamespace)
 Ensure that the the InnerSymAttr has a symbol on the field specified.
StringAttr getOrAddInnerSym (const hw::InnerSymTarget &target, llvm::function_ref< hw::InnerSymbolNamespace &()> getNamespace)
 Returns an inner symbol identifier for the specified target (op or port), adding one if necessary.
StringAttr getOrAddInnerSym (const hw::InnerSymTarget &target, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified target (op or port), adding one if necessary.
hw::InnerRefAttr getInnerRefTo (const hw::InnerSymTarget &target, GetNamespaceCallback getNamespace)
 Obtain an inner reference to the target (operation or port), adding an inner symbol as necessary.
static StringAttr getOrAddInnerSym (Operation *op, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified operation, adding one if necessary.
static StringAttr getOrAddInnerSym (Operation *op, uint64_t fieldID, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified operation's field adding one if necessary.
static hw::InnerRefAttr getInnerRefTo (Operation *op, GetNamespaceCallback getNamespace)
 Obtain an inner reference to an operation, possibly adding an inner symbol.
static hw::InnerRefAttr getInnerRefTo (Operation *op, uint64_t fieldID, GetNamespaceCallback getNamespace)
 Obtain an inner reference to an operation's field, possibly adding an inner symbol.
static StringAttr getOrAddInnerSym (FModuleLike mod, size_t portIdx, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified port, adding one if necessary.
static StringAttr getOrAddInnerSym (FModuleLike mod, size_t portIdx, uint64_t fieldID, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified port's field, adding one if necessary.
static hw::InnerRefAttr getInnerRefTo (FModuleLike mod, size_t portIdx, GetNamespaceCallback getNamespace)
 Obtain an inner reference to a port, possibly adding an inner symbol.
static hw::InnerRefAttr getInnerRefTo (FModuleLike mod, size_t portIdx, uint64_t fieldID, GetNamespaceCallback getNamespace)
 Obtain an inner reference to a port's field, possibly adding an inner symbol.
FIRRTLBaseType getBaseType (Type type)
 If it is a base type, return it as is.
template<typename T>
T getBaseOfType (Type type)
 Get base type if isa<> the requested type, else null.
FIRRTLType mapBaseType (FIRRTLType type, function_ref< FIRRTLBaseType(FIRRTLBaseType)> fn)
 Return a FIRRTLType with its base type component mutated by the given function.
FIRRTLType mapBaseTypeNullable (FIRRTLType type, function_ref< FIRRTLBaseType(FIRRTLBaseType)> fn)
 Return a FIRRTLType with its base type component mutated by the given function.
Type lowerType (Type type, std::optional< Location > loc={}, llvm::function_ref< hw::TypeAliasType(Type, BaseTypeAliasType, Location)> getTypeDeclFn={})
 Given a type, return the corresponding lowered type for the HW dialect.
std::pair< bool, std::optional< mlir::LocationAttr > > maybeStringToLocation (StringRef spelling, bool skipParsing, StringAttr &locatorFilenameCache, FileLineColLoc &fileLineColLocCache, MLIRContext *context)
 Parse a string that may encode a FIRRTL location into a LocationAttr.
mlir::ParseResult parseFormatString (mlir::OpBuilder &builder, mlir::Location loc, llvm::StringRef formatString, llvm::ArrayRef< mlir::Value > specOperands, mlir::StringAttr &formatStringResult, llvm::SmallVectorImpl< mlir::Value > &operands)
PathOp createPathRef (Operation *op, hw::HierPathOp nla, mlir::ImplicitLocOpBuilder &builderOM)
 Add the tracker annotation to the op and get a PathOp to the op.
bool importAnnotationsFromJSONRaw (llvm::json::Value &value, SmallVectorImpl< Attribute > &annotations, llvm::json::Path path, MLIRContext *context)
 Deserialize a JSON value into FIRRTL Annotations.
void runCombMemsToRegOfVec (FModuleOp mod, bool ignoreReadEnable, unsigned &numConverted)
LogicalResult runFullReset (CircuitOp circuit, InstanceGraph &ig, InstanceInfo &instanceInfo, bool convertAsyncDomainMems=false)
LogicalResult stripDomainsFromCircuit (CircuitOp circuit, llvm::function_ref< bool(StringAttr)> shouldStripDomain)
 Strip domains whose names match the predicate from a circuit.

Variables

constexpr const char * rawAnnotations = "rawAnnotations"
constexpr FIRVersion missingSpecFIRVersion = nextFIRVersion
 A marker for parser features that are currently missing from the spec.
constexpr FIRVersion exportFIRVersion = nextFIRVersion
 The version of FIRRTL that the exporter produces.
static AnnoRecord NoTargetAnnotation
 Resolution and application of a "firrtl.annotations.NoTargetAnnotation".
static llvm::StringMap< AnnoRecord > annotationRecords

Typedef Documentation

◆ FIRRTLBaseValue

Definition at line 404 of file FIRRTLTypes.h.

◆ FIRRTLPropertyValue

Definition at line 405 of file FIRRTLTypes.h.

◆ FIRRTLValue

using circt::firrtl::FIRRTLValue = mlir::TypedValue<FIRRTLType>

Definition at line 403 of file FIRRTLTypes.h.

◆ GetNamespaceCallback

Initial value:

Definition at line 196 of file FIRRTLUtils.h.

◆ InstanceGraphNode

◆ InstancePathCache

◆ InstanceRecord

◆ LayerSet

using circt::firrtl::LayerSet = SmallSet<SymbolRefAttr, 4, LayerSetCompare>

Definition at line 43 of file LayerSet.h.

◆ WalkDriverCallback

Initial value:
llvm::function_ref<bool(const FieldRef &dst, const FieldRef &src)>
This class represents a reference to a specific field or element of an aggregate value.
Definition FieldRef.h:28

Walk all the drivers of a value, passing in the connect operations drive the value.

If the value is an aggregate it will find connects to subfields. If the callback returns false, this function will stop walking. Returns false if walking was broken, and true otherwise.

Definition at line 130 of file FIRRTLUtils.h.

Enumeration Type Documentation

◆ CompanionMode

enum class circt::firrtl::CompanionMode
strong
Enumerator
Bind 
Instantiate 
Drop 

Definition at line 68 of file Passes.h.

◆ ConnectBehaviorKind

Enumerator
LastConnect 

Classic FIRRTL connections: last connect 'wins' across paths; conditionally applied under 'when'.

StaticSingleConnect 

Exclusive connection to the destination, unconditional.

Definition at line 88 of file FIRRTLOpInterfaces.h.

◆ DeclKind

enum class circt::firrtl::DeclKind
strong
Enumerator
Port 
Instance 
Other 

Definition at line 86 of file FIRRTLOps.h.

◆ Direction

enum class circt::firrtl::Direction
strong

This represents the direction of a single port.

Enumerator
In 
Out 

Definition at line 27 of file FIRRTLEnums.h.

◆ EdgeKind

enum class circt::firrtl::EdgeKind
strong
Enumerator
Alias 
Gate 
InstanceIn 
InstanceOut 

Definition at line 23 of file GatedClockConversion.h.

◆ Flow

enum class circt::firrtl::Flow : uint8_t
strong
Enumerator
None 
Source 
Sink 
Duplex 

Definition at line 60 of file FIRRTLOps.h.

◆ InferDomainsMode

The mode for the InferDomains pass.

Enumerator
Check 

Check domains without inference.

Infer 

Check domains with inference for private modules.

InferAll 

Check domains with inference for both public and private modules.

Definition at line 79 of file Passes.h.

◆ ReadPortSubfield

Enumerator
addr 
en 
clk 
data 

Definition at line 90 of file FIRRTLOps.h.

◆ ReadWritePortSubfield

Enumerator
addr 
en 
clk 
rdata 
wmode 
wdata 
wmask 

Definition at line 92 of file FIRRTLOps.h.

◆ VerificationFlavor

Enumerator
None 
IfElseFatal 
Immediate 
SVA 

Definition at line 26 of file FIRRTLToHW.h.

◆ WritePortSubfield

Enumerator
addr 
en 
clk 
data 
mask 

Definition at line 91 of file FIRRTLOps.h.

Function Documentation

◆ applyGCTDataTaps()

LogicalResult circt::firrtl::applyGCTDataTaps ( const AnnoPathValue & target,
DictionaryAttr anno,
ApplyState & state )

◆ applyGCTMemTaps()

◆ applyGCTView()

◆ applyTraceName()

LogicalResult circt::firrtl::applyTraceName ( const AnnoPathValue & target,
DictionaryAttr anno,
ApplyState & state )

Expand a TraceNameAnnotation (which has don't touch semantics) into a TraceAnnotation (which does NOT have don't touch semantics) and separate DontTouchAnnotations for targets that are not modules, external modules, or instances (as these targets are not valid for a don't touch).

Definition at line 46 of file ResolveTraces.cpp.

References circt::firrtl::ApplyState::addToWorklistFn, context, circt::firrtl::AnnoPathValue::isOpOfType(), and success().

◆ applyWiring()

◆ applyWithoutTarget() [1/3]

template<bool allowNonLocal = false>
LogicalResult circt::firrtl::applyWithoutTarget ( const AnnoPathValue & target,
DictionaryAttr anno,
ApplyState & state )
static

An applier which puts the annotation on the target and drops the 'target' field from the annotaiton.

Optionally handles non-local annotations.

Definition at line 510 of file FIRRTLAnnotationHelper.h.

References applyWithoutTargetImpl().

◆ applyWithoutTarget() [2/3]

template<bool allowNonLocal, typename T, typename... Tr>
LogicalResult circt::firrtl::applyWithoutTarget ( const AnnoPathValue & target,
DictionaryAttr anno,
ApplyState & state )
static

Definition at line 500 of file FIRRTLAnnotationHelper.h.

References applyWithoutTarget().

◆ applyWithoutTarget() [3/3]

template<bool allowNonLocal, bool allowPortAnnoTarget, typename T, typename... Tr>
LogicalResult circt::firrtl::applyWithoutTarget ( const AnnoPathValue & target,
DictionaryAttr anno,
ApplyState & state )
static

An applier which puts the annotation on the target and drops the 'target' field from the annotation.

Optionally handles non-local annotations. Ensures the target resolves to an expected type of operation.

Definition at line 487 of file FIRRTLAnnotationHelper.h.

References applyWithoutTargetImpl(), failure(), circt::firrtl::AnnoPathValue::isOpOfType(), and circt::firrtl::AnnoPathValue::ref.

Referenced by applyWithoutTarget(), convertToExcludeFromFullResetAnnotation(), and convertToFullResetAnnotation().

◆ applyWithoutTargetImpl()

LogicalResult circt::firrtl::applyWithoutTargetImpl ( const AnnoPathValue & target,
DictionaryAttr anno,
ApplyState & state,
bool allowNonLocal )

===-------------------------------------------------------------------—===// Standard Utility Appliers ===-------------------------------------------------------------------—===//

An applier which puts the annotation on the target and drops the 'target' field from the annotation.

An applier which puts the annotation on the target and drops the 'target' field from the annotation. Optionally handles non-local annotations.

Optionally handles non-local annotations.

Definition at line 202 of file LowerAnnotations.cpp.

References addAnnotation(), failure(), circt::firrtl::AnnoPathValue::fieldIdx, circt::firrtl::Annotation::getClass(), circt::firrtl::Annotation::getMember(), circt::firrtl::AnnoTarget::getOp(), circt::firrtl::AnnoPathValue::isLocal(), circt::firrtl::AnnoPathValue::ref, scatterNonLocalPath(), and success().

Referenced by applyWithoutTarget().

◆ areAnonymousTypesEquivalent() [1/2]

bool circt::firrtl::areAnonymousTypesEquivalent ( FIRRTLBaseType lhs,
FIRRTLBaseType rhs )

Return true if anonymous types of given arguments are equivalent by pointer comparison.

Definition at line 1306 of file FIRRTLTypes.cpp.

References circt::firrtl::FIRRTLBaseType::getAnonymousType().

Referenced by areAnonymousTypesEquivalent().

◆ areAnonymousTypesEquivalent() [2/2]

bool circt::firrtl::areAnonymousTypesEquivalent ( mlir::Type lhs,
mlir::Type rhs )

Definition at line 1311 of file FIRRTLTypes.cpp.

References areAnonymousTypesEquivalent(), and type_dyn_cast().

◆ areTypesConstCastable()

bool circt::firrtl::areTypesConstCastable ( FIRRTLType destType,
FIRRTLType srcType,
bool srcOuterTypeIsConst = false )

Returns whether the srcType can be const-casted to the destType.

Definition at line 1117 of file FIRRTLTypes.cpp.

References areTypesConstCastable(), and type_dyn_cast().

Referenced by areTypesConstCastable(), and emitConnect().

◆ areTypesEquivalent()

bool circt::firrtl::areTypesEquivalent ( FIRRTLType destFType,
FIRRTLType srcFType,
bool destOuterTypeIsConst = false,
bool srcOuterTypeIsConst = false,
bool requireSameWidths = false )

Returns whether the two types are equivalent.

This implements the exact definition of type equivalence in the FIRRTL spec. If the types being compared have any outer flips that encode FIRRTL module directions (input or output), these should be stripped before using this method.

Definition at line 1027 of file FIRRTLTypes.cpp.

References areBundleElementsEquivalent(), areTypesEquivalent(), circt::firrtl::FIRRTLType::isConst(), type_dyn_cast(), and type_isa().

Referenced by areBundleElementsEquivalent(), areTypesEquivalent(), and circt::firrtl::IntrinsicLowerings::lower().

◆ areTypesRefCastable()

bool circt::firrtl::areTypesRefCastable ( Type dstType,
Type srcType )

Return true if destination ref type can be cast from source ref type, per FIRRTL spec rules they must be identical or destination has more general versions of the corresponding type in the source.

Definition at line 1178 of file FIRRTLTypes.cpp.

References assert(), type_dyn_cast(), and type_isa().

◆ areTypesWeaklyEquivalent()

bool circt::firrtl::areTypesWeaklyEquivalent ( FIRRTLType destType,
FIRRTLType srcType,
bool destFlip = false,
bool srcFlip = false,
bool destOuterTypeIsConst = false,
bool srcOuterTypeIsConst = false )

Returns true if two types are weakly equivalent.

See the FIRRTL spec, Section 4.6, for a full definition of this. Roughly, the oriented types (the types with any flips pushed to the leaves) must match. This allows for types with flips in different positions to be equivalent.

◆ canonicalizeTarget()

std::string circt::firrtl::canonicalizeTarget ( StringRef target)

Return an input target string in canonical form.

This converts a Legacy Annotation (e.g., A.B.C) into a modern annotation (e.g., ~A|B>C). Trailing subfield/subindex references are preserved.

Definition at line 140 of file FIRRTLAnnotationHelper.cpp.

Referenced by applyGCTMemTaps(), resolvePath(), and stdResolveImpl().

◆ containsConst()

bool circt::firrtl::containsConst ( Type type)

Returns true if the type is or contains a 'const' type whose value is guaranteed to be unchanging at circuit execution time.

Definition at line 967 of file FIRRTLTypes.cpp.

Referenced by circt::firrtl::FIRRTLBaseType::isRegisterType().

◆ createPathRef()

PathOp circt::firrtl::createPathRef ( Operation * op,
hw::HierPathOp nla,
mlir::ImplicitLocOpBuilder & builderOM )

Add the tracker annotation to the op and get a PathOp to the op.

Definition at line 1125 of file FIRRTLUtils.cpp.

References circt::firrtl::AnnotationSet::addAnnotations(), circt::firrtl::AnnotationSet::applyToOperation(), and context.

◆ emitConnect() [1/3]

void circt::firrtl::emitConnect ( ImplicitLocOpBuilder & builder,
Value lhs,
Value rhs,
bool warnOnTruncation = false )

Definition at line 49 of file FIRRTLUtils.cpp.

References emitConnect().

◆ emitConnect() [2/3]

void circt::firrtl::emitConnect ( ImplicitLocOpBuilder & builder,
Value lhs,
Value rhs,
llvm::function_ref< Location()> getDiagLoc,
bool warnOnTruncation = false )

◆ emitConnect() [3/3]

void circt::firrtl::emitConnect ( OpBuilder & builder,
Location loc,
Value lhs,
Value rhs,
bool warnOnTruncation = false )

◆ exportFIRFile()

mlir::LogicalResult circt::firrtl::exportFIRFile ( mlir::ModuleOp module,
llvm::raw_ostream & os,
std::optional< size_t > targetLineLength,
FIRVersion version )

Definition at line 2071 of file FIREmitter.cpp.

References minimumFIRVersion().

Referenced by mlirExportFIRRTL(), and registerToFIRFileTranslation().

◆ foldFlow()

Flow circt::firrtl::foldFlow ( Value val,
Flow accumulatedFlow = Flow::Source )

Compute the flow for a Value, val, as determined by the FIRRTL specification.

This recursively walks backwards from val to the declaration. The resulting flow is a combination of the declaration flow (output ports and instance inputs are sinks, registers and wires are duplex, anything else is a source) and the number of intermediary flips. An even number of flips will result in the same flow as the declaration. An odd number of flips will result in reversed flow being returned. The reverse of source is sink. The reverse of sink is source. The reverse of duplex is duplex. The accumulatedFlow parameter sets the initial flow. A user should normally not have to change this from its default of Flow::Source.

Definition at line 174 of file FIRRTLOps.cpp.

References Duplex, foldFlow(), In, None, Out, Sink, Source, swapFlow(), and type_isa().

Referenced by checkConnectFlow(), circt::firrtl::FieldSource::FieldSource(), firrtlValueFoldFlow(), foldFlow(), circt::firrtl::FieldSource::visitInst(), circt::firrtl::FieldSource::visitInstChoice(), circt::firrtl::FieldSource::visitMem(), circt::firrtl::FieldSource::visitOp(), circt::firrtl::FieldSource::visitOpenSubfield(), circt::firrtl::FieldSource::visitOpenSubindex(), circt::firrtl::FieldSource::visitSubaccess(), circt::firrtl::FieldSource::visitSubfield(), and circt::firrtl::FieldSource::visitSubindex().

◆ getAnnotationAttrName()

StringRef circt::firrtl::getAnnotationAttrName ( )
inline

Return the name of the attribute used for annotations on FIRRTL ops.

Definition at line 37 of file FIRRTLAnnotations.h.

Referenced by addAnnotation(), circt::firrtl::AnnotationSet::applyToOperation(), getAnnotationsFrom(), and getAnnotationsIfPresent().

◆ getAnnotationsIfPresent()

ArrayAttr circt::firrtl::getAnnotationsIfPresent ( Operation * op)
inline

◆ getBaseOfType()

template<typename T>
T circt::firrtl::getBaseOfType ( Type type)
inline

Get base type if isa<> the requested type, else null.

Definition at line 283 of file FIRRTLUtils.h.

References getBaseType().

◆ getBaseType()

FIRRTLBaseType circt::firrtl::getBaseType ( Type type)
inline

If it is a base type, return it as is.

If reftype, return wrapped base type. Otherwise, return null.

Definition at line 273 of file FIRRTLUtils.h.

Referenced by getBaseOfType(), isUselessVec(), DiscoverLoops::recordDataflow(), ResolveTracesPass::updatePortTarget(), ResolveTracesPass::updateTarget(), and walkGroundTypes().

◆ getBitWidth()

◆ getDeclarationKind()

DeclKind circt::firrtl::getDeclarationKind ( Value val)

Definition at line 251 of file FIRRTLOps.cpp.

References getDeclarationKind(), Instance, Other, and Port.

Referenced by checkConnectFlow(), and getDeclarationKind().

◆ getDeltaRef()

FieldRef circt::firrtl::getDeltaRef ( Value value,
bool lookThroughCasts = false )

Get the delta indexing from a value, as a FieldRef.

Definition at line 557 of file FIRRTLUtils.cpp.

Referenced by circt::firrtl::FieldRefCache::getFieldRefFromValue(), and getFieldRefFromValue().

◆ getDriverFromConnect()

Value circt::firrtl::getDriverFromConnect ( Value val)

Return the module-scoped driver of a value only looking through one connect.

Return the value that drives another FIRRTL value within module scope.

Only look backwards through one connection. This is intended to be used in situations where you only need to look at the most recent connect, e.g., to know if a wire has been driven to a constant. Return null if no driver via a connect was found.

Definition at line 267 of file FIRRTLUtils.cpp.

Referenced by LowerLayersPass::runOnModuleBody().

◆ getFieldName()

std::pair< std::string, bool > circt::firrtl::getFieldName ( const FieldRef & fieldRef,
bool nameSafe = false )

Get a string identifier representing the FieldRef.

Return this string and a boolean indicating if a valid "root" for the identifier was found. If nameSafe is true, this will generate a string that is better suited for naming something in the IR. E.g., if the fieldRef is a subfield of a subindex, without name safe the output would be:

foo[42].bar

With nameSafe, this would be:

foo_42_bar

Definition at line 652 of file FIRRTLUtils.cpp.

References getDeclName(), circt::FieldRef::getFieldID(), circt::FieldRef::getValue(), and type_dyn_cast().

Referenced by Equivalence::check(), checkConnectFlow(), DiscoverLoops::getName(), LowerLayersPass::runOnModuleBody(), and LowerXMRPass::runOnOperation().

◆ getFieldRefForTarget()

FieldRef circt::firrtl::getFieldRefForTarget ( const hw::InnerSymTarget & ist)

Get FieldRef pointing to the specified inner symbol target, which must be valid.

Returns null FieldRef if target points to something with no value, such as a port of an external module.

Definition at line 833 of file FIRRTLUtils.cpp.

References assert(), circt::hw::InnerSymTarget::getField(), circt::hw::InnerSymTarget::getOp(), circt::hw::InnerSymTarget::getPort(), and circt::hw::InnerSymTarget::isPort().

◆ getFieldRefFromValue()

FieldRef circt::firrtl::getFieldRefFromValue ( Value value,
bool lookThroughCasts = false )

Get the FieldRef from a value.

This will travel backwards to through the IR, following Subfield and Subindex to find the op which declares the location. Optionally look through recognized cast operations, which likely will result in source having slightly different type.

Definition at line 583 of file FIRRTLUtils.cpp.

References getDeltaRef().

Referenced by Equivalence::check(), checkConnectFlow(), getAmbientLayersFor(), LowerXMRPass::runOnOperation(), circt::firrtl::FieldRefCache::verifyImpl(), and walkDrivers().

◆ getInnerRefTo() [1/5]

hw::InnerRefAttr circt::firrtl::getInnerRefTo ( const hw::InnerSymTarget & target,
GetNamespaceCallback getNamespace )

Obtain an inner reference to the target (operation or port), adding an inner symbol as necessary.

Obtain an inner reference to an operation, possibly adding an inner_sym to that operation.

Definition at line 916 of file FIRRTLUtils.cpp.

References assert(), circt::hw::InnerSymTarget::getOp(), getOrAddInnerSym(), and circt::hw::InnerSymTarget::isPort().

Referenced by getInnerRefTo(), getInnerRefTo(), getInnerRefTo(), getInnerRefTo(), LowerXMRPass::getInnerRefTo(), LowerXMRPass::handleInstanceOp(), LowerLayersPass::runOnModuleBody(), and ResolveTracesPass::runOnOperation().

◆ getInnerRefTo() [2/5]

hw::InnerRefAttr circt::firrtl::getInnerRefTo ( FModuleLike mod,
size_t portIdx,
GetNamespaceCallback getNamespace )
inlinestatic

Obtain an inner reference to a port, possibly adding an inner symbol.

Definition at line 254 of file FIRRTLUtils.h.

References getInnerRefTo().

◆ getInnerRefTo() [3/5]

hw::InnerRefAttr circt::firrtl::getInnerRefTo ( FModuleLike mod,
size_t portIdx,
uint64_t fieldID,
GetNamespaceCallback getNamespace )
inlinestatic

Obtain an inner reference to a port's field, possibly adding an inner symbol.

Definition at line 262 of file FIRRTLUtils.h.

References getInnerRefTo().

◆ getInnerRefTo() [4/5]

hw::InnerRefAttr circt::firrtl::getInnerRefTo ( Operation * op,
GetNamespaceCallback getNamespace )
inlinestatic

Obtain an inner reference to an operation, possibly adding an inner symbol.

Definition at line 224 of file FIRRTLUtils.h.

References getInnerRefTo().

◆ getInnerRefTo() [5/5]

hw::InnerRefAttr circt::firrtl::getInnerRefTo ( Operation * op,
uint64_t fieldID,
GetNamespaceCallback getNamespace )
inlinestatic

Obtain an inner reference to an operation's field, possibly adding an inner symbol.

Definition at line 231 of file FIRRTLUtils.h.

References getInnerRefTo().

◆ getInnerSymName()

StringAttr circt::firrtl::getInnerSymName ( Operation * op)
inline

Return the StringAttr for the inner_sym name, if it exists.

Definition at line 108 of file FIRRTLOps.h.

References circt::hw::InnerSymbolTable::getInnerSymbolAttrName().

Referenced by addHierarchy(), findInstanceInNLA(), and circt::firrtl::NLATable::getInstanceNLAs().

◆ getIntAttr()

IntegerAttr circt::firrtl::getIntAttr ( Type type,
const APInt & value )

Utiility for generating a constant attribute.

Definition at line 210 of file FIRRTLUtils.cpp.

References assert(), and type_cast().

Referenced by constFoldFIRRTLBinaryOp(), foldMux(), getIntOnesAttr(), and getIntZerosAttr().

◆ getIntOnesAttr()

IntegerAttr circt::firrtl::getIntOnesAttr ( Type type)

Utility for generating a constant all ones attribute.

Return an IntegerAttr filled with ones for the specified FIRRTL integer type.

This handles both the known width and unknown width case.

Definition at line 231 of file FIRRTLUtils.cpp.

References getIntAttr(), and type_cast().

◆ getIntZerosAttr()

IntegerAttr circt::firrtl::getIntZerosAttr ( Type type)

Utility for generating a constant zero attribute.

Return an IntegerAttr filled with zeros for the specified FIRRTL integer type.

This handles both the known width and unknown width case.

Definition at line 224 of file FIRRTLUtils.cpp.

References getIntAttr(), and type_cast().

Referenced by LowerXMRPass::handleRefResolve(), LowerLayersPass::runOnModuleBody(), and SFCCompatPass::runOnOperation().

◆ getModuleScopedDriver()

Value circt::firrtl::getModuleScopedDriver ( Value val,
bool lookThroughWires,
bool lookThroughNodes,
bool lookThroughCasts )

Return the value that drives another FIRRTL value within module scope.

This is parameterized by looking through or not through certain constructs. This assumes a single driver and should only be run after ExpandWhens.

Definition at line 278 of file FIRRTLUtils.cpp.

References In, lookThroughWires(), and Out.

Referenced by circt::firrtl::GatedClockConversion::analyzeFrom(), and isModuleScopedDrivenBy().

◆ getNumPorts()

size_t circt::firrtl::getNumPorts ( Operation * op)

Return the number of ports in a module-like thing (modules, memories, etc).

Definition at line 263 of file FIRRTLOps.cpp.

Referenced by addAnnotation(), getPortListImpl(), Deduper::mergeAnnotations(), Deduper::record(), and resolveEntities().

◆ getOrAddInnerSym() [1/7]

StringAttr circt::firrtl::getOrAddInnerSym ( const hw::InnerSymTarget & target,
GetNamespaceCallback getNamespace )

Returns an inner symbol identifier for the specified target (op or port), adding one if necessary.

Definition at line 899 of file FIRRTLUtils.cpp.

References assert(), getOrAddInnerSym(), and circt::hw::InnerSymTarget::isPort().

◆ getOrAddInnerSym() [2/7]

StringAttr circt::firrtl::getOrAddInnerSym ( const hw::InnerSymTarget & target,
llvm::function_ref< hw::InnerSymbolNamespace &()> getNamespace )

Returns an inner symbol identifier for the specified target (op or port), adding one if necessary.

Definition at line 871 of file FIRRTLUtils.cpp.

References assert(), circt::hw::InnerSymTarget::getField(), circt::hw::InnerSymTarget::getOp(), getOrAddInnerSym(), circt::hw::InnerSymTarget::getPort(), and circt::hw::InnerSymTarget::isPort().

◆ getOrAddInnerSym() [3/7]

StringAttr circt::firrtl::getOrAddInnerSym ( FModuleLike mod,
size_t portIdx,
GetNamespaceCallback getNamespace )
inlinestatic

Returns an inner symbol identifier for the specified port, adding one if necessary.

Definition at line 238 of file FIRRTLUtils.h.

References getOrAddInnerSym().

◆ getOrAddInnerSym() [4/7]

StringAttr circt::firrtl::getOrAddInnerSym ( FModuleLike mod,
size_t portIdx,
uint64_t fieldID,
GetNamespaceCallback getNamespace )
inlinestatic

Returns an inner symbol identifier for the specified port's field, adding one if necessary.

Definition at line 245 of file FIRRTLUtils.h.

References getOrAddInnerSym().

◆ getOrAddInnerSym() [5/7]

std::pair< hw::InnerSymAttr, StringAttr > circt::firrtl::getOrAddInnerSym ( MLIRContext * context,
hw::InnerSymAttr attr,
uint64_t fieldID,
llvm::function_ref< hw::InnerSymbolNamespace &()> getNamespace )

Ensure that the the InnerSymAttr has a symbol on the field specified.

Returns the updated InnerSymAttr as well as the name of the symbol attached to the specified field.

Definition at line 849 of file FIRRTLUtils.cpp.

References context.

Referenced by getInnerRefTo(), getOrAddInnerSym(), getOrAddInnerSym(), getOrAddInnerSym(), getOrAddInnerSym(), getOrAddInnerSym(), and getOrAddInnerSym().

◆ getOrAddInnerSym() [6/7]

StringAttr circt::firrtl::getOrAddInnerSym ( Operation * op,
GetNamespaceCallback getNamespace )
inlinestatic

Returns an inner symbol identifier for the specified operation, adding one if necessary.

Definition at line 211 of file FIRRTLUtils.h.

References getOrAddInnerSym().

◆ getOrAddInnerSym() [7/7]

StringAttr circt::firrtl::getOrAddInnerSym ( Operation * op,
uint64_t fieldID,
GetNamespaceCallback getNamespace )
inlinestatic

Returns an inner symbol identifier for the specified operation's field adding one if necessary.

Definition at line 217 of file FIRRTLUtils.h.

References getOrAddInnerSym().

◆ getPassiveType()

mlir::Type circt::firrtl::getPassiveType ( mlir::Type anyBaseFIRRTLType)

◆ getPortAnnotationAttrName()

StringRef circt::firrtl::getPortAnnotationAttrName ( )
inline

Return the name of the attribute used for port annotations on FIRRTL ops.

Definition at line 40 of file FIRRTLAnnotations.h.

Referenced by addAnnotation(), applyToPort(), and forPort().

◆ getPropertyAssignment()

PropAssignOp circt::firrtl::getPropertyAssignment ( FIRRTLPropertyValue value)

Return the single assignment to a Property value.

It is assumed that the single assigment invariant is enforced elsewhere.

Definition at line 250 of file FIRRTLUtils.cpp.

Referenced by updateInstanceInClass().

◆ getSingleConnectUserOf()

MatchingConnectOp circt::firrtl::getSingleConnectUserOf ( Value value)

Scan all the uses of the specified value, checking to see if there is exactly one connect that has the value as its destination.

This returns the operation if found and if all the other users are "reads" from the value. Returns null if there are no connects, or multiple connects to the value, or if the value is involved in an AttachOp.

Note that this will simply return the connect, which is located anywhere after the definition of the value. Users of this function are likely interested in the source side of the returned connect, the definition of which does likely not dominate the original value.

This returns the operation if found and if all the other users are "reads" from the value. Returns null if there are no connects, or multiple connects to the value, or if the value is involved in an AttachOp, or if the connect isn't matching.

Note that this will simply return the connect, which is located anywhere after the definition of the value. Users of this function are likely interested in the source side of the returned connect, the definition of which does likely not dominate the original value.

Definition at line 2314 of file FIRRTLFolds.cpp.

Referenced by canonicalizeSingleSetConnect(), foldHiddenReset(), and getPortFieldValue().

◆ getTargetFor()

hw::InnerSymTarget circt::firrtl::getTargetFor ( FieldRef ref)

Return the inner sym target for the specified value and fieldID.

If root is a blockargument, this must be FModuleLike.

Definition at line 821 of file FIRRTLUtils.cpp.

References circt::FieldRef::getFieldID(), and circt::FieldRef::getValue().

◆ getValueByFieldID()

Value circt::firrtl::getValueByFieldID ( ImplicitLocOpBuilder builder,
Value value,
unsigned fieldID )

This gets the value targeted by a field id.

If the field id is targeting the value itself, it returns it unchanged. If it is targeting a single field in a aggregate value, such as a bundle or vector, this will create the necessary subaccesses to get the value.

Definition at line 726 of file FIRRTLUtils.cpp.

References circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::Case().

Referenced by applyWiring(), lowerModuleBody(), and lowerModuleSignature().

◆ getValueSource()

Value circt::firrtl::getValueSource ( Value val,
bool lookThroughWires,
bool lookThroughNodes,
bool lookThroughCasts )

Return the value that drives another FIRRTL value within module scope.

This is parameterized by looking through or not through certain constructs.

References lookThroughWires().

◆ hasDontTouch() [1/2]

bool circt::firrtl::hasDontTouch ( Operation * op)

Check whether an operation has a DontTouch annotation, or a symbol that should prevent certain types of canonicalizations.

Definition at line 271 of file FIRRTLOps.cpp.

References circt::hw::InnerSymbolTable::getInnerSymbolAttrName(), and circt::firrtl::AnnotationSet::hasDontTouch().

◆ hasDontTouch() [2/2]

bool circt::firrtl::hasDontTouch ( Value value)

Check whether a block argument ("port") or the operation defining a value has a DontTouch annotation, or a symbol that should prevent certain types of canonicalizations.

Definition at line 279 of file FIRRTLOps.cpp.

References circt::firrtl::AnnotationSet::forPort(), circt::firrtl::AnnotationSet::hasDontTouch(), and hasDontTouch().

Referenced by canErase(), canonicalizeSingleSetConnect(), hasDontTouch(), isDeletableDeclaration(), and isDeletableWireOrRegOrNode().

◆ hasDroppableName()

bool circt::firrtl::hasDroppableName ( Operation * op)

Return true if the name is droppable.

Note that this is different from isUselessName because non-useless names may be also droppable.

Definition at line 147 of file FIRRTLFolds.cpp.

Referenced by canonicalizeSingleSetConnect(), and isDeletableWireOrRegOrNode().

◆ hash_value()

llvm::hash_code circt::firrtl::hash_value ( const ClassElement & element)
inline

◆ hasHardwareElements()

bool circt::firrtl::hasHardwareElements ( FIRRTLType type)

Return true if the given type contains any elements of hardware types.

Definition at line 1340 of file FIRRTLTypes.cpp.

References hasHardwareElements().

Referenced by hasHardwareElements().

◆ hasZeroBitWidth()

bool circt::firrtl::hasZeroBitWidth ( FIRRTLType type)

Return true if the type has zero bit width.

Definition at line 975 of file FIRRTLTypes.cpp.

References circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::Case(), getBitWidth(), and hasZeroBitWidth().

Referenced by hasZeroBitWidth(), and isPreservableAggregateType().

◆ importAnnotationsFromJSONRaw()

bool circt::firrtl::importAnnotationsFromJSONRaw ( llvm::json::Value & value,
SmallVectorImpl< Attribute > & annotations,
llvm::json::Path path,
MLIRContext * context )

Deserialize a JSON value into FIRRTL Annotations.

Annotations are represented as a Target-keyed arrays of attributes. The input JSON value is checked, at runtime, to be an array of objects. Returns true if successful, false if unsuccessful.

References context.

Referenced by firrtlImportAnnotationsFromJSONRaw().

◆ importFIRFile()

mlir::OwningOpRef< mlir::ModuleOp > circt::firrtl::importFIRFile ( llvm::SourceMgr & sourceMgr,
mlir::MLIRContext * context,
mlir::TimingScope & ts,
FIRParserOptions options = {} )

References context.

Referenced by registerFromFIRFileTranslation().

◆ isConst()

bool circt::firrtl::isConst ( Type type)

Returns true if this is a 'const' type whose value is guaranteed to be unchanging at circuit execution time.

Definition at line 960 of file FIRRTLTypes.cpp.

Referenced by checkConnectConditionality(), customTypeParser(), customTypePrinter(), firrtlTypeGetConstType(), and MLIR_DEFINE_CAPI_DIALECT_REGISTRATION().

◆ isConstant() [1/2]

bool circt::firrtl::isConstant ( Operation * op)

Return true if the specified operation has a constant value.

This trivially checks for firrtl.constant and friends, but also looks through subaccesses and correctly handles wires driven with only constant values.

Definition at line 5369 of file FIRRTLOps.cpp.

Referenced by circt::firrtl::InstanceInfo::LatticeValue::getConstant(), isConstant(), isConstantLike(), and circt::firrtl::InstanceInfo::LatticeValue::mergeIn().

◆ isConstant() [2/2]

bool circt::firrtl::isConstant ( Value value)

Return true if the specified value is a constant.

This trivially checks for firrtl.constant and friends, but also looks through subaccesses and correctly handles wires driven with only constant values.

Definition at line 5402 of file FIRRTLOps.cpp.

References isConstant().

◆ isDuplexValue()

bool circt::firrtl::isDuplexValue ( Value val)

Returns true if the value results from an expression with duplex flow.

Duplex values have special treatment in bundle connect operations, and their flip orientation is not used to determine the direction of each pairwise connect.

Definition at line 64 of file FIRRTLOps.cpp.

◆ isExpression()

bool circt::firrtl::isExpression ( Operation * op)

Return true if the specified operation is a firrtl expression.

Definition at line 4711 of file FIRRTLOps.cpp.

References circt::firrtl::ExprVisitor< ConcreteType, ResultType, ExtraArgs >::dispatchExprVisitor().

Referenced by isEmittedInline().

◆ isModuleScopedDrivenBy()

template<typename A, typename... B>
bool circt::firrtl::isModuleScopedDrivenBy ( Value val,
bool lookThroughWires,
bool lookThroughNodes,
bool lookThroughCasts )
static

Return true if a value is module-scoped driven by a value of a specific type.

Definition at line 110 of file FIRRTLUtils.h.

References getModuleScopedDriver(), and lookThroughWires().

◆ isTypeInOut()

bool circt::firrtl::isTypeInOut ( mlir::Type type)

Returns true if the given type has some flipped (aka unaligned) dataflow.

This will be true if the port contains either bi-directional signals or analog types. Non-HW types (e.g., ref types) are never considered InOut.

Referenced by circt::firrtl::ClassElement::isInOut(), and circt::firrtl::PortInfo::isInOut().

◆ isTypeLarger()

bool circt::firrtl::isTypeLarger ( FIRRTLBaseType dstType,
FIRRTLBaseType srcType )

Returns true if the destination is at least as wide as a source.

Returns true if the destination is at least as wide as an equivalent source.

The source and destination types must be equivalent non-analog types. The types are recursively connected to ensure that the destination is larger than the source: ground types are compared on width, vector types are checked recursively based on their elements and bundles are compared field-by-field. Types with unresolved widths are assumed to fit into or hold their counterparts.

Definition at line 1277 of file FIRRTLTypes.cpp.

References circt::firrtl::FIRRTLBaseType::getBitWidthOrSentinel(), circt::firrtl::FIRRTLBaseType::getPassiveType(), isTypeLarger(), and type_cast().

Referenced by isTypeLarger(), and circt::firrtl::IntrinsicLowerings::lower().

◆ isValidDst()

bool circt::firrtl::isValidDst ( Flow flow)
constexpr

Definition at line 69 of file FIRRTLOps.h.

References Sink.

Referenced by checkConnectFlow().

◆ isValidSrc()

bool circt::firrtl::isValidSrc ( Flow flow)
constexpr

Definition at line 65 of file FIRRTLOps.h.

References Source.

Referenced by checkConnectFlow().

◆ lowerType()

Type circt::firrtl::lowerType ( Type type,
std::optional< Location > loc = {},
llvm::function_ref< hw::TypeAliasType(Type, BaseTypeAliasType, Location)> getTypeDeclFn = {} )

Given a type, return the corresponding lowered type for the HW dialect.

Non-FIRRTL types are simply passed through. This returns a null type if it cannot be lowered. The optional function is required to specify how to lower AliasTypes.

Non-FIRRTL types are simply passed through. This returns a null type if it cannot be lowered.

Definition at line 1051 of file FIRRTLUtils.cpp.

References lowerType(), type_dyn_cast(), and type_isa().

Referenced by convertToUnpackedArray(), getLowered(), lowerDPIArgumentType(), lowerType(), and tryEliminatingAttachesToAnalogValue().

◆ mapBaseType()

FIRRTLType circt::firrtl::mapBaseType ( FIRRTLType type,
function_ref< FIRRTLBaseType(FIRRTLBaseType)> fn )
inline

Return a FIRRTLType with its base type component mutated by the given function.

(i.e., ref<T> -> ref<f(T)> and T -> f(T)).

Definition at line 289 of file FIRRTLUtils.h.

Referenced by mapLoweredType().

◆ mapBaseTypeNullable()

FIRRTLType circt::firrtl::mapBaseTypeNullable ( FIRRTLType type,
function_ref< FIRRTLBaseType(FIRRTLBaseType)> fn )
inline

Return a FIRRTLType with its base type component mutated by the given function.

Return null when the function returns null. (i.e., ref<T> -> ref<f(T)> if f(T) != null else null, and T -> f(T)).

Definition at line 303 of file FIRRTLUtils.h.

◆ maybeStringToLocation() [1/2]

std::pair< bool, std::optional< mlir::LocationAttr > > circt::firrtl::maybeStringToLocation ( llvm::StringRef spelling,
bool skipParsing,
mlir::StringAttr & locatorFilenameCache,
FileLineColLoc & fileLineColLocCache,
MLIRContext * context )

References context.

◆ maybeStringToLocation() [2/2]

std::pair< bool, std::optional< mlir::LocationAttr > > circt::firrtl::maybeStringToLocation ( StringRef spelling,
bool skipParsing,
StringAttr & locatorFilenameCache,
FileLineColLoc & fileLineColLocCache,
MLIRContext * context )

Parse a string that may encode a FIRRTL location into a LocationAttr.

Return an FileLineColLoc for the specified location, but use a bit of caching to reduce thrasing the MLIRContext.

Definition at line 928 of file FIRRTLUtils.cpp.

References context.

◆ minimumFIRVersion()

FIRVersion circt::firrtl::minimumFIRVersion ( 2 ,
0 ,
0  )
constexpr

The current minimum version of FIRRTL that the parser supports.

Referenced by exportFIRFile().

◆ nextFIRVersion()

FIRVersion circt::firrtl::nextFIRVersion ( 7 ,
0 ,
0  )
constexpr

The next version of FIRRTL that is not yet released.

Features use this version if they have been landed on the main branch of chipsalliance/firrtl-spec, but have not been part of a release yet. Once a new version of the spec is released, all uses of nextFIRVersion in the parser are replaced with the concrete version {x, y, z}, and this declaration here is bumped to the next probable version number.

◆ operator<<() [1/7]

llvm::raw_ostream & circt::firrtl::operator<< ( llvm::raw_ostream & os,
const Direction & dir )

Prints the Direction to the stream as either "in" or "out".

Definition at line 62 of file FIRRTLAttributes.cpp.

References circt::firrtl::direction::toString().

◆ operator<<() [2/7]

llvm::raw_ostream & circt::firrtl::operator<< ( llvm::raw_ostream & os,
const InstanceInfo::LatticeValue & value )
inline

◆ operator<<() [3/7]

template<typename T>
T & circt::firrtl::operator<< ( T & os,
const AnnoPathValue & path )
static

◆ operator<<() [4/7]

template<typename T>
T & circt::firrtl::operator<< ( T & os,
const AnnoTarget & target )
static

Definition at line 136 of file FIRRTLAnnotationHelper.h.

◆ operator<<() [5/7]

template<typename T>
T & circt::firrtl::operator<< ( T & os,
const OpAnnoTarget & target )
static

Definition at line 124 of file FIRRTLAnnotationHelper.h.

References circt::firrtl::AnnoTarget::getOp().

◆ operator<<() [6/7]

template<typename T>
T & circt::firrtl::operator<< ( T & os,
const PortAnnoTarget & target )
static

◆ operator<<() [7/7]

template<typename T>
T & circt::firrtl::operator<< ( T & os,
FIRVersion version )

◆ operator|()

MemDirAttr circt::firrtl::operator| ( MemDirAttr lhs,
MemDirAttr rhs )
inline

Allow 'or'ing MemDirAttr.

This allows combining Read and Write into ReadWrite.

Definition at line 96 of file FIRRTLOps.h.

◆ operator|=()

MemDirAttr & circt::firrtl::operator|= ( MemDirAttr & lhs,
MemDirAttr rhs )
inline

Definition at line 102 of file FIRRTLOps.h.

◆ parseFormatString()

mlir::ParseResult circt::firrtl::parseFormatString ( mlir::OpBuilder & builder,
mlir::Location loc,
llvm::StringRef formatString,
llvm::ArrayRef< mlir::Value > specOperands,
mlir::StringAttr & formatStringResult,
llvm::SmallVectorImpl< mlir::Value > & operands )

Definition at line 1154 of file FIRRTLUtils.cpp.

References isdigit.

◆ parseNestedBaseType()

ParseResult circt::firrtl::parseNestedBaseType ( FIRRTLBaseType & result,
AsmParser & parser )

Definition at line 663 of file FIRRTLTypes.cpp.

References failure(), and parseFIRRTLBaseType().

Referenced by customTypeParser().

◆ parseNestedPropertyType()

ParseResult circt::firrtl::parseNestedPropertyType ( PropertyType & result,
AsmParser & parser )

Definition at line 673 of file FIRRTLTypes.cpp.

References failure(), and parseFIRRTLPropertyType().

Referenced by customTypeParser().

◆ parseNestedType()

ParseResult circt::firrtl::parseNestedType ( FIRRTLType & result,
AsmParser & parser )

Parse a FIRRTLType.

Note that only a subset of types defined in the FIRRTL dialect inherit from FIRRTLType. Use parseType to parse any of the defined types.

Definition at line 653 of file FIRRTLTypes.cpp.

References failure(), and parseFIRRTLType().

Referenced by customTypeParser().

◆ preservesInitial()

bool circt::firrtl::preservesInitial ( IntegerAttr initial,
std::optional< APInt > foldedValue = std::nullopt )

Return true if replacing a register carrying the time-zero initial value with foldedValue does not change the register's time-zero behavior.

Return true if replacing a register with foldedValue preserves the register's time-zero (initial) value.

Definition at line 239 of file FIRRTLUtils.cpp.

Referenced by canonicalizeRegResetWithOneReset(), canonicalizeSingleSetConnect(), and foldHiddenReset().

◆ printNestedType()

void circt::firrtl::printNestedType ( Type type,
AsmPrinter & os )

Print a type defined by this dialect.

Definition at line 192 of file FIRRTLTypes.cpp.

References assert(), and customTypePrinter().

Referenced by customTypePrinter().

◆ registerAnnotationRecord()

LogicalResult circt::firrtl::registerAnnotationRecord ( StringRef annoClass,
AnnoRecord annoRecord,
const std::function< void(llvm::Twine)> & errorHandler = {} )

Register external annotation records.

Definition at line 607 of file LowerAnnotations.cpp.

References annotationRecords.

◆ registerFromFIRFileTranslation()

void circt::firrtl::registerFromFIRFileTranslation ( )

Definition at line 6996 of file FIRParser.cpp.

References context, and importFIRFile().

Referenced by circt::registerAllTranslations().

◆ registerReducePatternDialectInterface()

void circt::firrtl::registerReducePatternDialectInterface ( mlir::DialectRegistry & registry)

Register the FIRRTL Reduction pattern dialect interface to the given registry.

Definition at line 2739 of file FIRRTLReductions.cpp.

◆ registerToFIRFileTranslation()

void circt::firrtl::registerToFIRFileTranslation ( )

◆ resolveEntities()

std::optional< AnnoPathValue > circt::firrtl::resolveEntities ( TokenAnnoTarget path,
CircuitOp circuit,
SymbolTable & symTbl,
CircuitTargetCache & cache )

Convert a parsed target string to a resolved target structure.

This resolves all names and aggregates from a parsed target.

Definition at line 167 of file FIRRTLAnnotationHelper.cpp.

References assert(), findFieldID(), getNumPorts(), circt::firrtl::AnnoTarget::getOp(), circt::firrtl::AnnoTarget::getType(), and circt::firrtl::CircuitTargetCache::lookup().

Referenced by resolvePath(), and stdResolveImpl().

◆ resolvePath()

std::optional< AnnoPathValue > circt::firrtl::resolvePath ( StringRef rawPath,
CircuitOp circuit,
SymbolTable & symTbl,
CircuitTargetCache & cache )

Resolve a string path to a named item inside a circuit.

Definition at line 331 of file FIRRTLAnnotationHelper.cpp.

References canonicalizeTarget(), resolveEntities(), and tokenizePath().

Referenced by applyGCTMemTaps().

◆ runCombMemsToRegOfVec()

void circt::firrtl::runCombMemsToRegOfVec ( FModuleOp mod,
bool ignoreReadEnable,
unsigned & numConverted )

Definition at line 622 of file FullReset.cpp.

◆ runFullReset()

LogicalResult circt::firrtl::runFullReset ( CircuitOp circuit,
InstanceGraph & ig,
InstanceInfo & instanceInfo,
bool convertAsyncDomainMems = false )

Definition at line 739 of file FullReset.cpp.

◆ stdResolve()

std::optional< AnnoPathValue > circt::firrtl::stdResolve ( DictionaryAttr anno,
ApplyState & state )

===-------------------------------------------------------------------—===// Standard Utility Resolvers ===-------------------------------------------------------------------—===//

(SFC) FIRRTL SingleTargetAnnotation resolver.

(SFC) FIRRTL SingleTargetAnnotation resolver. Uses the 'target' field of the annotation with standard parsing to resolve the path. This requires 'target' to exist and be normalized (per docs/FIRRTLAnnotations.md).

Uses the 'target' field of the annotation with standard parsing to resolve the path. This requires 'target' to exist and be normalized (per docs/FIRRTLAnnotations.md).

Definition at line 170 of file LowerAnnotations.cpp.

References circt::firrtl::ApplyState::circuit, and stdResolveImpl().

◆ stripDomainsFromCircuit()

LogicalResult circt::firrtl::stripDomainsFromCircuit ( CircuitOp circuit,
llvm::function_ref< bool(StringAttr)> shouldStripDomain )

Strip domains whose names match the predicate from a circuit.

Definition at line 148 of file StripDomains.cpp.

◆ swapFlow()

Flow circt::firrtl::swapFlow ( Flow flow)

Get a flow's reverse.

Definition at line 144 of file FIRRTLOps.cpp.

References Duplex, None, Sink, and Source.

Referenced by foldFlow().

◆ tokenizePath()

std::optional< TokenAnnoTarget > circt::firrtl::tokenizePath ( StringRef origTarget)

Parse a FIRRTL annotation path into its constituent parts.

split a target string into it constituent parts.

This is the primary parser for targets.

Definition at line 291 of file FIRRTLAnnotationHelper.cpp.

References circt::firrtl::TokenAnnoTarget::circuit, circt::firrtl::TokenAnnoTarget::component, circt::firrtl::TokenAnnoTarget::instances, circt::firrtl::TokenAnnoTarget::module, and circt::firrtl::TokenAnnoTarget::name.

Referenced by applyGCTMemTaps(), resolvePath(), and stdResolveImpl().

◆ tryGetAs()

template<typename A>
A circt::firrtl::tryGetAs ( DictionaryAttr dict,
Attribute root,
StringRef key,
Location loc,
Twine clazz,
Twine path = Twine() )

Implements the same behavior as DictionaryAttr::getAs to return the value of a specific type associated with a key in a dictionary.

However, this is specialized to print a useful error message, specific to custom annotation process, on failure.

Definition at line 436 of file FIRRTLAnnotationHelper.h.

References tryGetAsBase().

Referenced by applyBodyTypeLoweringAnno(), applyConventionAnno(), applyGCTMemTaps(), applyGCTView(), applyLoadMemoryAnno(), applyModulePrefixAnno(), and applyOutputDirAnno().

◆ tryGetAsBase()

template<typename A>
A circt::firrtl::tryGetAsBase ( DictionaryAttr dict,
Attribute root,
StringRef key,
Location loc,
Twine whatSpecific,
Twine whatFull,
Twine path = Twine() )

Implements the same behavior as DictionaryAttr::getAs to return the value of a specific type associated with a key in a dictionary.

However, this is specialized to print a useful error message, specific to custom processing, on failure.

Definition at line 396 of file FIRRTLAnnotationHelper.h.

References toVector().

Referenced by tryGetAs().

◆ tryResolve()

std::optional< AnnoPathValue > circt::firrtl::tryResolve ( DictionaryAttr anno,
ApplyState & state )

Resolves with target, if it exists. If not, resolves to the circuit.

Definition at line 187 of file LowerAnnotations.cpp.

References circt::firrtl::ApplyState::circuit, and stdResolveImpl().

◆ type_cast()

◆ type_dyn_cast()

◆ type_dyn_cast_or_null()

template<typename BaseTy>
BaseTy circt::firrtl::type_dyn_cast_or_null ( Type type)

Definition at line 507 of file FIRRTLTypes.h.

References type_cast(), and type_isa_and_nonnull().

◆ type_isa()

◆ type_isa_and_nonnull()

template<typename... BaseTy>
bool circt::firrtl::type_isa_and_nonnull ( Type type)

Definition at line 473 of file FIRRTLTypes.h.

References type_isa().

Referenced by type_dyn_cast_or_null().

◆ verifyModuleLikeOpInterface()

LogicalResult circt::firrtl::verifyModuleLikeOpInterface ( FModuleLike module)

Verification hook for verifying module like operations.

Definition at line 50 of file FIRRTLOpInterfaces.cpp.

References failure(), success(), type_isa(), and verifyNoInputProbes().

◆ walkDrivers()

bool circt::firrtl::walkDrivers ( FIRRTLBaseValue value,
bool lookThroughWires,
bool lookThroughNodes,
bool lookThroughCasts,
WalkDriverCallback callback )

Definition at line 357 of file FIRRTLUtils.cpp.

References assert(), getFieldRefFromValue(), In, lookThroughWires(), and Out.

Referenced by SFCCompatPass::runOnOperation().

◆ walkGroundTypes()

void circt::firrtl::walkGroundTypes ( FIRRTLType firrtlType,
llvm::function_ref< void(uint64_t, FIRRTLBaseType, bool)> fn )

Walk leaf ground types in the firrtlType and apply the function fn.

The first argument of fn is field ID, and the second argument is a leaf ground type, and the third argument indicates if the element was flipped in a bundle.

The first argument of fn is field ID, and the second argument is a leaf ground type and the third argument is a bool to indicate flip.

Definition at line 775 of file FIRRTLUtils.cpp.

References assert(), circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::Case(), and getBaseType().

Referenced by DiscoverLoops::constructConnectivityGraph(), and DiscoverLoops::recordDataflow().

Variable Documentation

◆ annotationRecords

llvm::StringMap<AnnoRecord> circt::firrtl::annotationRecords
static
Initial value:
{{
{"circt.testLocalOnly", {stdResolve, applyWithoutTarget<>}},
{"circt.testNT", {noResolve, applyWithoutTarget<>}},
{"circt.missing", {tryResolve, applyWithoutTarget<true>}},
#define GET_ANNOTATION_RECORD_LIST
}}
static std::optional< AnnoPathValue > noResolve(DictionaryAttr anno, ApplyState &state)
Always resolve to the circuit, ignoring the annotation.
std::optional< AnnoPathValue > stdResolve(DictionaryAttr anno, ApplyState &state)
===-------------------------------------------------------------------—===// Standard Utility Resolve...
static LogicalResult applyWithoutTarget(const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state)
An applier which puts the annotation on the target and drops the 'target' field from the annotation.
std::optional< AnnoPathValue > tryResolve(DictionaryAttr anno, ApplyState &state)
Resolves with target, if it exists. If not, resolves to the circuit.

Definition at line 593 of file LowerAnnotations.cpp.

Referenced by getAnnotationHandler(), and registerAnnotationRecord().

◆ exportFIRVersion

FIRVersion circt::firrtl::exportFIRVersion = nextFIRVersion
constexpr

The version of FIRRTL that the exporter produces.

This is always the next version, since it contains any new developments.

Definition at line 151 of file FIRParser.h.

Referenced by mlirExportFIRRTL(), and registerToFIRFileTranslation().

◆ missingSpecFIRVersion

FIRVersion circt::firrtl::missingSpecFIRVersion = nextFIRVersion
constexpr

A marker for parser features that are currently missing from the spec.

Features use this version if they have not been added to the documentation in the chipsalliance/firrtl-spec repository. This allows us to distinguish features that are released in the next version of the spec and features that are still missing from the spec.

Definition at line 147 of file FIRParser.h.

◆ NoTargetAnnotation

AnnoRecord circt::firrtl::NoTargetAnnotation
static
Initial value:

Resolution and application of a "firrtl.annotations.NoTargetAnnotation".

This should be used for any Annotation which does not apply to anything in the FIRRTL Circuit, i.e., an Annotation which has no target. Historically, NoTargetAnnotations were used to control the Scala FIRRTL Compiler (SFC) or its passes, e.g., to set the output directory or to turn on a pass. Examples of these in the SFC are "firrtl.options.TargetDirAnnotation" to set the output directory or "firrtl.stage.RunFIRRTLTransformAnnotation" to cause the SFC to schedule a specified pass. Instead of leaving these floating or attaching them to the top-level MLIR module (which is a purer interpretation of "no target"), we choose to attach them to the Circuit even they do not "apply" to the Circuit. This gives later passes a common place, the Circuit, to search for these control Annotations.

Definition at line 590 of file LowerAnnotations.cpp.

◆ rawAnnotations

const char* circt::firrtl::rawAnnotations = "rawAnnotations"
constexpr

Definition at line 25 of file AnnotationDetails.h.