CIRCT
20.0.0git
|
#include "circt/Dialect/FIRRTL/FIRRTLOps.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "mlir/Pass/Pass.h"
#include "circt/Dialect/FIRRTL/AnnotationDetails.h"
#include "circt/Dialect/FIRRTL/CHIRRTLDialect.h"
#include "circt/Dialect/FIRRTL/FIRRTLAnnotationHelper.h"
#include "circt/Dialect/FIRRTL/FIRRTLAnnotations.h"
#include "circt/Dialect/FIRRTL/FIRRTLAttributes.h"
#include "circt/Dialect/FIRRTL/FIRRTLInstanceGraph.h"
#include "circt/Dialect/FIRRTL/FIRRTLTypes.h"
#include "circt/Dialect/FIRRTL/FIRRTLUtils.h"
#include "circt/Dialect/FIRRTL/FIRRTLVisitors.h"
#include "circt/Dialect/FIRRTL/Namespace.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/SV/SVAttributes.h"
#include "circt/Support/Debug.h"
#include "mlir/IR/Diagnostics.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Debug.h"
#include "circt/Dialect/FIRRTL/Passes.h.inc"
Go to the source code of this file.
Namespaces | |
circt | |
The InstanceGraph op interface, see InstanceGraphInterface.td for more details. | |
circt::firrtl | |
Macros | |
#define | DEBUG_TYPE "lower-annos" |
#define | GEN_PASS_DEF_LOWERFIRRTLANNOTATIONS |
Functions | |
static ArrayAttr | getAnnotationsFrom (Operation *op) |
Get annotations or an empty set of annotations. More... | |
static ArrayAttr | appendArrayAttr (ArrayAttr array, Attribute a) |
Construct the annotation array with a new thing appended. More... | |
static ArrayAttr | replaceArrayAttrElement (ArrayAttr array, size_t elem, Attribute newVal) |
Update an ArrayAttribute by replacing one entry. More... | |
static void | addAnnotation (AnnoTarget ref, unsigned fieldIdx, ArrayRef< NamedAttribute > anno) |
Apply a new annotation to a resolved target. More... | |
static FlatSymbolRefAttr | buildNLA (const AnnoPathValue &target, ApplyState &state) |
Make an anchor for a non-local annotation. More... | |
static FlatSymbolRefAttr | scatterNonLocalPath (const AnnoPathValue &target, ApplyState &state) |
Scatter breadcrumb annotations corresponding to non-local annotations along the instance path. More... | |
static std::optional< AnnoPathValue > | noResolve (DictionaryAttr anno, ApplyState &state) |
Always resolve to the circuit, ignoring the annotation. More... | |
static std::optional< AnnoPathValue > | stdResolveImpl (StringRef rawPath, ApplyState &state) |
Implementation of standard resolution. More... | |
LogicalResult | drop (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state) |
Just drop the annotation. More... | |
static LogicalResult | applyDUTAnno (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state) |
static std::optional< Convention > | parseConvention (llvm::StringRef str) |
static LogicalResult | applyConventionAnno (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state) |
static LogicalResult | applyModulePrefixAnno (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state) |
static LogicalResult | applyAttributeAnnotation (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state) |
template<bool isInline> | |
static LogicalResult | applyLoadMemoryAnno (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state) |
Update a memory op with attributes about memory file loading. More... | |
static LogicalResult | applyOutputDirAnno (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state) |
static LogicalResult | convertToFullResetAnnotation (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state) |
Convert from FullAsyncResetAnnotation to FullResetAnnotation. More... | |
static LogicalResult | convertToExcludeFromFullResetAnnotation (const AnnoPathValue &target, DictionaryAttr anno, ApplyState &state) |
Convert from IgnoreFullAsyncResetAnnotation to ExcludeFromFullResetAnnotation. More... | |
LogicalResult | circt::firrtl::registerAnnotationRecord (StringRef annoClass, AnnoRecord annoRecord, const std::function< void(llvm::Twine)> &errorHandler={}) |
Register external annotation records. More... | |
static const AnnoRecord * | getAnnotationHandler (StringRef annoStr, bool ignoreAnnotationUnknown) |
Lookup a record for a given annotation class. More... | |
Variables | |
static AnnoRecord | circt::firrtl::NoTargetAnnotation |
Resolution and application of a "firrtl.annotations.NoTargetAnnotation". More... | |
static llvm::StringMap< AnnoRecord > | circt::firrtl::annotationRecords |
#define DEBUG_TYPE "lower-annos" |
Definition at line 41 of file LowerAnnotations.cpp.
#define GEN_PASS_DEF_LOWERFIRRTLANNOTATIONS |
Definition at line 45 of file LowerAnnotations.cpp.
|
static |
Apply a new annotation to a resolved target.
This handles ports, aggregates, modules, wires, etc.
Definition at line 80 of file LowerAnnotations.cpp.
References appendArrayAttr(), circt::calyx::direction::get(), circt::firrtl::getAnnotationAttrName(), getAnnotationsFrom(), circt::firrtl::getNumPorts(), circt::firrtl::AnnoTarget::getOp(), circt::firrtl::getPortAnnotationAttrName(), and replaceArrayAttrElement().
Referenced by applyDUTAnno(), and circt::firrtl::applyWithoutTargetImpl().
|
static |
Construct the annotation array with a new thing appended.
Definition at line 62 of file LowerAnnotations.cpp.
References circt::calyx::direction::get().
Referenced by addAnnotation().
|
static |
Definition at line 357 of file LowerAnnotations.cpp.
References circt::sv::addSVAttributes(), circt::calyx::direction::get(), circt::firrtl::AnnoTarget::getOp(), circt::firrtl::AnnoPathValue::isLocal(), and circt::firrtl::AnnoPathValue::ref.
|
static |
Definition at line 278 of file LowerAnnotations.cpp.
References circt::firrtl::conventionAnnoClass, circt::firrtl::AnnoTarget::getOp(), circt::firrtl::AnnoPathValue::isLocal(), parseConvention(), and circt::firrtl::AnnoPathValue::ref.
|
static |
Definition at line 248 of file LowerAnnotations.cpp.
References addAnnotation(), circt::firrtl::AnnoPathValue::fieldIdx, circt::firrtl::AnnoTarget::getOp(), circt::firrtl::AnnoPathValue::isLocal(), and circt::firrtl::AnnoPathValue::ref.
|
static |
Update a memory op with attributes about memory file loading.
Definition at line 388 of file LowerAnnotations.cpp.
References circt::firrtl::ApplyState::circuit, circt::calyx::direction::get(), circt::firrtl::AnnoTarget::getOp(), circt::firrtl::AnnoPathValue::isLocal(), circt::firrtl::AnnoPathValue::isOpOfType(), and circt::firrtl::AnnoPathValue::ref.
|
static |
Definition at line 321 of file LowerAnnotations.cpp.
References circt::firrtl::AnnoTarget::getOp(), circt::firrtl::AnnoPathValue::isLocal(), circt::firrtl::modulePrefixAnnoClass, and circt::firrtl::AnnoPathValue::ref.
|
static |
Definition at line 435 of file LowerAnnotations.cpp.
References circt::firrtl::AnnoTarget::getOp(), circt::firrtl::AnnoPathValue::isLocal(), circt::firrtl::outputDirAnnoClass, and circt::firrtl::AnnoPathValue::ref.
|
static |
Make an anchor for a non-local annotation.
Use the expanded path to build the module and name list in the anchor.
Definition at line 119 of file LowerAnnotations.cpp.
References circt::firrtl::ApplyState::circuit, circt::calyx::direction::get(), circt::firrtl::AnnoTarget::getModule(), circt::firrtl::ApplyState::getNamespace(), circt::firrtl::HierPathCache::getRefFor(), circt::firrtl::ApplyState::hierPathCache, circt::firrtl::AnnoPathValue::instances, and circt::firrtl::AnnoPathValue::ref.
Referenced by scatterNonLocalPath().
|
static |
Convert from IgnoreFullAsyncResetAnnotation to ExcludeFromFullResetAnnotation.
Definition at line 496 of file LowerAnnotations.cpp.
References circt::firrtl::excludeFromFullResetAnnoClass, circt::calyx::direction::get(), circt::firrtl::AnnoTarget::getOp(), circt::firrtl::ignoreFullAsyncResetAnnoClass, and circt::firrtl::AnnoPathValue::ref.
|
static |
Convert from FullAsyncResetAnnotation to FullResetAnnotation.
Definition at line 475 of file LowerAnnotations.cpp.
References circt::firrtl::fullAsyncResetAnnoClass, circt::firrtl::fullResetAnnoClass, circt::calyx::direction::get(), circt::firrtl::AnnoTarget::getOp(), and circt::firrtl::AnnoPathValue::ref.
LogicalResult drop | ( | const AnnoPathValue & | target, |
DictionaryAttr | anno, | ||
ApplyState & | state | ||
) |
Just drop the annotation.
This is intended for Annotations which are known, but can be safely ignored.
Definition at line 240 of file LowerAnnotations.cpp.
|
static |
Lookup a record for a given annotation class.
Optionally, returns the record for "circuit.missing" if the record doesn't exist.
Definition at line 654 of file LowerAnnotations.cpp.
References circt::firrtl::annotationRecords.
|
static |
Get annotations or an empty set of annotations.
Definition at line 55 of file LowerAnnotations.cpp.
References circt::calyx::direction::get(), and circt::firrtl::getAnnotationAttrName().
Referenced by addAnnotation().
|
static |
Always resolve to the circuit, ignoring the annotation.
Definition at line 151 of file LowerAnnotations.cpp.
References circt::firrtl::ApplyState::circuit.
|
static |
Definition at line 272 of file LowerAnnotations.cpp.
Referenced by applyConventionAnno().
|
static |
Update an ArrayAttribute by replacing one entry.
Definition at line 71 of file LowerAnnotations.cpp.
References circt::calyx::direction::get().
Referenced by addAnnotation().
|
static |
Scatter breadcrumb annotations corresponding to non-local annotations along the instance path.
Returns symbol name used to anchor annotations to path.
Definition at line 139 of file LowerAnnotations.cpp.
References buildNLA().
Referenced by circt::firrtl::applyWithoutTargetImpl().
|
static |
Implementation of standard resolution.
First parses the target path, then resolves it.
Definition at line 158 of file LowerAnnotations.cpp.
References circt::firrtl::canonicalizeTarget(), circt::firrtl::ApplyState::circuit, circt::firrtl::resolveEntities(), circt::firrtl::ApplyState::symTbl, circt::firrtl::ApplyState::targetCaches, and circt::firrtl::tokenizePath().
Referenced by circt::firrtl::stdResolve(), and circt::firrtl::tryResolve().