mirror of https://github.com/YosysHQ/yosys.git
Added help messages to proc_* passes
This commit is contained in:
parent
36954471a6
commit
f952309c81
|
@ -23,7 +23,25 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
struct ProcPass : public Pass {
|
struct ProcPass : public Pass {
|
||||||
ProcPass() : Pass("proc") { }
|
ProcPass() : Pass("proc", "translate processes to netlists") { }
|
||||||
|
virtual void help()
|
||||||
|
{
|
||||||
|
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||||
|
log("\n");
|
||||||
|
log(" proc [selection]\n");
|
||||||
|
log("\n");
|
||||||
|
log("This pass calls all the other proc_* passes in the most common order.\n");
|
||||||
|
log("\n");
|
||||||
|
log(" proc_clean\n");
|
||||||
|
log(" proc_rmdead\n");
|
||||||
|
log(" proc_arst\n");
|
||||||
|
log(" proc_mux\n");
|
||||||
|
log(" proc_dff\n");
|
||||||
|
log(" proc_clean\n");
|
||||||
|
log("\n");
|
||||||
|
log("This replaces the processes in the design with multiplexers and flip-flops.\n");
|
||||||
|
log("\n");
|
||||||
|
}
|
||||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||||
{
|
{
|
||||||
log_header("Executing PROC pass (convert processes to netlists).\n");
|
log_header("Executing PROC pass (convert processes to netlists).\n");
|
||||||
|
|
|
@ -174,16 +174,29 @@ static void proc_arst(RTLIL::Module *mod, RTLIL::Process *proc, SigMap &assign_m
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProcArstPass : public Pass {
|
struct ProcArstPass : public Pass {
|
||||||
ProcArstPass() : Pass("proc_arst") { }
|
ProcArstPass() : Pass("proc_arst", "detect asynchronous resets") { }
|
||||||
|
virtual void help()
|
||||||
|
{
|
||||||
|
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||||
|
log("\n");
|
||||||
|
log(" proc_arst [selection]\n");
|
||||||
|
log("\n");
|
||||||
|
log("This pass identifies asynchronous resets in the processes and converts them\n");
|
||||||
|
log("to a different internal representation that is suitable for generating\n");
|
||||||
|
log("flip-flop cells with asynchronous resets.\n");
|
||||||
|
log("\n");
|
||||||
|
}
|
||||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||||
{
|
{
|
||||||
log_header("Executing PROC_ARST pass (detect async resets in processes).\n");
|
log_header("Executing PROC_ARST pass (detect async resets in processes).\n");
|
||||||
|
|
||||||
extra_args(args, 1, design);
|
extra_args(args, 1, design);
|
||||||
|
|
||||||
for (auto &mod_it : design->modules) {
|
for (auto &mod_it : design->modules)
|
||||||
|
if (design->selected(mod_it.second)) {
|
||||||
SigMap assign_map(mod_it.second);
|
SigMap assign_map(mod_it.second);
|
||||||
for (auto &proc_it : mod_it.second->processes)
|
for (auto &proc_it : mod_it.second->processes)
|
||||||
|
if (design->selected(mod_it.second, proc_it.second))
|
||||||
proc_arst(mod_it.second, proc_it.second, assign_map);
|
proc_arst(mod_it.second, proc_it.second, assign_map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,17 @@ static void proc_clean(RTLIL::Module *mod, RTLIL::Process *proc, int &total_coun
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProcCleanPass : public Pass {
|
struct ProcCleanPass : public Pass {
|
||||||
ProcCleanPass() : Pass("proc_clean") { }
|
ProcCleanPass() : Pass("proc_clean", "remove empty parts of processes") { }
|
||||||
|
virtual void help()
|
||||||
|
{
|
||||||
|
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||||
|
log("\n");
|
||||||
|
log(" proc_clean [selection]\n");
|
||||||
|
log("\n");
|
||||||
|
log("This pass removes empty parts of processes and ultimately removes a process\n");
|
||||||
|
log("if it contains only empty structures.\n");
|
||||||
|
log("\n");
|
||||||
|
}
|
||||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||||
{
|
{
|
||||||
int total_count = 0;
|
int total_count = 0;
|
||||||
|
@ -140,7 +150,11 @@ struct ProcCleanPass : public Pass {
|
||||||
|
|
||||||
for (auto &mod_it : design->modules) {
|
for (auto &mod_it : design->modules) {
|
||||||
std::vector<std::string> delme;
|
std::vector<std::string> delme;
|
||||||
|
if (!design->selected(mod_it.second))
|
||||||
|
continue;
|
||||||
for (auto &proc_it : mod_it.second->processes) {
|
for (auto &proc_it : mod_it.second->processes) {
|
||||||
|
if (!design->selected(mod_it.second, proc_it.second))
|
||||||
|
continue;
|
||||||
proc_clean(mod_it.second, proc_it.second, total_count);
|
proc_clean(mod_it.second, proc_it.second, total_count);
|
||||||
if (proc_it.second->syncs.size() == 0 && proc_it.second->root_case.switches.size() == 0 &&
|
if (proc_it.second->syncs.size() == 0 && proc_it.second->root_case.switches.size() == 0 &&
|
||||||
proc_it.second->root_case.actions.size() == 0) {
|
proc_it.second->root_case.actions.size() == 0) {
|
||||||
|
|
|
@ -161,16 +161,28 @@ static void proc_dff(RTLIL::Module *mod, RTLIL::Process *proc, ConstEval &ce)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProcDffPass : public Pass {
|
struct ProcDffPass : public Pass {
|
||||||
ProcDffPass() : Pass("proc_dff") { }
|
ProcDffPass() : Pass("proc_dff", "extract flip-flops from processes") { }
|
||||||
|
virtual void help()
|
||||||
|
{
|
||||||
|
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||||
|
log("\n");
|
||||||
|
log(" proc_dff [selection]\n");
|
||||||
|
log("\n");
|
||||||
|
log("This pass identifies flip-flops in the processes and converts then to\n");
|
||||||
|
log("flip-flop cells.\n");
|
||||||
|
log("\n");
|
||||||
|
}
|
||||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||||
{
|
{
|
||||||
log_header("Executing PROC_DFF pass (convert process syncs to FFs).\n");
|
log_header("Executing PROC_DFF pass (convert process syncs to FFs).\n");
|
||||||
|
|
||||||
extra_args(args, 1, design);
|
extra_args(args, 1, design);
|
||||||
|
|
||||||
for (auto &mod_it : design->modules) {
|
for (auto &mod_it : design->modules)
|
||||||
|
if (design->selected(mod_it.second)) {
|
||||||
ConstEval ce(mod_it.second);
|
ConstEval ce(mod_it.second);
|
||||||
for (auto &proc_it : mod_it.second->processes)
|
for (auto &proc_it : mod_it.second->processes)
|
||||||
|
if (design->selected(mod_it.second, proc_it.second))
|
||||||
proc_dff(mod_it.second, proc_it.second, ce);
|
proc_dff(mod_it.second, proc_it.second, ce);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,7 +279,17 @@ static void proc_mux(RTLIL::Module *mod, RTLIL::Process *proc)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProcMuxPass : public Pass {
|
struct ProcMuxPass : public Pass {
|
||||||
ProcMuxPass() : Pass("proc_mux") { }
|
ProcMuxPass() : Pass("proc_mux", "convert decision trees to multiplexers") { }
|
||||||
|
virtual void help()
|
||||||
|
{
|
||||||
|
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||||
|
log("\n");
|
||||||
|
log(" proc_mux [selection]\n");
|
||||||
|
log("\n");
|
||||||
|
log("This pass converts the decision trees in processes (originating from if-else\n");
|
||||||
|
log("and case statements) to trees of multiplexer cells.\n");
|
||||||
|
log("\n");
|
||||||
|
}
|
||||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||||
{
|
{
|
||||||
log_header("Executing PROC_MUX pass (convert decision trees to multiplexers).\n");
|
log_header("Executing PROC_MUX pass (convert decision trees to multiplexers).\n");
|
||||||
|
@ -287,7 +297,9 @@ struct ProcMuxPass : public Pass {
|
||||||
extra_args(args, 1, design);
|
extra_args(args, 1, design);
|
||||||
|
|
||||||
for (auto &mod_it : design->modules)
|
for (auto &mod_it : design->modules)
|
||||||
|
if (design->selected(mod_it.second))
|
||||||
for (auto &proc_it : mod_it.second->processes)
|
for (auto &proc_it : mod_it.second->processes)
|
||||||
|
if (design->selected(mod_it.second, proc_it.second))
|
||||||
proc_mux(mod_it.second, proc_it.second);
|
proc_mux(mod_it.second, proc_it.second);
|
||||||
}
|
}
|
||||||
} ProcMuxPass;
|
} ProcMuxPass;
|
||||||
|
|
|
@ -62,7 +62,16 @@ static void proc_rmdead(RTLIL::SwitchRule *sw, int &counter)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProcRmdeadPass : public Pass {
|
struct ProcRmdeadPass : public Pass {
|
||||||
ProcRmdeadPass() : Pass("proc_rmdead") { }
|
ProcRmdeadPass() : Pass("proc_rmdead", "eliminate dead trees in decision trees") { }
|
||||||
|
virtual void help()
|
||||||
|
{
|
||||||
|
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||||
|
log("\n");
|
||||||
|
log(" proc_rmdead [selection]\n");
|
||||||
|
log("\n");
|
||||||
|
log("This pass identifies unreachable branches in decision trees and removes them.\n");
|
||||||
|
log("\n");
|
||||||
|
}
|
||||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||||
{
|
{
|
||||||
log_header("Executing PROC_RMDEAD pass (remove dead branches from decision trees).\n");
|
log_header("Executing PROC_RMDEAD pass (remove dead branches from decision trees).\n");
|
||||||
|
@ -70,8 +79,12 @@ struct ProcRmdeadPass : public Pass {
|
||||||
extra_args(args, 1, design);
|
extra_args(args, 1, design);
|
||||||
|
|
||||||
int total_counter = 0;
|
int total_counter = 0;
|
||||||
for (auto &mod_it : design->modules)
|
for (auto &mod_it : design->modules) {
|
||||||
|
if (!design->selected(mod_it.second))
|
||||||
|
continue;
|
||||||
for (auto &proc_it : mod_it.second->processes) {
|
for (auto &proc_it : mod_it.second->processes) {
|
||||||
|
if (!design->selected(mod_it.second, proc_it.second))
|
||||||
|
continue;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (auto switch_it : proc_it.second->root_case.switches)
|
for (auto switch_it : proc_it.second->root_case.switches)
|
||||||
proc_rmdead(switch_it, counter);
|
proc_rmdead(switch_it, counter);
|
||||||
|
@ -80,6 +93,7 @@ struct ProcRmdeadPass : public Pass {
|
||||||
proc_it.first.c_str(), mod_it.first.c_str());
|
proc_it.first.c_str(), mod_it.first.c_str());
|
||||||
total_counter += counter;
|
total_counter += counter;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log("Removed a total of %d dead cases.\n", total_counter);
|
log("Removed a total of %d dead cases.\n", total_counter);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue