CIRCT  19.0.0git
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
circt::firrtl Namespace Reference

Namespaces

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

Classes

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  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  FIRRTLVisitor
 FIRRTLVisitor allows you to visit all of the expr/stmt/decls with one class declaration. 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 = llvm::function_ref< bool(const FieldRef &dst, const FieldRef &src)>
 Walk all the drivers of a value, passing in the connect operations drive the value. More...
 
using GetNamespaceCallback = llvm::function_ref< hw::InnerSymbolNamespace &(FModuleLike mod)>
 

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  CompanionMode { Bind , Instantiate , Drop }
 

Functions

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 (0, 2, 0)
 
constexpr FIRVersion nextFIRVersion (3, 3, 0)
 
constexpr FIRVersion exportFIRVersion (4, 0, 0)
 
constexpr FIRVersion defaultFIRVersion (1, 0, 0)
 
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. More...
 
std::optional< TokenAnnoTargettokenizePath (StringRef origTarget)
 Parse a FIRRTL annotation path into its constituent parts. More...
 
std::optional< AnnoPathValueresolveEntities (TokenAnnoTarget path, CircuitOp circuit, SymbolTable &symTbl, CircuitTargetCache &cache)
 Convert a parsed target string to a resolved target structure. More...
 
std::optional< AnnoPathValueresolvePath (StringRef rawPath, CircuitOp circuit, SymbolTable &symTbl, CircuitTargetCache &cache)
 Resolve a string path to a named item inside a circuit. More...
 
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 applyOMIR (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state)
 Main entry point to handle scattering of an OMIRAnnotation. More...
 
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). More...
 
LogicalResult applyWiring (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state)
 Consume SourceAnnotation and SinkAnnotation, storing into state. More...
 
template<typename A >
tryGetAs (DictionaryAttr &dict, const Attribute &root, StringRef key, Location loc, Twine className, Twine path=Twine())
 Implements the same behavior as DictionaryAttr::getAs<A> to return the value of a specific type associated with a key in a dictionary. More...
 
InstanceOp addPortsToModule (FModuleLike mod, InstanceOp instOnPath, FIRRTLType portType, Direction dir, StringRef newName, InstancePathCache &instancePathcache, CircuitTargetCache *targetCaches=nullptr)
 Add ports to the module and all its instances and return the clone for instOnPath. More...
 
LogicalResult registerAnnotationRecord (StringRef annoClass, AnnoRecord annoRecord, const std::function< void(llvm::Twine)> &errorHandler={})
 Register external annotation records. More...
 
std::optional< AnnoPathValuestdResolve (DictionaryAttr anno, ApplyState &state)
 ===-------------------------------------------------------------------—===// Standard Utility Resolvers ===-------------------------------------------------------------------—===// More...
 
std::optional< AnnoPathValuetryResolve (DictionaryAttr anno, ApplyState &state)
 Resolves with target, if it exists. If not, resolves to the circuit. More...
 
LogicalResult applyWithoutTargetImpl (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state, bool allowNonLocal)
 ===-------------------------------------------------------------------—===// Standard Utility Appliers ===-------------------------------------------------------------------—===// More...
 
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. More...
 
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. More...
 
StringRef getAnnotationAttrName ()
 Return the name of the attribute used for annotations on FIRRTL ops. More...
 
StringRef getPortAnnotationAttrName ()
 Return the name of the attribute used for port annotations on FIRRTL ops. More...
 
StringRef getDialectAnnotationAttrName ()
 Return the name of the dialect-prefixed attribute used for annotations. More...
 
bool isOMIRStringEncodedPassthrough (StringRef type)
 Check if an OMIR type is a string-encoded value that the FIRRTL dialect simply passes through as a string without any decoding. More...
 
LogicalResult extractDUT (FModuleOp mod, FModuleOp &dut)
 Utility that searches for a MarkDUTAnnotation on a specific module, mod, and tries to update a design-under-test (DUT), dut, with this module if the module is the DUT. More...
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &os, const Direction &dir)
 Prints the Direction to the stream as either "in" or "out". More...
 
bool allUnder (ArrayRef< InstanceRecord * > nodes, InstanceGraphNode *top)
 
LogicalResult verifyModuleLikeOpInterface (FModuleLike module)
 Verification hook for verifying module like operations. More...
 
bool hasDroppableName (Operation *op)
 Return true if the name is droppable. More...
 
bool isExpression (Operation *op)
 Return true if the specified operation is a firrtl expression. More...
 
size_t getNumPorts (Operation *op)
 Return the number of ports in a module-like thing (modules, memories, etc) More...
 
bool isConstant (Operation *op)
 Return true if the specified operation has a constant value. More...
 
bool isConstant (Value value)
 Return true if the specified value is a constant. More...
 
bool isDuplexValue (Value val)
 Returns true if the value results from an expression with duplex flow. More...
 
Flow swapFlow (Flow flow)
 Get a flow's reverse. More...
 
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. More...
 
DeclKind getDeclarationKind (Value val)
 
MemDirAttr operator| (MemDirAttr lhs, MemDirAttr rhs)
 Allow 'or'ing MemDirAttr. More...
 
MemDirAttr & operator|= (MemDirAttr &lhs, MemDirAttr rhs)
 
StringAttr getInnerSymName (Operation *op)
 Return the StringAttr for the inner_sym name, if it exists. More...
 
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. More...
 
bool hasDontTouch (Operation *op)
 Check whether an operation has a DontTouch annotation, or a symbol that should prevent certain types of canonicalizations. More...
 
StrictConnectOp 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. More...
 
void registerReducePatternDialectInterface (mlir::DialectRegistry &registry)
 Register the FIRRTL Reduction pattern dialect interface to the given registry. More...
 
bool isConst (Type type)
 Returns true if this is a 'const' type whose value is guaranteed to be unchanging at circuit execution time. More...
 
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. More...
 
bool hasZeroBitWidth (FIRRTLType type)
 Return true if the type has zero bit width. More...
 
bool areTypesEquivalent (FIRRTLType destType, FIRRTLType srcType, bool destOuterTypeIsConst=false, bool srcOuterTypeIsConst=false, bool requireSameWidths=false)
 Returns whether the two types are equivalent. More...
 
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. More...
 
bool areTypesConstCastable (FIRRTLType destType, FIRRTLType srcType, bool srcOuterTypeIsConst=false)
 Returns whether the srcType can be const-casted to the destType. More...
 
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. More...
 
bool isTypeLarger (FIRRTLBaseType dstType, FIRRTLBaseType srcType)
 Returns true if the destination is at least as wide as a source. More...
 
bool areAnonymousTypesEquivalent (FIRRTLBaseType lhs, FIRRTLBaseType rhs)
 Return true if anonymous types of given arguments are equivalent by pointer comparison. More...
 
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. More...
 
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. More...
 
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. More...
 
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)
 Emit a connect between two values. More...
 
void emitConnect (ImplicitLocOpBuilder &builder, Value lhs, Value rhs)
 Emit a connect between two values. More...
 
IntegerAttr getIntAttr (Type type, const APInt &value)
 Utiility for generating a constant attribute. More...
 
IntegerAttr getIntZerosAttr (Type type)
 Utility for generating a constant zero attribute. More...
 
IntegerAttr getIntOnesAttr (Type type)
 Utility for generating a constant all ones attribute. More...
 
PropAssignOp getPropertyAssignment (FIRRTLPropertyValue value)
 Return the single assignment to a Property value. More...
 
Value getDriverFromConnect (Value val)
 Return the module-scoped driver of a value only looking through one connect. More...
 
Value getValueSource (Value val, bool lookThroughWires, bool lookThroughNodes, bool lookThroughCasts)
 Return the value that drives another FIRRTL value within module scope. More...
 
Value getModuleScopedDriver (Value val, bool lookThroughWires, bool lookThroughNodes, bool lookThroughCasts)
 Return the value that drives another FIRRTL value within module scope. More...
 
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. More...
 
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. More...
 
FieldRef getDeltaRef (Value value, bool lookThroughCasts=false)
 Get the delta indexing from a value, as a FieldRef. More...
 
std::pair< std::string, bool > getFieldName (const FieldRef &fieldRef, bool nameSafe=false)
 Get a string identifier representing the FieldRef. More...
 
Value getValueByFieldID (ImplicitLocOpBuilder builder, Value value, unsigned fieldID)
 This gets the value targeted by a field id. More...
 
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. More...
 
hw::InnerSymTarget getTargetFor (FieldRef ref)
 Return the inner sym target for the specified value and fieldID. More...
 
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. More...
 
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. More...
 
