14 using namespace circt;
18 SmallVector<unsigned>
seq;
19 for (
size_t i = 0; i < size; ++i)
26 Operation *defOp = v.getDefiningOp();
27 if (
auto inst = dyn_cast_or_null<hw::InstanceOp>(defOp)) {
28 Operation *modOp = syms.
getDefinition(inst.getModuleNameAttr());
30 assert(isa<hw::HWModuleLike>(modOp) &&
"Instance must point to a module");
31 OpResult instResult = cast<OpResult>(v);
32 auto mod = cast<hw::HWModuleLike>(modOp);
34 llvm::raw_string_ostream os(buff);
35 os << inst.getInstanceName() <<
".";
36 StringAttr name = mod.getOutputNameAttr(instResult.getResultNumber());
38 os << name.getValue();
42 if (
auto blockArg = dyn_cast<BlockArgument>(v)) {
44 cast<hw::PortList>(blockArg.getOwner()->getParent()->getParentOp())
48 if (
auto constOp = dyn_cast<hw::ConstantOp>(defOp)) {
50 llvm::raw_string_ostream(buff) <<
"c" << constOp.getValue();
assert(baseType &&"element must be base type")
Default symbol cache implementation; stores associations between names (StringAttr's) to mlir::Operat...
mlir::Operation * getDefinition(mlir::Attribute attr) const override
Lookup a definition for 'symbol' in the cache.
StringRef getValueName(Value v, const SymbolCache &syms, std::string &buff)
Try to get a "good" name for the given Value.
SmallVector< unsigned > makeSequentialRange(unsigned size)
Utility for creating {0, 1, 2, ..., size}.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
This holds a decoded list of input/inout and output ports for a module or instance.
PortInfo & atInput(size_t idx)
StringRef getName() const