#include <stdio.h>
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)
{
log_header("Executing PROC pass (convert processes to netlists).\n");
}
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)
{
log_header("Executing PROC_ARST pass (detect async resets in processes).\n");
extra_args(args, 1, design);
- for (auto &mod_it : design->modules) {
- SigMap assign_map(mod_it.second);
- for (auto &proc_it : mod_it.second->processes)
- proc_arst(mod_it.second, proc_it.second, assign_map);
- }
+ for (auto &mod_it : design->modules)
+ if (design->selected(mod_it.second)) {
+ SigMap assign_map(mod_it.second);
+ 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);
+ }
}
} ProcArstPass;
}
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)
{
int total_count = 0;
for (auto &mod_it : design->modules) {
std::vector<std::string> delme;
+ if (!design->selected(mod_it.second))
+ continue;
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);
if (proc_it.second->syncs.size() == 0 && proc_it.second->root_case.switches.size() == 0 &&
proc_it.second->root_case.actions.size() == 0) {
}
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)
{
log_header("Executing PROC_DFF pass (convert process syncs to FFs).\n");
extra_args(args, 1, design);
- for (auto &mod_it : design->modules) {
- ConstEval ce(mod_it.second);
- for (auto &proc_it : mod_it.second->processes)
- proc_dff(mod_it.second, proc_it.second, ce);
- }
+ for (auto &mod_it : design->modules)
+ if (design->selected(mod_it.second)) {
+ ConstEval ce(mod_it.second);
+ 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);
+ }
}
} ProcDffPass;
}
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)
{
log_header("Executing PROC_MUX pass (convert decision trees to multiplexers).\n");
extra_args(args, 1, design);
for (auto &mod_it : design->modules)
- for (auto &proc_it : mod_it.second->processes)
- proc_mux(mod_it.second, proc_it.second);
+ if (design->selected(mod_it.second))
+ 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);
}
} ProcMuxPass;
}
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)
{
log_header("Executing PROC_RMDEAD pass (remove dead branches from decision trees).\n");
extra_args(args, 1, design);
int total_counter = 0;
- for (auto &mod_it : design->modules)
- for (auto &proc_it : mod_it.second->processes) {
- int counter = 0;
- for (auto switch_it : proc_it.second->root_case.switches)
- proc_rmdead(switch_it, counter);
- if (counter > 0)
- log("Removed %d dead cases from process %s in module %s.\n", counter,
- proc_it.first.c_str(), mod_it.first.c_str());
- total_counter += counter;
+ for (auto &mod_it : design->modules) {
+ if (!design->selected(mod_it.second))
+ continue;
+ for (auto &proc_it : mod_it.second->processes) {
+ if (!design->selected(mod_it.second, proc_it.second))
+ continue;
+ int counter = 0;
+ for (auto switch_it : proc_it.second->root_case.switches)
+ proc_rmdead(switch_it, counter);
+ if (counter > 0)
+ log("Removed %d dead cases from process %s in module %s.\n", counter,
+ proc_it.first.c_str(), mod_it.first.c_str());
+ total_counter += counter;
+ }
}
log("Removed a total of %d dead cases.\n", total_counter);