CIRCT
20.0.0git
|
#include "circt/Dialect/Emit/EmitOps.h"
#include "circt/Dialect/FIRRTL/AnnotationDetails.h"
#include "circt/Dialect/FIRRTL/FIRParser.h"
#include "circt/Dialect/FIRRTL/FIRRTLAnnotationHelper.h"
#include "circt/Dialect/FIRRTL/FIRRTLInstanceGraph.h"
#include "circt/Dialect/FIRRTL/FIRRTLOps.h"
#include "circt/Dialect/FIRRTL/FIRRTLUtils.h"
#include "circt/Dialect/FIRRTL/NLATable.h"
#include "circt/Dialect/FIRRTL/Namespace.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Dialect/HW/InnerSymbolNamespace.h"
#include "circt/Dialect/SV/SVDialect.h"
#include "circt/Dialect/SV/SVOps.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/Pass/Pass.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/JSON.h"
#include <functional>
#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 "omir" |
#define | GEN_PASS_DEF_EMITOMIR |
Functions | |
static IntegerAttr | isOMSRAM (Attribute &node) |
Check if an OMNode is an OMSRAM and requires special treatment of its instance path field. More... | |
static std::optional< Attribute > | scatterOMIR (Attribute original, ApplyState &state) |
Recursively walk Object Model IR and convert FIRRTL targets to identifiers while scattering trackers into the newAnnotations argument. More... | |
static std::optional< std::pair< StringRef, DictionaryAttr > > | scatterOMField (Attribute original, const Attribute root, unsigned index, ApplyState &state) |
Convert an Object Model Field into an optional pair of a string key and a dictionary attribute. More... | |
static std::optional< DictionaryAttr > | scatterOMNode (Attribute original, const Attribute root, ApplyState &state) |
Convert an Object Model Node to an optional dictionary, convert source locator strings to location attributes, and scatter FIRRTL targets into the circuit. More... | |
#define DEBUG_TYPE "omir" |
Definition at line 34 of file EmitOMIR.cpp.
#define GEN_PASS_DEF_EMITOMIR |
Definition at line 38 of file EmitOMIR.cpp.
|
static |
Check if an OMNode
is an OMSRAM
and requires special treatment of its instance path field.
This returns the ID of the tracker stored in the instancePath
or finalPath
field if the node has an array field omType
that contains a OMString:OMSRAM
entry.
Definition at line 169 of file EmitOMIR.cpp.
|
static |
Convert an Object Model Field into an optional pair of a string key and a dictionary attribute.
Expand internal source locator strings to location attributes. Scatter any FIRRTL targets into the circuit. If this is an illegal Object Model Field return None.
Each Object Model Field consists of three mandatory members with the following names and types:
The key is the "name" and the dictionary consists of the "info" and "value" members. Each value is recursively traversed to scatter any FIRRTL targets that may be used inside it.
This conversion from an object (dictionary) to key–value pair is safe because each Object Model Field in an Object Model Node must have a unique "name". Anything else is illegal Object Model.
Definition at line 362 of file EmitOMIR.cpp.
References circt::firrtl::ApplyState::circuit, circt::calyx::direction::get(), circt::firrtl::maybeStringToLocation(), circt::firrtl::omirAnnoClass, and scatterOMIR().
Referenced by scatterOMNode().
|
static |
Recursively walk Object Model IR and convert FIRRTL targets to identifiers while scattering trackers into the newAnnotations argument.
Object Model IR consists of a type hierarchy built around recursive arrays and dictionaries whose leaves are "string-encoded types". This is an Object Model-specific construct that puts type information alongside a value. Concretely, these look like:
'OM' type ':' value
This function is only concerned with unpacking types whose values are FIRRTL targets. This is because these need to be kept up-to-date with modifications made to the circuit whereas other types are just passing through CIRCT.
At a later time this understanding may be expanded or Object Model IR may become its own Dialect. At this time, this function is trying to do as minimal work as possible to just validate that the OMIR looks okay without doing lots of unnecessary unpacking/repacking of string-encoded types.
Definition at line 219 of file EmitOMIR.cpp.
References circt::firrtl::ApplyState::addToWorklistFn, circt::firrtl::ApplyState::circuit, circt::calyx::direction::get(), circt::firrtl::isOMIRStringEncodedPassthrough(), circt::firrtl::ApplyState::newID(), and circt::firrtl::omirTrackerAnnoClass.
Referenced by scatterOMField().
|
static |
Convert an Object Model Node to an optional dictionary, convert source locator strings to location attributes, and scatter FIRRTL targets into the circuit.
If this is an illegal Object Model Node, then return None.
An Object Model Node is expected to look like:
The "fields" member may be absent. If so, then construct an empty array.
The input attribute must be a dictionary.
Definition at line 428 of file EmitOMIR.cpp.
References circt::firrtl::ApplyState::circuit, circt::calyx::direction::get(), circt::firrtl::maybeStringToLocation(), circt::firrtl::omirAnnoClass, and scatterOMField().
Referenced by circt::firrtl::applyOMIR().