StringAttr getOrAddInnerSym (const hw::InnerSymTarget &target, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified target (op or port), adding one if necessary. More...
 
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. More...
 
static StringAttr getOrAddInnerSym (Operation *op, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified operation, adding one if necessary. More...
 
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. More...
 
static hw::InnerRefAttr getInnerRefTo (Operation *op, GetNamespaceCallback getNamespace)
 Obtain an inner reference to an operation, possibly adding an inner symbol. More...
 
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. More...
 
static StringAttr getOrAddInnerSym (FModuleLike mod, size_t portIdx, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified port, adding one if necessary. More...
 
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. More...
 
static hw::InnerRefAttr getInnerRefTo (FModuleLike mod, size_t portIdx, GetNamespaceCallback getNamespace)
 Obtain an inner reference to a port, possibly adding an inner symbol. More...
 
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. More...
 
FIRRTLBaseType getBaseType (Type type)
 If it is a base type, return it as is. More...
 
template<typename T >
getBaseOfType (Type type)
 Get base type if isa<> the requested type, else null. More...
 
FIRRTLType mapBaseType (FIRRTLType type, function_ref< FIRRTLBaseType(FIRRTLBaseType)> fn)
 Return a FIRRTLType with its base type component mutated by the given function. More...
 
FIRRTLType mapBaseTypeNullable (FIRRTLType type, function_ref< FIRRTLBaseType(FIRRTLBaseType)> fn)
 Return a FIRRTLType with its base type component mutated by the given function. More...
 
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. More...
 
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. More...
 
template<class IterTy , class ResultTy , class ReduceFuncTy , class TransformFuncTy >
static ResultTy transformReduce (MLIRContext *context, IterTy begin, IterTy end, ResultTy init, ReduceFuncTy reduce, TransformFuncTy transform)
 Wrapper for llvm::parallelTransformReduce that performs the transform_reduce serially when MLIR multi-threading is disabled. More...
 
template<class RangeTy , class ResultTy , class ReduceFuncTy , class TransformFuncTy >
static ResultTy transformReduce (MLIRContext *context, RangeTy &&r, ResultTy init, ReduceFuncTy reduce, TransformFuncTy transform)
 Range wrapper. More...
 
bool importAnnotationsFromJSONRaw (llvm::json::Value &value, SmallVectorImpl< Attribute > &annotations, llvm::json::Path path, MLIRContext *context)
 Deserialize a JSON value into FIRRTL Annotations. More...
 
std::unique_ptr< mlir::Pass > createResolvePathsPass ()
 
std::unique_ptr< mlir::Pass > createLowerFIRRTLAnnotationsPass (bool ignoreUnhandledAnnotations=false, bool ignoreClasslessAnnotations=false, bool noRefTypePorts=false)
 This is the pass constructor. More...
 
std::unique_ptr< mlir::Pass > createLowerOpenAggsPass ()
 This is the pass constructor. More...
 
std::unique_ptr< mlir::Pass > createLowerFIRRTLTypesPass (PreserveAggregate::PreserveMode mode=PreserveAggregate::None, PreserveAggregate::PreserveMode memoryMode=PreserveAggregate::None)
 This is the pass constructor. More...
 
std::unique_ptr< mlir::Pass > createLowerBundleVectorTypesPass ()
 
std::unique_ptr< mlir::Pass > createLowerCHIRRTLPass ()
 
std::unique_ptr< mlir::Pass > createLowerIntmodulesPass (bool fixupEICGWrapper=false)
 This is the pass constructor. More...
 
std::unique_ptr< mlir::Pass > createLowerIntrinsicsPass ()
 This is the pass constructor. More...
 
std::unique_ptr< mlir::Pass > createIMConstPropPass ()
 
std::unique_ptr< mlir::Pass > createRemoveUnusedPortsPass (bool ignoreDontTouch=false)
 
std::unique_ptr< mlir::Pass > createInlinerPass ()
 
std::unique_ptr< mlir::Pass > createInferReadWritePass ()
 
std::unique_ptr< mlir::Pass > createCreateSiFiveMetadataPass (bool replSeqMem=false, mlir::StringRef replSeqMemFile="")
 
std::unique_ptr< mlir::Pass > createVBToBVPass ()
 
std::unique_ptr< mlir::Pass > createAddSeqMemPortsPass ()
 
std::unique_ptr< mlir::Pass > createDedupPass ()
 
std::unique_ptr< mlir::Pass > createEmitOMIRPass (mlir::StringRef outputFilename="")
 
std::unique_ptr< mlir::Pass > createLowerMatchesPass ()
 
std::unique_ptr< mlir::Pass > createLowerSignaturesPass ()
 This is the pass constructor. More...
 
std::unique_ptr< mlir::Pass > createPassiveWiresPass ()
 This is the pass constructor. More...
 
std::unique_ptr< mlir::Pass > createExpandWhensPass ()
 
std::unique_ptr< mlir::Pass > createFlattenMemoryPass ()
 
std::unique_ptr< mlir::Pass > createInferWidthsPass ()
 
std::unique_ptr< mlir::Pass > createInferResetsPass ()
 
std::unique_ptr< mlir::Pass > createLowerMemoryPass ()
 
std::unique_ptr< mlir::Pass > createHoistPassthroughPass (bool hoistHWDrivers=true)
 This is the pass constructor. More...
 
std::unique_ptr< mlir::Pass > createProbeDCEPass ()
 This is the pass constructor. More...
 
std::unique_ptr< mlir::Pass > createMemToRegOfVecPass (bool replSeqMem=false, bool ignoreReadEnable=false)
 
std::unique_ptr< mlir::Pass > createPrefixModulesPass ()
 
std::unique_ptr< mlir::Pass > createFIRRTLFieldSourcePass ()
 
std::unique_ptr< mlir::Pass > createPrintInstanceGraphPass ()
 
std::unique_ptr< mlir::Pass > createPrintNLATablePass ()
 
std::unique_ptr< mlir::Pass > createBlackBoxReaderPass (std::optional< mlir::StringRef > inputPrefix={})
 
std::unique_ptr< mlir::Pass > createGrandCentralPass (CompanionMode companionMode=CompanionMode::Bind)
 
std::unique_ptr< mlir::Pass > createCheckCombLoopsPass ()
 
std::unique_ptr< mlir::Pass > createSFCCompatPass ()
 
std::unique_ptr< mlir::Pass > createMergeConnectionsPass (bool enableAggressiveMerging=false)
 
std::unique_ptr< mlir::Pass > createVectorizationPass ()
 
std::unique_ptr< mlir::Pass > createInjectDUTHierarchyPass ()
 
std::unique_ptr< mlir::Pass > createDropConstPass ()
 
std::unique_ptr< mlir::Pass > createDropNamesPass (PreserveValues::PreserveMode mode=PreserveValues::None)
 
std::unique_ptr< mlir::Pass > createExtractInstancesPass ()
 
std::unique_ptr< mlir::Pass > createIMDeadCodeElimPass ()
 
std::unique_ptr< mlir::Pass > createRandomizeRegisterInitPass ()
 
std::unique_ptr< mlir::Pass > createRegisterOptimizerPass ()
 
std::unique_ptr< mlir::Pass > createLowerXMRPass ()
 
std::unique_ptr< mlir::Pass > createResolveTracesPass (mlir::StringRef outputAnnotationFilename="")
 
std::unique_ptr< mlir::Pass > createInnerSymbolDCEPass ()
 
std::unique_ptr< mlir::Pass > createFinalizeIRPass ()
 
std::unique_ptr< mlir::Pass > createLowerClassesPass ()
 
std::unique_ptr< mlir::Pass > createLowerLayersPass ()
 
std::unique_ptr< mlir::Pass > createLayerMergePass ()
 
std::unique_ptr< mlir::Pass > createLayerSinkPass ()
 
std::unique_ptr< mlir::Pass > createMaterializeDebugInfoPass ()
 
std::unique_ptr< mlir::Pass > createLintingPass ()
 
std::unique_ptr< mlir::Pass > createSpecializeOptionPass ()
 
std::unique_ptr< mlir::Pass > createCreateCompanionAssume ()
 
bool fromOMIRJSON (llvm::json::Value &value, SmallVectorImpl< Attribute > &annotations, llvm::json::Path path, MLIRContext *context)
 Convert a JSON value containing OMIR JSON (an array of OMNodes), convert this to an OMIRAnnotation, and add it to a mutable annotations argument. More...
 
ParseResult foldWhenEncodedVerifOp (PrintFOp printOp)
 Chisel has a tendency to emit complex assert/assume/cover statements encoded as print operations with special formatting and metadata embedded in the message literal. More...
 

Variables

constexpr const char * rawAnnotations = "rawAnnotations"
 
constexpr const char * conventionAnnoClass = "circt.ConventionAnnotation"
 
constexpr const char * dontTouchAnnoClass
 
constexpr const char * enumComponentAnnoClass
 
constexpr const char * enumDefAnnoClass
 
constexpr const char * enumVecAnnoClass
 
constexpr const char * forceNameAnnoClass
 
constexpr const char * decodeTableAnnotation
 
constexpr const char * flattenAnnoClass = "firrtl.transforms.FlattenAnnotation"
 
constexpr const char * inlineAnnoClass = "firrtl.passes.InlineAnnotation"
 
constexpr const char * traceNameAnnoClass
 
constexpr const char * traceAnnoClass
 
constexpr const char * omirAnnoClass
 
constexpr const char * omirFileAnnoClass
 
constexpr const char * omirTrackerAnnoClass
 
constexpr const char * blackBoxInlineAnnoClass
 
constexpr const char * blackBoxPathAnnoClass
 
constexpr const char * blackBoxTargetDirAnnoClass
 
constexpr const char * blackBoxResourceFileNameAnnoClass
 
constexpr const char * blackBoxAnnoClass
 
constexpr const char * mustDedupAnnoClass
 
constexpr const char * runFIRRTLTransformAnnoClass
 
constexpr const char * extractAssertAnnoClass
 
constexpr const char * extractAssumeAnnoClass
 
constexpr const char * extractCoverageAnnoClass
 
constexpr const char * testBenchDirAnnoClass
 
constexpr const char * moduleHierAnnoClass
 
constexpr const char * testHarnessHierAnnoClass
 
constexpr const char * retimeModulesFileAnnoClass
 
constexpr const char * retimeModuleAnnoClass
 
constexpr const char * verifBlackBoxAnnoClass
 
constexpr const char * metadataDirectoryAttrName
 
constexpr const char * noDedupAnnoClass = "firrtl.transforms.NoDedupAnnotation"
 
constexpr const char * dedupGroupAnnoClass
 
constexpr const char * serializedViewAnnoClass
 
constexpr const char * viewAnnoClass
 
constexpr const char * companionAnnoClass
 
constexpr const char * prefixInterfacesAnnoClass
 
constexpr const char * augmentedGroundTypeClass
 
constexpr const char * augmentedBundleTypeClass
 
constexpr const char * dataTapsClass
 
constexpr const char * dataTapsBlackboxClass
 
constexpr const char * memTapClass
 
constexpr const char * memTapBlackboxClass
 
constexpr const char * memTapPortClass
 
constexpr const char * memTapSourceClass
 
constexpr const char * deletedKeyClass
 
constexpr const char * literalKeyClass
 
constexpr const char * referenceKeyClass
 
constexpr const char * referenceKeyPortClass
 
constexpr const char * referenceKeySourceClass
 
constexpr const char * internalKeyClass
 
constexpr const char * internalKeyPortClass
 
constexpr const char * internalKeySourceClass
 
constexpr const char * extractGrandCentralClass
 
constexpr const char * grandCentralHierarchyFileAnnoClass
 
constexpr const char * dutAnnoClass
 
constexpr const char * injectDUTHierarchyAnnoClass
 
constexpr const char * sitestBlackBoxAnnoClass
 
constexpr const char * sitestTestHarnessBlackBoxAnnoClass
 
constexpr const char * prefixModulesAnnoClass
 
constexpr const char * dontObfuscateModuleAnnoClass
 
constexpr const char * scalaClassAnnoClass
 
constexpr const char * elaborationArtefactsDirectoryAnnoClass
 
constexpr const char * testHarnessPathAnnoClass
 
constexpr const char * fullAsyncResetAnnoClass
 Annotation that marks a reset (port or wire) and domain. More...
 
constexpr const char * ignoreFullAsyncResetAnnoClass
 Annotation that marks a module as not belonging to any reset domain. More...
 
constexpr const char * convertMemToRegOfVecAnnoClass
 
constexpr const char * excludeMemToRegAnnoClass
 
constexpr const char * extractBlackBoxAnnoClass
 
constexpr const char * extractClockGatesAnnoClass
 
constexpr const char * extractSeqMemsAnnoClass
 
constexpr const char * addSeqMemPortAnnoClass
 
constexpr const char * addSeqMemPortsFileAnnoClass
 
constexpr const char * loadMemoryFromFileAnnoClass
 
constexpr const char * loadMemoryFromFileInlineAnnoClass
 
constexpr const char * wiringSinkAnnoClass
 
constexpr const char * wiringSourceAnnoClass
 
constexpr const char * attributeAnnoClass = "firrtl.AttributeAnnotation"
 
static AnnoRecord NoTargetAnnotation
 Resolution and application of a "firrtl.annotations.NoTargetAnnotation". More...
 
static llvm::StringMap< AnnoRecordannotationRecords
 

Typedef Documentation

◆ FIRRTLBaseValue

using circt::firrtl::FIRRTLBaseValue = typedef mlir::TypedValue<FIRRTLBaseType>

Definition at line 392 of file FIRRTLTypes.h.

◆ FIRRTLPropertyValue

using circt::firrtl::FIRRTLPropertyValue = typedef mlir::TypedValue<PropertyType>

Definition at line 393 of file FIRRTLTypes.h.

◆ FIRRTLValue

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

Definition at line 391 of file FIRRTLTypes.h.

◆ GetNamespaceCallback

using circt::firrtl::GetNamespaceCallback = typedef llvm::function_ref<hw::InnerSymbolNamespace &(FModuleLike mod)>

Definition at line 140 of file FIRRTLUtils.h.

◆ InstanceGraphNode

Definition at line 26 of file FIRRTLInstanceGraph.h.

◆ InstancePathCache

Definition at line 27 of file FIRRTLInstanceGraph.h.

◆ InstanceRecord

Definition at line 25 of file FIRRTLInstanceGraph.h.

◆ WalkDriverCallback

using circt::firrtl::WalkDriverCallback = typedef llvm::function_ref<bool(const FieldRef &dst, const FieldRef &src)>

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 79 of file FIRRTLUtils.h.

Enumeration Type Documentation

◆ CompanionMode

Enumerator
Bind 
Instantiate 
Drop 

Definition at line 125 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 82 of file FIRRTLOpInterfaces.h.

◆ DeclKind

Enumerator
Port 
Instance 
Other 

Definition at line 85 of file FIRRTLOps.h.

◆ Direction

This represents the direction of a single port.

Enumerator
In 
Out 

Definition at line 27 of file FIRRTLAttributes.h.

◆ Flow

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

Definition at line 59 of file FIRRTLOps.h.

◆ ReadPortSubfield

Enumerator
addr 
en 
clk 
data 

Definition at line 89 of file FIRRTLOps.h.

◆ ReadWritePortSubfield

Enumerator
addr 
en 
clk 
rdata 
wmode 
wdata 
wmask 

Definition at line 91 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 90 of file FIRRTLOps.h.

Function Documentation

◆ addPortsToModule()

InstanceOp circt::firrtl::addPortsToModule ( FModuleLike  mod,
InstanceOp  instOnPath,
FIRRTLType  portType,
Direction  dir,
StringRef  newName,
InstancePathCache instancePathcache,
CircuitTargetCache targetCaches = nullptr 
)

Add ports to the module and all its instances and return the clone for instOnPath.

This does not connect the new ports to anything. Replace the old instances with the new cloned instance in all the caches.

Definition at line 348 of file FIRRTLAnnotationHelper.cpp.

References circt::calyx::direction::get(), getNumPorts(), circt::igraph::InstancePathCache::instanceGraph, circt::igraph::InstanceGraph::lookup(), circt::igraph::InstancePathCache::replaceInstance(), circt::firrtl::CircuitTargetCache::replaceOp(), and circt::igraph::InstanceGraphNode::uses().

Referenced by lowerInternalPathAnno().

◆ allUnder()

bool circt::firrtl::allUnder ( ArrayRef< InstanceRecord * >  nodes,
InstanceGraphNode top 
)

Definition at line 28 of file FIRRTLInstanceGraph.cpp.

References assert().

◆ applyGCTDataTaps()

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

◆ applyGCTMemTaps()

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

◆ applyGCTView()

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

◆ applyOMIR()

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

Main entry point to handle scattering of an OMIRAnnotation.

Return the modified optional attribute on success and None on failure. Any scattered annotations will be added to the reference argument newAnnotations.

Definition at line 490 of file EmitOMIR.cpp.

References circt::firrtl::AnnotationSet::addAnnotations(), circt::firrtl::AnnotationSet::applyToOperation(), circt::firrtl::ApplyState::circuit, circt::calyx::direction::get(), omirAnnoClass, and scatterOMNode().

◆ 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 39 of file ResolveTraces.cpp.

References circt::firrtl::ApplyState::addToWorklistFn, dontTouchAnnoClass, circt::calyx::direction::get(), circt::firrtl::AnnoPathValue::isOpOfType(), and traceAnnoClass.

◆ applyWiring()

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

◆ applyWithoutTarget() [1/3]

template<bool allowNonLocal, bool allowPortAnnoTarget, typename T , typename... Tr>
static 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 481 of file FIRRTLAnnotationHelper.h.

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

◆ applyWithoutTarget() [2/3]

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

Definition at line 494 of file FIRRTLAnnotationHelper.h.

References applyWithoutTarget().

◆ applyWithoutTarget() [3/3]

template<bool allowNonLocal = false>
static 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 504 of file FIRRTLAnnotationHelper.h.

References applyWithoutTargetImpl().

Referenced by applyWithoutTarget().

◆ 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 200 of file LowerAnnotations.cpp.

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

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 1232 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 1237 of file FIRRTLTypes.cpp.

References areAnonymousTypesEquivalent().

◆ 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 1043 of file FIRRTLTypes.cpp.

Referenced by 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 887 of file FIRRTLTypes.cpp.

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

Referenced by areBundleElementsEquivalent().

◆ 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 1104 of file FIRRTLTypes.cpp.

References assert().

◆ 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.

Returns whether the 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.

Definition at line 977 of file FIRRTLTypes.cpp.

References circt::firrtl::FIRRTLType::isConst().

◆ 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 applyGCTDataTaps(), 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 827 of file FIRRTLTypes.cpp.

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

◆ createAddSeqMemPortsPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createAddSeqMemPortsPass ( )

Definition at line 436 of file AddSeqMemPorts.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createBlackBoxReaderPass()

std::unique_ptr<mlir::Pass> circt::firrtl::createBlackBoxReaderPass ( std::optional< mlir::StringRef >  inputPrefix = {})

◆ createCheckCombLoopsPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createCheckCombLoopsPass ( )

Definition at line 754 of file CheckCombLoops.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createCreateCompanionAssume()

std::unique_ptr< mlir::Pass > circt::firrtl::createCreateCompanionAssume ( )

◆ createCreateSiFiveMetadataPass()

std::unique_ptr<mlir::Pass> circt::firrtl::createCreateSiFiveMetadataPass ( bool  replSeqMem = false,
mlir::StringRef  replSeqMemFile = "" 
)

◆ createDedupPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createDedupPass ( )

Definition at line 1793 of file Dedup.cpp.

◆ createDropConstPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createDropConstPass ( )

Definition at line 96 of file DropConst.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createDropNamesPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createDropNamesPass ( PreserveValues::PreserveMode  mode = PreserveValues::None)

◆ createEmitOMIRPass()

std::unique_ptr<mlir::Pass> circt::firrtl::createEmitOMIRPass ( mlir::StringRef  outputFilename = "")

◆ createExpandWhensPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createExpandWhensPass ( )

◆ createExtractInstancesPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createExtractInstancesPass ( )

Definition at line 1081 of file ExtractInstances.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createFinalizeIRPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createFinalizeIRPass ( )

Definition at line 38 of file FinalizeIR.cpp.

Referenced by circt::firtool::populateFinalizeIR().

◆ createFIRRTLFieldSourcePass()

std::unique_ptr< mlir::Pass > circt::firrtl::createFIRRTLFieldSourcePass ( )

Definition at line 71 of file PrintFIRRTLFieldSource.cpp.

◆ createFlattenMemoryPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createFlattenMemoryPass ( )

Definition at line 235 of file FlattenMemory.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createGrandCentralPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createGrandCentralPass ( CompanionMode  companionMode = CompanionMode::Bind)

Definition at line 2341 of file GrandCentral.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createHoistPassthroughPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createHoistPassthroughPass ( bool  hoistHWDrivers = true)

This is the pass constructor.

Definition at line 588 of file HoistPassthrough.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createIMConstPropPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createIMConstPropPass ( )

◆ createIMDeadCodeElimPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createIMDeadCodeElimPass ( )

Definition at line 801 of file IMDeadCodeElim.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createInferReadWritePass()

std::unique_ptr< mlir::Pass > circt::firrtl::createInferReadWritePass ( )

Definition at line 576 of file InferReadWrite.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createInferResetsPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createInferResetsPass ( )

◆ createInferWidthsPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createInferWidthsPass ( )

◆ createInjectDUTHierarchyPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createInjectDUTHierarchyPass ( )

Definition at line 332 of file InjectDUTHierarchy.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createInlinerPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createInlinerPass ( )

◆ createInnerSymbolDCEPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createInnerSymbolDCEPass ( )

Definition at line 129 of file InnerSymbolDCE.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createLayerMergePass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLayerMergePass ( )

Definition at line 73 of file LayerMerge.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createLayerSinkPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLayerSinkPass ( )

Definition at line 52 of file LayerSink.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createLintingPass()

std::unique_ptr< Pass > circt::firrtl::createLintingPass ( )

Definition at line 69 of file Lint.cpp.

Referenced by circt::firtool::populateLowFIRRTLToHW().

◆ createLowerBundleVectorTypesPass()

std::unique_ptr<mlir::Pass> circt::firrtl::createLowerBundleVectorTypesPass ( )

◆ createLowerCHIRRTLPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLowerCHIRRTLPass ( )

◆ createLowerClassesPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLowerClassesPass ( )

Definition at line 569 of file LowerClasses.cpp.

Referenced by circt::firtool::populateLowFIRRTLToHW().

◆ createLowerFIRRTLAnnotationsPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLowerFIRRTLAnnotationsPass ( bool  ignoreUnhandledAnnotations = false,
bool  ignoreClasslessAnnotations = false,
bool  noRefTypePorts = false 
)

This is the pass constructor.

Definition at line 1057 of file LowerAnnotations.cpp.

Referenced by circt::firtool::populatePreprocessTransforms().

◆ createLowerFIRRTLTypesPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLowerFIRRTLTypesPass ( PreserveAggregate::PreserveMode  mode = PreserveAggregate::None,
PreserveAggregate::PreserveMode  memoryMode = PreserveAggregate::None 
)

◆ createLowerIntmodulesPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLowerIntmodulesPass ( bool  fixupEICGWrapper = false)

This is the pass constructor.

Definition at line 189 of file LowerIntmodules.cpp.

Referenced by circt::firtool::populatePreprocessTransforms().

◆ createLowerIntrinsicsPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLowerIntrinsicsPass ( )

This is the pass constructor.

Definition at line 51 of file LowerIntrinsics.cpp.

Referenced by circt::firtool::populatePreprocessTransforms().

◆ createLowerLayersPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLowerLayersPass ( )

Definition at line 774 of file LowerLayers.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createLowerMatchesPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLowerMatchesPass ( )

Definition at line 81 of file LowerMatches.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createLowerMemoryPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLowerMemoryPass ( )

Definition at line 546 of file LowerMemory.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createLowerOpenAggsPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLowerOpenAggsPass ( )

This is the pass constructor.

Definition at line 855 of file LowerOpenAggs.cpp.

Referenced by circt::firtool::populatePreprocessTransforms().

◆ createLowerSignaturesPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLowerSignaturesPass ( )

This is the pass constructor.

Definition at line 490 of file LowerSignatures.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createLowerXMRPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createLowerXMRPass ( )

Definition at line 851 of file LowerXMR.cpp.

Referenced by circt::firtool::populateLowFIRRTLToHW().

◆ createMaterializeDebugInfoPass()

std::unique_ptr< Pass > circt::firrtl::createMaterializeDebugInfoPass ( )

◆ createMemToRegOfVecPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createMemToRegOfVecPass ( bool  replSeqMem = false,
bool  ignoreReadEnable = false 
)

Definition at line 450 of file MemToRegOfVec.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createMergeConnectionsPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createMergeConnectionsPass ( bool  enableAggressiveMerging = false)

Definition at line 301 of file MergeConnections.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createPassiveWiresPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createPassiveWiresPass ( )

This is the pass constructor.

Definition at line 84 of file PassiveWires.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createPrefixModulesPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createPrefixModulesPass ( )

Definition at line 489 of file PrefixModules.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createPrintInstanceGraphPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createPrintInstanceGraphPass ( )

Definition at line 37 of file PrintInstanceGraph.cpp.

◆ createPrintNLATablePass()

std::unique_ptr< mlir::Pass > circt::firrtl::createPrintNLATablePass ( )

Definition at line 42 of file PrintNLATable.cpp.

◆ createProbeDCEPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createProbeDCEPass ( )

This is the pass constructor.

Definition at line 78 of file ProbeDCE.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createRandomizeRegisterInitPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createRandomizeRegisterInitPass ( )

◆ createRegisterOptimizerPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createRegisterOptimizerPass ( )

Definition at line 155 of file RegisterOptimizer.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createRemoveUnusedPortsPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createRemoveUnusedPortsPass ( bool  ignoreDontTouch = false)

◆ createResolvePathsPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createResolvePathsPass ( )

Definition at line 338 of file ResolvePaths.cpp.

Referenced by circt::firtool::populatePreprocessTransforms().

◆ createResolveTracesPass()

std::unique_ptr<mlir::Pass> circt::firrtl::createResolveTracesPass ( mlir::StringRef  outputAnnotationFilename = "")

◆ createSFCCompatPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createSFCCompatPass ( )

Definition at line 155 of file SFCCompat.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createSpecializeOptionPass()

std::unique_ptr< Pass > circt::firrtl::createSpecializeOptionPass ( )

Definition at line 89 of file SpecializeOption.cpp.

◆ createVBToBVPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createVBToBVPass ( )

Definition at line 988 of file VBToBV.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ createVectorizationPass()

std::unique_ptr< mlir::Pass > circt::firrtl::createVectorizationPass ( )

Definition at line 97 of file Vectorization.cpp.

Referenced by circt::firtool::populateCHIRRTLToLowFIRRTL().

◆ defaultFIRVersion()

constexpr FIRVersion circt::firrtl::defaultFIRVersion ( ,
,
 
)
constexpr

◆ emitConnect() [1/2]

void circt::firrtl::emitConnect ( ImplicitLocOpBuilder &  builder,
Value  lhs,
Value  rhs 
)

◆ emitConnect() [2/2]

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

Emit a connect between two values.

Definition at line 24 of file FIRRTLUtils.cpp.

References builder.

Referenced by applyGCTDataTaps(), connectLeafsTo(), emitConnect(), fixupConnect(), lowerInternalPathAnno(), lowerModuleBody(), and lowerModuleSignature().

◆ exportFIRFile()

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

Definition at line 1526 of file FIREmitter.cpp.

Referenced by mlirExportFIRRTL(), and registerToFIRFileTranslation().

◆ exportFIRVersion()

constexpr FIRVersion circt::firrtl::exportFIRVersion ( ,
,
 
)
constexpr

◆ extractDUT()

LogicalResult circt::firrtl::extractDUT ( FModuleOp  mod,
FModuleOp &  dut 
)

Utility that searches for a MarkDUTAnnotation on a specific module, mod, and tries to update a design-under-test (DUT), dut, with this module if the module is the DUT.

This function returns success if either no DUT was found or if the DUT was found and a previous DUT was not set (if dut is null). This returns failure if a DUT was found and a previous DUT was set. This function generates an error message in the failure case.

Definition at line 694 of file FIRRTLAnnotations.cpp.

References dutAnnoClass.

Referenced by LowerLayersPass::runOnOperation().

◆ 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 182 of file FIRRTLOps.cpp.

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

Referenced by checkConnectFlow(), circt::firrtl::FieldSource::FieldSource(), firrtlValueFoldFlow(), 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().

◆ foldWhenEncodedVerifOp()

ParseResult circt::firrtl::foldWhenEncodedVerifOp ( PrintFOp  printOp)

Chisel has a tendency to emit complex assert/assume/cover statements encoded as print operations with special formatting and metadata embedded in the message literal.

These always reside in a when block of the following form:

when invCond:
  printf(clock, UInt<1>(1), "...[verif-library-assert]...")
  stop(clock, UInt<1>(1), 1)

Depending on the nature the verification operation, the stop may be optional. The Scala implementation simply removes all stops that have the same condition as the printf.

Definition at line 225 of file FIRParserAsserts.cpp.

References Assert, AssertNotX, Assume, builder, ChiselAssert, Cover, circt::calyx::direction::get(), NoMod, TrueOrIsX, VerifLibAssert, VerifLibAssume, and VerifLibCover.

◆ fromOMIRJSON()

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

Convert a JSON value containing OMIR JSON (an array of OMNodes), convert this to an OMIRAnnotation, and add it to a mutable annotations argument.

◆ getAnnotationAttrName()

StringRef circt::firrtl::getAnnotationAttrName ( )
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 226 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 217 of file FIRRTLUtils.h.

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

◆ getBitWidth()

std::optional< int64_t > circt::firrtl::getBitWidth ( FIRRTLBaseType  type,
bool  ignoreFlip = false 
)

◆ getDeclarationKind()

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

Definition at line 259 of file FIRRTLOps.cpp.

References Instance, Other, and Port.

Referenced by checkConnectFlow().

◆ getDeltaRef()

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

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

Definition at line 490 of file FIRRTLUtils.cpp.

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

◆ getDialectAnnotationAttrName()

StringRef circt::firrtl::getDialectAnnotationAttrName ( )
inline

Return the name of the dialect-prefixed attribute used for annotations.

Definition at line 42 of file FIRRTLAnnotations.h.

Referenced by circt::firrtl::AnnotationSet::applyToPortAttrList(), and circt::firrtl::AnnotationSet::applyToPortDictionaryAttr().

◆ 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 212 of file FIRRTLUtils.cpp.

References Python.support::connect().

◆ 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 586 of file FIRRTLUtils.cpp.

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

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

◆ 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 516 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 829 of file FIRRTLUtils.cpp.

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

Referenced by getInnerRefTo(), LowerXMRPass::getInnerRefTo(), circt::firrtl::OpAnnoTarget::getNLAReference(), circt::firrtl::PortAnnoTarget::getNLAReference(), LowerXMRPass::handleInstanceOp(), LowerXMRPass::runOnOperation(), and ResolveTracesPass::runOnOperation().

◆ getInnerRefTo() [2/5]

static 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 198 of file FIRRTLUtils.h.

References getInnerRefTo().

◆ getInnerRefTo() [3/5]

static 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 206 of file FIRRTLUtils.h.

References getInnerRefTo().

◆ getInnerRefTo() [4/5]

static 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 168 of file FIRRTLUtils.h.

References getInnerRefTo().

◆ getInnerRefTo() [5/5]

static 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 175 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 107 of file FIRRTLOps.h.

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

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

◆ getIntAttr()

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

Utiility for generating a constant attribute.

Definition at line 167 of file FIRRTLUtils.cpp.

References assert(), and circt::calyx::direction::get().

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 188 of file FIRRTLUtils.cpp.

References getIntAttr(), and width.

◆ 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 181 of file FIRRTLUtils.cpp.

References getIntAttr(), and width.

Referenced by LowerXMRPass::handleRefResolve(), 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 223 of file FIRRTLUtils.cpp.

References Python.support::connect(), In, lookThroughWires(), and Out.

Referenced by 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 271 of file FIRRTLOps.cpp.

Referenced by addAnnotation(), addPortsToModule(), fixupAllModules(), 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 812 of file FIRRTLUtils.cpp.

References assert(), circt::hw::InnerSymTarget::getOp(), 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 784 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]

static 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 182 of file FIRRTLUtils.h.

References getOrAddInnerSym().

◆ getOrAddInnerSym() [4/7]

static 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 189 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 762 of file FIRRTLUtils.cpp.

References circt::calyx::direction::get().

Referenced by getInnerRefTo(), getOrAddInnerSym(), and Deduper::recordSymRenames().

◆ getOrAddInnerSym() [6/7]

static 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 155 of file FIRRTLUtils.h.

References getOrAddInnerSym().

◆ getOrAddInnerSym() [7/7]

static 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 161 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 39 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 195 of file FIRRTLUtils.cpp.

Referenced by WireOpConversion::matchAndRewrite(), and updateInstanceInClass().

◆ getSingleConnectUserOf()

StrictConnectOp 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 strict.

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 1723 of file FIRRTLFolds.cpp.

References Python.support::connect().

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 752 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 667 of file FIRRTLUtils.cpp.

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

Referenced by applyGCTDataTaps(), 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.

◆ 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 279 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 287 of file FIRRTLOps.cpp.

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

Referenced by canErase(), canonicalizeSingleSetConnect(), 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 135 of file FIRRTLFolds.cpp.

Referenced by canonicalizeSingleSetConnect(), and isDeletableWireOrRegOrNode().

◆ hash_value()

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

◆ hasZeroBitWidth()

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

Return true if the type has zero bit width.

Definition at line 835 of file FIRRTLTypes.cpp.

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

Referenced by 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.

Referenced by firrtlImportAnnotationsFromJSONRaw().

◆ importFIRFile()

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

◆ 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 820 of file FIRRTLTypes.cpp.

Referenced by customTypePrinter(), circt::firrtl::impl::inferComparisonResult(), and circt::firrtl::impl::inferReductionResult().

◆ 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 4494 of file FIRRTLOps.cpp.

Referenced by isConstant(), and isConstantLike().

◆ 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 4527 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 99 of file FIRRTLOps.cpp.

◆ isExpression()

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

Return true if the specified operation is a firrtl expression.

Definition at line 3865 of file FIRRTLOps.cpp.

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

Referenced by isEmittedInline(), and circt::ExportVerilog::isVerilogExpression().

◆ isModuleScopedDrivenBy()

template<typename A , typename... B>
static 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 59 of file FIRRTLUtils.h.

References getModuleScopedDriver(), and lookThroughWires().

◆ isOMIRStringEncodedPassthrough()

bool circt::firrtl::isOMIRStringEncodedPassthrough ( StringRef  type)

Check if an OMIR type is a string-encoded value that the FIRRTL dialect simply passes through as a string without any decoding.

Definition at line 682 of file FIRRTLAnnotations.cpp.

Referenced by scatterOMIR().

◆ 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::PortInfo::isInOut(), and circt::firrtl::ClassElement::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 1203 of file FIRRTLTypes.cpp.

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

◆ isValidDst()

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

Definition at line 68 of file FIRRTLOps.h.

References Sink.

Referenced by checkConnectFlow().

◆ isValidSrc()

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

Definition at line 64 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 964 of file FIRRTLUtils.cpp.

References circt::calyx::direction::get(), and width.

Referenced by 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 232 of file FIRRTLUtils.h.

References circt::calyx::direction::get().

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 246 of file FIRRTLUtils.h.

References circt::calyx::direction::get().

◆ 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 
)

Referenced by scatterOMField(), and scatterOMNode().

◆ 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 841 of file FIRRTLUtils.cpp.

References circt::calyx::direction::get().

◆ minimumFIRVersion()

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

◆ nextFIRVersion()

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

◆ operator<<() [1/6]

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/6]

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

