26 using namespace circt;
27 using namespace firrtl;
30 FModuleOp mod = cast<FModuleOp>(operation);
32 for (
auto port : mod.getBodyBlock()->getArguments())
35 mod.walk<mlir::WalkOrder::PreOrder>([&](Operation *op) {
visitOp(op); });
39 if (
auto sf = dyn_cast<SubfieldOp>(op))
41 if (
auto si = dyn_cast<SubindexOp>(op))
43 if (
auto sa = dyn_cast<SubaccessOp>(op))
45 if (isa<WireOp, RegOp, RegResetOp>(op))
48 if (
auto mem = dyn_cast<MemOp>(op))
50 if (
auto inst = dyn_cast<InstanceOp>(op))
54 if (op->getNumResults()) {
55 auto type = op->getResult(0).getType();
56 if (
auto baseType = type_dyn_cast<FIRRTLBaseType>(type);
57 baseType && !baseType.isGround())
64 auto value = sf.getInput();
66 assert(node &&
"node should be in the map");
68 sv.push_back(sf.getFieldIndex());
73 auto value = si.getInput();
75 assert(node &&
"node should be in the map");
77 sv.push_back(si.getIndex());
82 auto value = sa.getInput();
84 assert(node &&
"node should be in the map");
91 for (
auto r : mem.getResults())
96 for (
auto r : inst.getResults())
101 auto ii =
paths.find(v);
102 if (ii ==
paths.end())
109 auto ii =
paths.try_emplace(dst, src, path, flow);
111 assert(ii.second &&
"Double insert into the map");
assert(baseType &&"element must be base type")
const PathNode * nodeForValue(Value v) const
void visitSubaccess(SubaccessOp sa)
void visitOp(Operation *op)
DenseMap< Value, PathNode > paths
void visitSubfield(SubfieldOp sf)
FieldSource(Operation *operation)
void visitInst(InstanceOp inst)
void makeNodeForValue(Value dst, Value src, ArrayRef< int64_t > path, Flow flow)
void visitSubindex(SubindexOp si)
Flow foldFlow(Value val, Flow accumulatedFlow=Flow::Source)
Compute the flow for a Value, val, as determined by the FIRRTL specification.
This file defines an intermediate representation for circuits acting as an abstraction for constraint...