mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-13 01:16:16 +00:00
Replace "muxcover -freedecode" with "muxcover -dmux=cost"
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
9286b6f013
commit
ec979475e7
1 changed files with 14 additions and 15 deletions
|
@ -23,6 +23,7 @@
|
||||||
USING_YOSYS_NAMESPACE
|
USING_YOSYS_NAMESPACE
|
||||||
PRIVATE_NAMESPACE_BEGIN
|
PRIVATE_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
#define COST_DMUX 90
|
||||||
#define COST_MUX2 100
|
#define COST_MUX2 100
|
||||||
#define COST_MUX4 220
|
#define COST_MUX4 220
|
||||||
#define COST_MUX8 460
|
#define COST_MUX8 460
|
||||||
|
@ -57,9 +58,9 @@ struct MuxcoverWorker
|
||||||
bool use_mux8;
|
bool use_mux8;
|
||||||
bool use_mux16;
|
bool use_mux16;
|
||||||
bool nodecode;
|
bool nodecode;
|
||||||
bool freedecode;
|
|
||||||
bool nopartial;
|
bool nopartial;
|
||||||
|
|
||||||
|
int cost_dmux;
|
||||||
int cost_mux2;
|
int cost_mux2;
|
||||||
int cost_mux4;
|
int cost_mux4;
|
||||||
int cost_mux8;
|
int cost_mux8;
|
||||||
|
@ -71,8 +72,8 @@ struct MuxcoverWorker
|
||||||
use_mux8 = false;
|
use_mux8 = false;
|
||||||
use_mux16 = false;
|
use_mux16 = false;
|
||||||
nodecode = false;
|
nodecode = false;
|
||||||
freedecode = false;
|
|
||||||
nopartial = false;
|
nopartial = false;
|
||||||
|
cost_dmux = COST_DMUX;
|
||||||
cost_mux2 = COST_MUX2;
|
cost_mux2 = COST_MUX2;
|
||||||
cost_mux4 = COST_MUX4;
|
cost_mux4 = COST_MUX4;
|
||||||
cost_mux8 = COST_MUX8;
|
cost_mux8 = COST_MUX8;
|
||||||
|
@ -180,10 +181,7 @@ struct MuxcoverWorker
|
||||||
if (A == State::Sx || B == State::Sx)
|
if (A == State::Sx || B == State::Sx)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (freedecode)
|
return cost_dmux / GetSize(std::get<1>(entry));
|
||||||
return 0;
|
|
||||||
|
|
||||||
return std::max((cost_mux2 / GetSize(std::get<1>(entry))) - 1, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void implement_decode_mux(SigBit ctrl_bit)
|
void implement_decode_mux(SigBit ctrl_bit)
|
||||||
|
@ -620,14 +618,15 @@ struct MuxcoverPass : public Pass {
|
||||||
log(" Default costs: $_MUX_ = %d, $_MUX4_ = %d,\n", COST_MUX2, COST_MUX4);
|
log(" Default costs: $_MUX_ = %d, $_MUX4_ = %d,\n", COST_MUX2, COST_MUX4);
|
||||||
log(" $_MUX8_ = %d, $_MUX16_ = %d\n", COST_MUX8, COST_MUX16);
|
log(" $_MUX8_ = %d, $_MUX16_ = %d\n", COST_MUX8, COST_MUX16);
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -dmux=cost\n");
|
||||||
|
log(" Use the specified cost for $_MUX_ cells used in decoders.\n");
|
||||||
|
log(" Default cost: %d\n", COST_DMUX);
|
||||||
|
log("\n");
|
||||||
log(" -nodecode\n");
|
log(" -nodecode\n");
|
||||||
log(" Do not insert decoder logic. This reduces the number of possible\n");
|
log(" Do not insert decoder logic. This reduces the number of possible\n");
|
||||||
log(" substitutions, but guarantees that the resulting circuit is not\n");
|
log(" substitutions, but guarantees that the resulting circuit is not\n");
|
||||||
log(" less efficient than the original circuit.\n");
|
log(" less efficient than the original circuit.\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
log(" -freedecode\n");
|
|
||||||
log(" Do not count cost for generated decode logic\n");
|
|
||||||
log("\n");
|
|
||||||
log(" -nopartial\n");
|
log(" -nopartial\n");
|
||||||
log(" Do not consider mappings that use $_MUX<N>_ to select from less\n");
|
log(" Do not consider mappings that use $_MUX<N>_ to select from less\n");
|
||||||
log(" than <N> different signals.\n");
|
log(" than <N> different signals.\n");
|
||||||
|
@ -641,8 +640,8 @@ struct MuxcoverPass : public Pass {
|
||||||
bool use_mux8 = false;
|
bool use_mux8 = false;
|
||||||
bool use_mux16 = false;
|
bool use_mux16 = false;
|
||||||
bool nodecode = false;
|
bool nodecode = false;
|
||||||
bool freedecode = false;
|
|
||||||
bool nopartial = false;
|
bool nopartial = false;
|
||||||
|
int cost_dmux = COST_DMUX;
|
||||||
int cost_mux4 = COST_MUX4;
|
int cost_mux4 = COST_MUX4;
|
||||||
int cost_mux8 = COST_MUX8;
|
int cost_mux8 = COST_MUX8;
|
||||||
int cost_mux16 = COST_MUX16;
|
int cost_mux16 = COST_MUX16;
|
||||||
|
@ -675,12 +674,12 @@ struct MuxcoverPass : public Pass {
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg == "-nodecode") {
|
if (arg.size() >= 6 && arg.substr(0,6) == "-dmux=") {
|
||||||
nodecode = true;
|
cost_dmux = atoi(arg.substr(6).c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg == "-freedecode") {
|
if (arg == "-nodecode") {
|
||||||
freedecode = true;
|
nodecode = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg == "-nopartial") {
|
if (arg == "-nopartial") {
|
||||||
|
@ -703,11 +702,11 @@ struct MuxcoverPass : public Pass {
|
||||||
worker.use_mux4 = use_mux4;
|
worker.use_mux4 = use_mux4;
|
||||||
worker.use_mux8 = use_mux8;
|
worker.use_mux8 = use_mux8;
|
||||||
worker.use_mux16 = use_mux16;
|
worker.use_mux16 = use_mux16;
|
||||||
|
worker.cost_dmux = cost_dmux;
|
||||||
worker.cost_mux4 = cost_mux4;
|
worker.cost_mux4 = cost_mux4;
|
||||||
worker.cost_mux8 = cost_mux8;
|
worker.cost_mux8 = cost_mux8;
|
||||||
worker.cost_mux16 = cost_mux16;
|
worker.cost_mux16 = cost_mux16;
|
||||||
worker.nodecode = nodecode;
|
worker.nodecode = nodecode;
|
||||||
worker.freedecode = freedecode;
|
|
||||||
worker.nopartial = nopartial;
|
worker.nopartial = nopartial;
|
||||||
worker.run();
|
worker.run();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue