3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-05-07 15:55:47 +00:00

Merge pull request #29 from alaindargelas/loop_info_3

Selective boolopt
This commit is contained in:
Akash Levy 2024-12-01 12:36:09 -05:00 committed by GitHub
commit 620bf51c50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 316 additions and 39 deletions

View file

@ -17,8 +17,6 @@
*
*/
#ifdef VERIFIC_LINEFILE_INCLUDES_LOOPS
#include <stack>
/*
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
@ -41,7 +39,7 @@ class DecorateLoopsVisitor : public VeriVisitor
// 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++;
outerLoopId = node.Linefile();
}
loopStack.push((VeriLoop *)&node);
}
@ -58,7 +56,7 @@ class DecorateLoopsVisitor : public VeriVisitor
if (loopStack.size()) {
if (loopStack.top() == (VeriLoop *)&node) {
loopStack.pop();
std::cout << "Loop out: " << (VeriFor *)&node << std::endl;
// std::cout << "Loop out: " << (VeriFor *)&node << std::endl;
return;
}
Verific::linefile_type linefile = (Verific::linefile_type)node.Linefile();
@ -73,6 +71,6 @@ class DecorateLoopsVisitor : public VeriVisitor
private:
std::stack<VeriLoop *> loopStack;
uint32_t outerLoopId = 0;
linefile_type outerLoopId = nullptr;
};
#endif

View file

@ -55,6 +55,7 @@ USING_YOSYS_NAMESPACE
#include "VeriLibrary.h"
#include "VeriExpression.h"
#ifdef VERIFIC_LINEFILE_INCLUDES_LOOPS
#include "VeriStatement.h"
#include "VeriConstVal.h"
#endif
#endif
@ -430,8 +431,8 @@ void VerificImporter::import_attributes(dict<RTLIL::IdString, RTLIL::Const> &att
if (obj->Linefile()) {
attributes[ID::src] = stringf("%s:%d.%d-%d.%d", LineFile::GetFileName(obj->Linefile()), obj->Linefile()->GetLeftLine(), obj->Linefile()->GetLeftCol(), obj->Linefile()->GetRightLine(), obj->Linefile()->GetRightCol());
#ifdef VERIFIC_LINEFILE_INCLUDES_LOOPS
if (uint32_t loopid = obj->Linefile()->GetInLoop()) {
attributes[RTLIL::escape_id("in_loop_" + std::to_string(loopid))] = std::to_string(loopid);
if (linefile_type loopid = obj->Linefile()->GetInLoop()) {
attributes[RTLIL::escape_id("in_for_loop")] = stringf("%s:%d.%d-%d.%d", LineFile::GetFileName(loopid), loopid->GetLeftLine(), loopid->GetLeftCol(), loopid->GetRightLine(), loopid->GetRightCol());
}
#endif
}