134 SmallVector<std::pair<mlir::Value, std::string>> ¤tMap,
136 SmallVector<std::pair<mlir::Value, std::string>> res;
137 for (
auto [i, v] : llvm::enumerate(values)) {
139 for (
const auto &[key, value] : currentMap) {
141 res.push_back({v, value});
146 std::string name =
"in_" + std::to_string(currentMap.size());
147 if (tokenFlag && i % 2 == 0)
148 name =
"token_" + std::to_string(currentMap.size());
149 res.push_back({v, name});
150 currentMap.push_back({v, name});
159 SmallVector<std::pair<mlir::Value, std::string>> &valuesMap) {
161 auto tokenFlag =
false;
162 if (isa<dc::UnpackOp>(op))
165 DotNode n = {NodeType::Null,
valueToName(op.getOperands(), valuesMap,
false),
166 valueToName(op.getOperands(), valuesMap, tokenFlag)};
168 TypeSwitch<mlir::Operation *>(&op)
169 .Case([&](dc::BranchOp) { n.nodeType = NodeType::BranchOp; })
170 .Case([&](dc::BufferOp) { n.nodeType = NodeType::BufferOp; })
171 .Case([&](dc::ForkOp) { n.nodeType = NodeType::ForkOp; })
172 .Case([&](dc::FromESIOp) { n.nodeType = NodeType::FromESIOp; })
173 .Case([&](dc::JoinOp) { n.nodeType = NodeType::JoinOp; })
174 .Case([&](dc::MergeOp) { n.nodeType = NodeType::MergeOp; })
175 .Case([&](dc::PackOp) { n.nodeType = NodeType::PackOp; })
176 .Case([&](dc::SelectOp) { n.nodeType = NodeType::SelectOp; })
177 .Case([&](dc::SinkOp) { n.nodeType = NodeType::SinkOp; })
178 .Case([&](dc::SourceOp) { n.nodeType = NodeType::SourceOp; })
179 .Case([&](dc::ToESIOp) { n.nodeType = NodeType::ToESIOp; })
180 .Case([&](dc::UnpackOp) { n.nodeType = NodeType::UnpackOp; });
188 SmallVector<std::pair<mlir::Value, std::string>> &valuesMap) {
190 DotNode n = {NodeType::Null,
valueToName(op.getOperands(), valuesMap,
false),
193 TypeSwitch<mlir::Operation *>(&op)
194 .Case([&](
comb::AddOp) { n.nodeType = NodeType::AddOp; })
195 .Case([&](
comb::AndOp) { n.nodeType = NodeType::AndOp; })
196 .Case([&](
comb::XorOp) { n.nodeType = NodeType::XorOp; })
197 .Case([&](
comb::OrOp) { n.nodeType = NodeType::OrOp; })
198 .Case([&](
comb::MulOp) { n.nodeType = NodeType::MulOp; })
199 .Case([&](
comb::MuxOp) { n.nodeType = NodeType::MuxOp; })
200 .Case<comb::ICmpOp>([&](
auto op) {
201 switch (op.getPredicate()) {
202 case circt::comb::ICmpPredicate::eq: {
203 n.nodeType = NodeType::EqOp;
206 case circt::comb::ICmpPredicate::ne: {
207 n.nodeType = NodeType::NeOp;
210 case circt::comb::ICmpPredicate::sgt: {
211 n.nodeType = NodeType::GtOp;
214 case circt::comb::ICmpPredicate::sge: {
215 n.nodeType = NodeType::GeOp;
218 case circt::comb::ICmpPredicate::slt: {
219 n.nodeType = NodeType::LtOp;
222 case circt::comb::ICmpPredicate::sle: {
223 n.nodeType = NodeType::LeOp;
226 case circt::comb::ICmpPredicate::ugt: {
227 n.nodeType = NodeType::GtOp;
230 case circt::comb::ICmpPredicate::uge: {
231 n.nodeType = NodeType::GeOp;
234 case circt::comb::ICmpPredicate::ult: {
235 n.nodeType = NodeType::LeOp;
238 case circt::comb::ICmpPredicate::ule: {
239 n.nodeType = NodeType::LtOp;
242 case circt::comb::ICmpPredicate::ceq: {
243 n.nodeType = NodeType::EqOp;
246 case circt::comb::ICmpPredicate::cne: {
247 n.nodeType = NodeType::NeOp;
250 case circt::comb::ICmpPredicate::weq: {
251 n.nodeType = NodeType::EqOp;
254 case circt::comb::ICmpPredicate::wne: {
255 n.nodeType = NodeType::NeOp;
static DotNode createDCNode(Operation &op, SmallVector< std::pair< mlir::Value, std::string > > &valuesMap)
creates node in the dataflow graph for DC operations
static SmallVector< std::pair< mlir::Value, std::string > > valueToName(const SmallVector< mlir::Value > &values, SmallVector< std::pair< mlir::Value, std::string > > ¤tMap, bool tokenFlag)
gives a unique name to each value in the graph
static DotNode createCombNode(Operation &op, SmallVector< std::pair< mlir::Value, std::string > > &valuesMap)
creates node in the dataflow graph for Comb operations