◆ operator<<() [3/6]

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

Definition at line 129 of file FIRRTLAnnotationHelper.h.

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

◆ operator<<() [4/6]

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

Definition at line 117 of file FIRRTLAnnotationHelper.h.

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

◆ operator<<() [5/6]

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

◆ operator<<() [6/6]

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 95 of file FIRRTLOps.h.

◆ operator|=()

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

Definition at line 101 of file FIRRTLOps.h.

◆ parseNestedBaseType()

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

Definition at line 535 of file FIRRTLTypes.cpp.

References parseFIRRTLBaseType().

◆ parseNestedPropertyType()

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

Definition at line 545 of file FIRRTLTypes.cpp.

References parseFIRRTLPropertyType().

◆ 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 525 of file FIRRTLTypes.cpp.

References parseFIRRTLType().

◆ printNestedType()

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

Print a type defined by this dialect.

Definition at line 144 of file FIRRTLTypes.cpp.

◆ registerAnnotationRecord()

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

Register external annotation records.

Definition at line 512 of file LowerAnnotations.cpp.

References annotationRecords.

◆ registerFromFIRFileTranslation()

void circt::firrtl::registerFromFIRFileTranslation ( )

Definition at line 5633 of file FIRParser.cpp.

References 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 1145 of file FIRRTLReductions.cpp.

