mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-20 04:43:40 +00:00
Help and comments
This commit is contained in:
parent
cd15e211b7
commit
c0c0d9c559
1 changed files with 19 additions and 9 deletions
|
@ -27,9 +27,18 @@ PRIVATE_NAMESPACE_BEGIN
|
||||||
|
|
||||||
struct LongLoopSelect : public ScriptPass {
|
struct LongLoopSelect : public ScriptPass {
|
||||||
LongLoopSelect()
|
LongLoopSelect()
|
||||||
: ScriptPass("longloop_select", "Selects long for-loops (Creating logic above a certain logic depth) for further optimization")
|
: ScriptPass("longloop_select", "Selects long for-loops (Creating logic above a certain logic depth) for further optimizations")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void help() override
|
||||||
|
{
|
||||||
|
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||||
|
log("\n");
|
||||||
|
log(" longloop_select [-depth <for-loop threshold depth>] [-abc <ABC script>]\n");
|
||||||
|
log(" If no ABC script is provided, this pass simply selects cells in for-loops\n");
|
||||||
|
log(" If an ABC script is provided, this pass selects cells in a per for-loop basis and runs ABC with the given script\n");
|
||||||
|
log("\n");
|
||||||
|
}
|
||||||
void script() override {}
|
void script() override {}
|
||||||
|
|
||||||
// Adapted from the torder pass
|
// Adapted from the torder pass
|
||||||
|
@ -148,13 +157,14 @@ struct LongLoopSelect : public ScriptPass {
|
||||||
std::string loopInd = itrCluster->first;
|
std::string loopInd = itrCluster->first;
|
||||||
if (itrCluster->second.size() < threshold_depth) {
|
if (itrCluster->second.size() < threshold_depth) {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
log(" Skipping loop id %s as it contains only %ld cells\n", loopInd.c_str(), itrCluster->second.size());
|
log(" Skipping loop location %s as it contains only %ld cells\n", loopInd.c_str(),
|
||||||
|
itrCluster->second.size());
|
||||||
log_flush();
|
log_flush();
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (debug) {
|
if (debug) {
|
||||||
log(" Analyzing loop id %s containing %ld cells\n", loopInd.c_str(), itrCluster->second.size());
|
log(" Analyzing loop location %s containing %ld cells\n", loopInd.c_str(), itrCluster->second.size());
|
||||||
log_flush();
|
log_flush();
|
||||||
}
|
}
|
||||||
// For a given for-loop cell group, perform topological sorting to get the logic depth of the ending cell in
|
// For a given for-loop cell group, perform topological sorting to get the logic depth of the ending cell in
|
||||||
|
@ -168,8 +178,8 @@ struct LongLoopSelect : public ScriptPass {
|
||||||
log_flush();
|
log_flush();
|
||||||
}
|
}
|
||||||
if (logicdepth > (int)threshold_depth) {
|
if (logicdepth > (int)threshold_depth) {
|
||||||
log(" Selecting %ld cells in for-loop id %s of depth %d ending with cell %s\n", itrCluster->second.size(),
|
log(" Selecting %ld cells in for-loop location %s of depth %d ending with cell %s\n",
|
||||||
loopInd.c_str(), logicdepth, log_id((*itrLastCell)));
|
itrCluster->second.size(), loopInd.c_str(), logicdepth, log_id((*itrLastCell)));
|
||||||
log_flush();
|
log_flush();
|
||||||
std::string src_info = (*itrLastCell)->get_src_attribute();
|
std::string src_info = (*itrLastCell)->get_src_attribute();
|
||||||
if (!(*itrLastCell)->get_string_attribute("\\in_for_loop").empty()) {
|
if (!(*itrLastCell)->get_string_attribute("\\in_for_loop").empty()) {
|
||||||
|
@ -177,6 +187,7 @@ struct LongLoopSelect : public ScriptPass {
|
||||||
}
|
}
|
||||||
// Select all cells in the loop cluster
|
// Select all cells in the loop cluster
|
||||||
if (!abc_script.empty()) {
|
if (!abc_script.empty()) {
|
||||||
|
// If an ABC script is provided, select on a per-loop basis
|
||||||
Pass::call(design, "select -none");
|
Pass::call(design, "select -none");
|
||||||
}
|
}
|
||||||
for (auto cell : itrCluster->second) {
|
for (auto cell : itrCluster->second) {
|
||||||
|
@ -195,13 +206,12 @@ struct LongLoopSelect : public ScriptPass {
|
||||||
log_flush();
|
log_flush();
|
||||||
Pass::call(design, command);
|
Pass::call(design, command);
|
||||||
} else {
|
} else {
|
||||||
std::string command = "abc -map_src " + src_info+ src_info + " -script " + abc_script;
|
std::string command = "abc -map_src " + src_info + src_info + " -script " + abc_script;
|
||||||
log(" Executing: %s\n", command.c_str());
|
log(" Executing: %s\n", command.c_str());
|
||||||
log_flush();
|
log_flush();
|
||||||
Pass::call(design, command);
|
Pass::call(design, command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue