From dc9d61ed61250197dd4153483ef6ed3ecb554b09 Mon Sep 17 00:00:00 2001 From: Alain Dargelas Date: Thu, 21 Nov 2024 11:24:00 -0800 Subject: [PATCH] Loop info --- frontends/verific/decorate_loops.h | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/frontends/verific/decorate_loops.h b/frontends/verific/decorate_loops.h index a169d7126..acd3a2d9b 100644 --- a/frontends/verific/decorate_loops.h +++ b/frontends/verific/decorate_loops.h @@ -21,10 +21,10 @@ This Visitor decorates the AST with a loop ID attribute for all outer for loops. All AST nodes contained within the subtree of an outer for-loop have the same ID carried as an additional payload of the "linefile" struct. - The ID is unique accross the flat RTL module set, as it is computed before elaboration. + The ID is unique accross the flat RTL module set, as it is computed before elaboration. It is not unique per instance of the modules. - A further separation of cells belonging to a given loop instance is necessary by means of - connectivity analysis. + A further separation of cells belonging to a given loop instance is necessary by means of + connectivity analysis. No "loop instance" information seems to exist to cluster those loops elements together unfortunately. */ class DecorateLoopsVisitor : public VeriVisitor @@ -34,25 +34,25 @@ class DecorateLoopsVisitor : public VeriVisitor ~DecorateLoopsVisitor() {}; virtual void VERI_VISIT(VeriLoop, node) { - //std::cout << "Loop in: " << (VeriLoop *)&node << " id: " << outerLoopId << std::endl; + // std::cout << "Loop in: " << (VeriLoop *)&node << " id: " << outerLoopId << std::endl; if (loopStack.empty()) { - // We increase the loop count when we enter a new set of imbricated loops, - // That way we have a loop index for the outermost loop as we want to identify and group - // logic generated by imbricated loops + // We increase the loop count when we enter a new set of imbricated loops, + // That way we have a loop index for the outermost loop as we want to identify and group + // logic generated by imbricated loops outerLoopId++; } loopStack.push((VeriLoop *)&node); } - void PreAction(VeriTreeNode &/*node*/) + void PreAction(VeriTreeNode & /*node*/) { - //VeriNode *vnode = dynamic_cast(&node); - //std::cout << "Node pre: " << vnode << std::endl; + // VeriNode *vnode = dynamic_cast(&node); + // std::cout << "Node pre: " << vnode << std::endl; } virtual void PostAction(VeriTreeNode &node) { - //std::cout << "Node post: " << (VeriTreeNode *)&node << std::endl; + // std::cout << "Node post: " << (VeriTreeNode *)&node << std::endl; if (loopStack.size()) { if (loopStack.top() == (VeriLoop *)&node) { loopStack.pop(); @@ -60,11 +60,11 @@ class DecorateLoopsVisitor : public VeriVisitor return; } Verific::linefile_type linefile = (Verific::linefile_type)node.Linefile(); - // Unfortunately there is no good way to systematically copy certain AST attributes to the Netlist attributes like: - //VeriNode *vnode = dynamic_cast(&node); - //vnode->AddAttribute(" in_loop", new VeriIntVal(outerLoopId)); - // Instead using linefile struct to pass that information: - if (linefile) + // Unfortunately there is no good way to systematically copy certain AST attributes to the Netlist attributes like: + // VeriNode *vnode = dynamic_cast(&node); + // vnode->AddAttribute(" in_loop", new VeriIntVal(outerLoopId)); + // Instead using linefile struct to pass that information: + if (linefile) linefile->SetInLoop(outerLoopId); } }