◆ registerToFIRFileTranslation()

void circt::firrtl::registerToFIRFileTranslation ( )

Definition at line 1538 of file FIREmitter.cpp.

References exportFIRFile(), and exportFIRVersion().

Referenced by circt::registerAllTranslations().

◆ resolveEntities()

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

◆ 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 applyGCTDataTaps(), and applyGCTMemTaps().

◆ 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 168 of file LowerAnnotations.cpp.

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

◆ swapFlow()

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

Get a flow's reverse.

Definition at line 156 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 applyGCTDataTaps(), applyGCTMemTaps(), resolvePath(), and stdResolveImpl().

◆ transformReduce() [1/2]

template<class IterTy , class ResultTy , class ReduceFuncTy , class TransformFuncTy >
static ResultTy circt::firrtl::transformReduce ( MLIRContext *  context,
IterTy  begin,
IterTy  end,
ResultTy  init,
ReduceFuncTy  reduce,
TransformFuncTy  transform 
)
static

Wrapper for llvm::parallelTransformReduce that performs the transform_reduce serially when MLIR multi-threading is disabled.

Does not add a ParallelDiagnosticHandler like mlir::parallelFor.

Definition at line 289 of file FIRRTLUtils.h.

Referenced by LowerLayersPass::runOnOperation(), ResolveTracesPass::runOnOperation(), and transformReduce().

◆ transformReduce() [2/2]

template<class RangeTy , class ResultTy , class ReduceFuncTy , class TransformFuncTy >
static ResultTy circt::firrtl::transformReduce ( MLIRContext *  context,
RangeTy &&  r,
ResultTy  init,
ReduceFuncTy  reduce,
TransformFuncTy  transform 
)
static

Range wrapper.

Definition at line 305 of file FIRRTLUtils.h.

References transformReduce().

◆ tryGetAs()

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

Implements the same behavior as DictionaryAttr::getAs<A> 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 390 of file FIRRTLAnnotationHelper.h.

◆ 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 185 of file LowerAnnotations.cpp.

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

◆ type_cast()

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

Definition at line 476 of file FIRRTLTypes.h.

References assert().

◆ type_dyn_cast()

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

Definition at line 495 of file FIRRTLTypes.h.

◆ type_dyn_cast_or_null()

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

Definition at line 503 of file FIRRTLTypes.h.

◆ type_isa()

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

Definition at line 452 of file FIRRTLTypes.h.

Referenced by type_isa_and_nonnull().

◆ type_isa_and_nonnull()

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

Definition at line 469 of file FIRRTLTypes.h.

References type_isa().

◆ verifyModuleLikeOpInterface()

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

Verification hook for verifying module like operations.

Definition at line 54 of file FIRRTLOpInterfaces.cpp.

References verifyNoInputProbes().

◆ walkDrivers()

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

◆ 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 706 of file FIRRTLUtils.cpp.

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

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

Variable Documentation

◆ addSeqMemPortAnnoClass

constexpr const char* circt::firrtl::addSeqMemPortAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.AddSeqMemPortAnnotation"

Definition at line 184 of file AnnotationDetails.h.

◆ addSeqMemPortsFileAnnoClass

constexpr const char* circt::firrtl::addSeqMemPortsFileAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.AddSeqMemPortsFileAnnotation"

Definition at line 186 of file AnnotationDetails.h.

◆ annotationRecords

llvm::StringMap<AnnoRecord> circt::firrtl::annotationRecords
static

Definition at line 410 of file LowerAnnotations.cpp.

Referenced by getAnnotationHandler(), and registerAnnotationRecord().

◆ attributeAnnoClass

constexpr const char* circt::firrtl::attributeAnnoClass = "firrtl.AttributeAnnotation"
constexpr

Definition at line 202 of file AnnotationDetails.h.

◆ augmentedBundleTypeClass

constexpr const char* circt::firrtl::augmentedBundleTypeClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.AugmentedBundleType"

Definition at line 107 of file AnnotationDetails.h.

◆ augmentedGroundTypeClass

constexpr const char* circt::firrtl::augmentedGroundTypeClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.AugmentedGroundType"

Definition at line 105 of file AnnotationDetails.h.

◆ blackBoxAnnoClass

constexpr const char* circt::firrtl::blackBoxAnnoClass
constexpr
Initial value:
=
"firrtl.transforms.BlackBox"

Definition at line 66 of file AnnotationDetails.h.

◆ blackBoxInlineAnnoClass

constexpr const char* circt::firrtl::blackBoxInlineAnnoClass
constexpr
Initial value:
=
"firrtl.transforms.BlackBoxInlineAnno"

Definition at line 58 of file AnnotationDetails.h.

◆ blackBoxPathAnnoClass

constexpr const char* circt::firrtl::blackBoxPathAnnoClass
constexpr
Initial value:
=
"firrtl.transforms.BlackBoxPathAnno"

Definition at line 60 of file AnnotationDetails.h.

◆ blackBoxResourceFileNameAnnoClass

constexpr const char* circt::firrtl::blackBoxResourceFileNameAnnoClass
constexpr
Initial value:
=
"firrtl.transforms.BlackBoxResourceFileNameAnno"

Definition at line 64 of file AnnotationDetails.h.

◆ blackBoxTargetDirAnnoClass

constexpr const char* circt::firrtl::blackBoxTargetDirAnnoClass
constexpr
Initial value:
=
"firrtl.transforms.BlackBoxTargetDirAnno"

Definition at line 62 of file AnnotationDetails.h.

◆ companionAnnoClass

constexpr const char* circt::firrtl::companionAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.ViewAnnotation.companion"

Definition at line 101 of file AnnotationDetails.h.

Referenced by applyGCTView().

◆ conventionAnnoClass

constexpr const char* circt::firrtl::conventionAnnoClass = "circt.ConventionAnnotation"
constexpr

Definition at line 31 of file AnnotationDetails.h.

Referenced by applyConventionAnno().

◆ convertMemToRegOfVecAnnoClass

constexpr const char* circt::firrtl::convertMemToRegOfVecAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.ConvertMemToRegOfVecAnnotation$"

Definition at line 170 of file AnnotationDetails.h.

◆ dataTapsBlackboxClass

constexpr const char* circt::firrtl::dataTapsBlackboxClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.DataTapsAnnotation.blackbox"

Definition at line 111 of file AnnotationDetails.h.

◆ dataTapsClass

constexpr const char* circt::firrtl::dataTapsClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.DataTapsAnnotation"

Definition at line 109 of file AnnotationDetails.h.

Referenced by applyGCTDataTaps().

◆ decodeTableAnnotation

constexpr const char* circt::firrtl::decodeTableAnnotation
constexpr
Initial value:
=
"chisel3.util.experimental.decode.DecodeTableAnnotation"

Definition at line 42 of file AnnotationDetails.h.

◆ dedupGroupAnnoClass

constexpr const char* circt::firrtl::dedupGroupAnnoClass
constexpr
Initial value:
=
"firrtl.transforms.DedupGroupAnnotation"

Definition at line 93 of file AnnotationDetails.h.

Referenced by Equivalence::Equivalence().

◆ deletedKeyClass

constexpr const char* circt::firrtl::deletedKeyClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.DeletedDataTapKey"

Definition at line 121 of file AnnotationDetails.h.

◆ dontObfuscateModuleAnnoClass

constexpr const char* circt::firrtl::dontObfuscateModuleAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.DontObfuscateModuleAnnotation"

Definition at line 154 of file AnnotationDetails.h.

◆ dontTouchAnnoClass

constexpr const char* circt::firrtl::dontTouchAnnoClass
constexpr

◆ dutAnnoClass

constexpr const char* circt::firrtl::dutAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.MarkDUTAnnotation"

Definition at line 144 of file AnnotationDetails.h.

Referenced by extractDUT().

◆ elaborationArtefactsDirectoryAnnoClass

constexpr const char* circt::firrtl::elaborationArtefactsDirectoryAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.ElaborationArtefactsDirectory"

Definition at line 158 of file AnnotationDetails.h.

◆ enumComponentAnnoClass

constexpr const char* circt::firrtl::enumComponentAnnoClass
constexpr
Initial value:
=
"chisel3.experimental.EnumAnnotations$EnumComponentAnnotation"

Definition at line 34 of file AnnotationDetails.h.

◆ enumDefAnnoClass

constexpr const char* circt::firrtl::enumDefAnnoClass
constexpr
Initial value:
=
"chisel3.experimental.EnumAnnotations$EnumDefAnnotation"

Definition at line 36 of file AnnotationDetails.h.

◆ enumVecAnnoClass

constexpr const char* circt::firrtl::enumVecAnnoClass
constexpr
Initial value:
=
"chisel3.experimental.EnumAnnotations$EnumVecAnnotation"

Definition at line 38 of file AnnotationDetails.h.

◆ excludeMemToRegAnnoClass

constexpr const char* circt::firrtl::excludeMemToRegAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.ExcludeMemFromMemToRegOfVec"

Definition at line 172 of file AnnotationDetails.h.

◆ extractAssertAnnoClass

constexpr const char* circt::firrtl::extractAssertAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.ExtractAssertionsAnnotation"

Definition at line 72 of file AnnotationDetails.h.

◆ extractAssumeAnnoClass

constexpr const char* circt::firrtl::extractAssumeAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.ExtractAssumptionsAnnotation"

Definition at line 74 of file AnnotationDetails.h.

◆ extractBlackBoxAnnoClass

constexpr const char* circt::firrtl::extractBlackBoxAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.ExtractBlackBoxAnnotation"

Definition at line 176 of file AnnotationDetails.h.

Referenced by isAnnoInteresting().

◆ extractClockGatesAnnoClass

constexpr const char* circt::firrtl::extractClockGatesAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.ExtractClockGatesFileAnnotation"

Definition at line 178 of file AnnotationDetails.h.

◆ extractCoverageAnnoClass

constexpr const char* circt::firrtl::extractCoverageAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.ExtractCoverageAnnotation"

Definition at line 76 of file AnnotationDetails.h.

◆ extractGrandCentralClass

constexpr const char* circt::firrtl::extractGrandCentralClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.ExtractGrandCentralAnnotation"

Definition at line 138 of file AnnotationDetails.h.

◆ extractSeqMemsAnnoClass

constexpr const char* circt::firrtl::extractSeqMemsAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.ExtractSeqMemsFileAnnotation"

Definition at line 180 of file AnnotationDetails.h.

◆ flattenAnnoClass

constexpr const char* circt::firrtl::flattenAnnoClass = "firrtl.transforms.FlattenAnnotation"
constexpr

Definition at line 44 of file AnnotationDetails.h.

◆ forceNameAnnoClass

constexpr const char* circt::firrtl::forceNameAnnoClass
constexpr
Initial value:
=
"chisel3.util.experimental.ForceNameAnnotation"

Definition at line 40 of file AnnotationDetails.h.

◆ fullAsyncResetAnnoClass

constexpr const char* circt::firrtl::fullAsyncResetAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.FullAsyncResetAnnotation"

Annotation that marks a reset (port or wire) and domain.

Definition at line 163 of file AnnotationDetails.h.

Referenced by SFCCompatPass::runOnOperation().

◆ grandCentralHierarchyFileAnnoClass

constexpr const char* circt::firrtl::grandCentralHierarchyFileAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.GrandCentralHierarchyFileAnnotation"

Definition at line 140 of file AnnotationDetails.h.

◆ ignoreFullAsyncResetAnnoClass

constexpr const char* circt::firrtl::ignoreFullAsyncResetAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.IgnoreFullAsyncResetAnnotation"

Annotation that marks a module as not belonging to any reset domain.

Definition at line 166 of file AnnotationDetails.h.

◆ injectDUTHierarchyAnnoClass

constexpr const char* circt::firrtl::injectDUTHierarchyAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.InjectDUTHierarchyAnnotation"

Definition at line 146 of file AnnotationDetails.h.

◆ inlineAnnoClass

constexpr const char* circt::firrtl::inlineAnnoClass = "firrtl.passes.InlineAnnotation"
constexpr

Definition at line 45 of file AnnotationDetails.h.

◆ internalKeyClass

constexpr const char* circt::firrtl::internalKeyClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.DataTapModuleSignalKey"

Definition at line 131 of file AnnotationDetails.h.

Referenced by applyGCTDataTaps().

◆ internalKeyPortClass

constexpr const char* circt::firrtl::internalKeyPortClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.DataTapModuleSignalKey.port"

Definition at line 133 of file AnnotationDetails.h.

◆ internalKeySourceClass

constexpr const char* circt::firrtl::internalKeySourceClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.DataTapModuleSignalKey.source"

Definition at line 135 of file AnnotationDetails.h.

◆ literalKeyClass

constexpr const char* circt::firrtl::literalKeyClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.LiteralDataTapKey"

Definition at line 123 of file AnnotationDetails.h.

◆ loadMemoryFromFileAnnoClass

constexpr const char* circt::firrtl::loadMemoryFromFileAnnoClass
constexpr
Initial value:
=
"firrtl.annotations.LoadMemoryAnnotation"

Definition at line 190 of file AnnotationDetails.h.

◆ loadMemoryFromFileInlineAnnoClass

constexpr const char* circt::firrtl::loadMemoryFromFileInlineAnnoClass
constexpr
Initial value:
=
"firrtl.annotations.MemoryFileInlineAnnotation"

Definition at line 192 of file AnnotationDetails.h.

◆ memTapBlackboxClass

constexpr const char* circt::firrtl::memTapBlackboxClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.MemTapAnnotation.blackbox"

Definition at line 115 of file AnnotationDetails.h.

◆ memTapClass

constexpr const char* circt::firrtl::memTapClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.MemTapAnnotation"

Definition at line 113 of file AnnotationDetails.h.

Referenced by applyGCTMemTaps().

◆ memTapPortClass

constexpr const char* circt::firrtl::memTapPortClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.MemTapAnnotation.port"

Definition at line 117 of file AnnotationDetails.h.

◆ memTapSourceClass

constexpr const char* circt::firrtl::memTapSourceClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.MemTapAnnotation.source"

Definition at line 119 of file AnnotationDetails.h.

◆ metadataDirectoryAttrName

constexpr const char* circt::firrtl::metadataDirectoryAttrName
constexpr
Initial value:
=
"sifive.enterprise.firrtl.MetadataDirAnnotation"

Definition at line 90 of file AnnotationDetails.h.

◆ moduleHierAnnoClass

constexpr const char* circt::firrtl::moduleHierAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.ModuleHierarchyAnnotation"

Definition at line 80 of file AnnotationDetails.h.

◆ mustDedupAnnoClass

constexpr const char* circt::firrtl::mustDedupAnnoClass
constexpr
Initial value:
=
"firrtl.transforms.MustDeduplicateAnnotation"

Definition at line 68 of file AnnotationDetails.h.

◆ noDedupAnnoClass

constexpr const char* circt::firrtl::noDedupAnnoClass = "firrtl.transforms.NoDedupAnnotation"
constexpr

Definition at line 92 of file AnnotationDetails.h.

Referenced by Equivalence::Equivalence().

◆ NoTargetAnnotation

AnnoRecord circt::firrtl::NoTargetAnnotation
static
Initial value:
applyWithoutTarget<false, CircuitOp>}
static std::optional< AnnoPathValue > noResolve(DictionaryAttr anno, ApplyState &state)
Always resolve to the circuit, ignoring the annotation.

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 407 of file LowerAnnotations.cpp.

◆ omirAnnoClass

constexpr const char* circt::firrtl::omirAnnoClass
constexpr
Initial value:
=
"freechips.rocketchip.objectmodel.OMIRAnnotation"

Definition at line 51 of file AnnotationDetails.h.

Referenced by applyOMIR(), scatterOMField(), and scatterOMNode().

◆ omirFileAnnoClass

constexpr const char* circt::firrtl::omirFileAnnoClass
constexpr
Initial value:
=
"freechips.rocketchip.objectmodel.OMIRFileAnnotation"

Definition at line 53 of file AnnotationDetails.h.

◆ omirTrackerAnnoClass

constexpr const char* circt::firrtl::omirTrackerAnnoClass
constexpr
Initial value:
=
"freechips.rocketchip.objectmodel.OMIRTracker"

Definition at line 55 of file AnnotationDetails.h.

Referenced by circt::firrtl::Annotation::canBeDeleted(), and scatterOMIR().

◆ prefixInterfacesAnnoClass

constexpr const char* circt::firrtl::prefixInterfacesAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.PrefixInterfacesAnnotation"

Definition at line 103 of file AnnotationDetails.h.

◆ prefixModulesAnnoClass

constexpr const char* circt::firrtl::prefixModulesAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.NestedPrefixModulesAnnotation"

Definition at line 152 of file AnnotationDetails.h.

Referenced by getPrefixInfo().

◆ rawAnnotations

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

Definition at line 25 of file AnnotationDetails.h.

◆ referenceKeyClass

constexpr const char* circt::firrtl::referenceKeyClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.ReferenceDataTapKey"

Definition at line 125 of file AnnotationDetails.h.

Referenced by applyGCTDataTaps().

◆ referenceKeyPortClass

constexpr const char* circt::firrtl::referenceKeyPortClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.ReferenceDataTapKey.port"

Definition at line 127 of file AnnotationDetails.h.

◆ referenceKeySourceClass

constexpr const char* circt::firrtl::referenceKeySourceClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.ReferenceDataTapKey.source"

Definition at line 129 of file AnnotationDetails.h.

◆ retimeModuleAnnoClass

constexpr const char* circt::firrtl::retimeModuleAnnoClass
constexpr
Initial value:
=
"freechips.rocketchip.util.RetimeModuleAnnotation"

Definition at line 86 of file AnnotationDetails.h.

◆ retimeModulesFileAnnoClass

constexpr const char* circt::firrtl::retimeModulesFileAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.RetimeModulesAnnotation"

Definition at line 84 of file AnnotationDetails.h.

◆ runFIRRTLTransformAnnoClass

constexpr const char* circt::firrtl::runFIRRTLTransformAnnoClass
constexpr
Initial value:
=
"firrtl.stage.RunFirrtlTransformAnnotation"

Definition at line 70 of file AnnotationDetails.h.

◆ scalaClassAnnoClass

constexpr const char* circt::firrtl::scalaClassAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.ScalaClassAnnotation"

Definition at line 156 of file AnnotationDetails.h.

◆ serializedViewAnnoClass

constexpr const char* circt::firrtl::serializedViewAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.GrandCentralView$SerializedViewAnnotation"

Definition at line 97 of file AnnotationDetails.h.

◆ sitestBlackBoxAnnoClass

constexpr const char* circt::firrtl::sitestBlackBoxAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.SitestBlackBoxAnnotation"

Definition at line 148 of file AnnotationDetails.h.

◆ sitestTestHarnessBlackBoxAnnoClass

constexpr const char* circt::firrtl::sitestTestHarnessBlackBoxAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.SitestTestHarnessBlackBoxAnnotation"

Definition at line 150 of file AnnotationDetails.h.

◆ testBenchDirAnnoClass

constexpr const char* circt::firrtl::testBenchDirAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.TestBenchDirAnnotation"

Definition at line 78 of file AnnotationDetails.h.

Referenced by LowerLayersPass::runOnOperation().

◆ testHarnessHierAnnoClass

constexpr const char* circt::firrtl::testHarnessHierAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.TestHarnessHierarchyAnnotation"

Definition at line 82 of file AnnotationDetails.h.

◆ testHarnessPathAnnoClass

constexpr const char* circt::firrtl::testHarnessPathAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.firrtl.TestHarnessPathAnnotation"

Definition at line 160 of file AnnotationDetails.h.

◆ traceAnnoClass

constexpr const char* circt::firrtl::traceAnnoClass
constexpr
Initial value:
=
"chisel3.experimental.Trace$TraceAnnotation"

Definition at line 48 of file AnnotationDetails.h.

Referenced by applyTraceName(), and ResolveTracesPass::runOnOperation().

◆ traceNameAnnoClass

constexpr const char* circt::firrtl::traceNameAnnoClass
constexpr
Initial value:
=
"chisel3.experimental.Trace$TraceNameAnnotation"

Definition at line 46 of file AnnotationDetails.h.

◆ verifBlackBoxAnnoClass

constexpr const char* circt::firrtl::verifBlackBoxAnnoClass
constexpr
Initial value:
=
"freechips.rocketchip.annotations.InternalVerifBlackBoxAnnotation"

Definition at line 88 of file AnnotationDetails.h.

◆ viewAnnoClass

constexpr const char* circt::firrtl::viewAnnoClass
constexpr
Initial value:
=
"sifive.enterprise.grandcentral.ViewAnnotation"

Definition at line 99 of file AnnotationDetails.h.

Referenced by applyGCTView().

◆ wiringSinkAnnoClass

constexpr const char* circt::firrtl::wiringSinkAnnoClass
constexpr
Initial value:
=
"firrtl.passes.wiring.SinkAnnotation"

Definition at line 196 of file AnnotationDetails.h.

Referenced by applyWiring().

◆ wiringSourceAnnoClass

constexpr const char* circt::firrtl::wiringSourceAnnoClass
constexpr
Initial value:
=
"firrtl.passes.wiring.SourceAnnotation"

Definition at line 198 of file AnnotationDetails.h.

Referenced by applyWiring().