mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-28 22:18:59 +00:00
Merge remote-tracking branch 'origin/master' into xaig
This commit is contained in:
commit
f7a9769c14
140 changed files with 4698 additions and 1852 deletions
|
@ -330,20 +330,33 @@ void extract_cell(RTLIL::Cell *cell, bool keepff)
|
|||
std::string remap_name(RTLIL::IdString abc_name, RTLIL::Wire **orig_wire = nullptr)
|
||||
{
|
||||
std::string abc_sname = abc_name.substr(1);
|
||||
if (abc_sname.substr(0, 5) == "ys__n") {
|
||||
bool inv = abc_sname.back() == 'v';
|
||||
if (inv) abc_sname.pop_back();
|
||||
bool isnew = false;
|
||||
if (abc_sname.substr(0, 4) == "new_")
|
||||
{
|
||||
abc_sname.erase(0, 4);
|
||||
isnew = true;
|
||||
}
|
||||
if (abc_sname.substr(0, 5) == "ys__n")
|
||||
{
|
||||
abc_sname.erase(0, 5);
|
||||
if (abc_sname.find_last_not_of("012345689") == std::string::npos) {
|
||||
if (std::isdigit(abc_sname.at(0)))
|
||||
{
|
||||
int sid = std::stoi(abc_sname);
|
||||
for (auto sig : signal_list) {
|
||||
if (sig.id == sid && sig.bit.wire != nullptr) {
|
||||
size_t postfix_start = abc_sname.find_first_not_of("0123456789");
|
||||
std::string postfix = postfix_start != std::string::npos ? abc_sname.substr(postfix_start) : "";
|
||||
|
||||
if (sid < GetSize(signal_list))
|
||||
{
|
||||
auto sig = signal_list.at(sid);
|
||||
if (sig.bit.wire != nullptr)
|
||||
{
|
||||
std::stringstream sstr;
|
||||
sstr << "$abc$" << map_autoidx << "$" << sig.bit.wire->name.substr(1);
|
||||
if (sig.bit.wire->width != 1)
|
||||
sstr << "[" << sig.bit.offset << "]";
|
||||
if (inv)
|
||||
sstr << "_inv";
|
||||
if (isnew)
|
||||
sstr << "_new";
|
||||
sstr << postfix;
|
||||
if (orig_wire != nullptr)
|
||||
*orig_wire = sig.bit.wire;
|
||||
return sstr.str();
|
||||
|
|
|
@ -102,7 +102,8 @@ struct DffinitPass : public Pass {
|
|||
if (wire->attributes.count("\\init")) {
|
||||
Const value = wire->attributes.at("\\init");
|
||||
for (int i = 0; i < min(GetSize(value), GetSize(wire)); i++)
|
||||
init_bits[sigmap(SigBit(wire, i))] = value[i];
|
||||
if (value[i] != State::Sx)
|
||||
init_bits[sigmap(SigBit(wire, i))] = value[i];
|
||||
}
|
||||
if (wire->port_output)
|
||||
for (auto bit : sigmap(wire))
|
||||
|
|
|
@ -397,7 +397,6 @@ struct FlowGraph
|
|||
pool<RTLIL::SigBit> x, xi;
|
||||
|
||||
NodePrime source_prime = {source, true};
|
||||
NodePrime sink_prime = {sink, false};
|
||||
pool<NodePrime> visited;
|
||||
vector<NodePrime> worklist = {source_prime};
|
||||
while (!worklist.empty())
|
||||
|
@ -1382,7 +1381,8 @@ struct FlowmapWorker
|
|||
|
||||
vector<RTLIL::SigBit> input_nodes(lut_edges_bw[node].begin(), lut_edges_bw[node].end());
|
||||
RTLIL::Const lut_table(State::Sx, max(1 << input_nodes.size(), 1 << minlut));
|
||||
for (unsigned i = 0; i < (1 << input_nodes.size()); i++)
|
||||
unsigned const mask = 1 << input_nodes.size();
|
||||
for (unsigned i = 0; i < mask; i++)
|
||||
{
|
||||
ce.push();
|
||||
for (size_t n = 0; n < input_nodes.size(); n++)
|
||||
|
|
|
@ -94,7 +94,7 @@ int LibertyParser::lexer(std::string &str)
|
|||
|
||||
// search for identifiers, numbers, plus or minus.
|
||||
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '_' || c == '-' || c == '+' || c == '.') {
|
||||
str = c;
|
||||
str = static_cast<char>(c);
|
||||
while (1) {
|
||||
c = f.get();
|
||||
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '_' || c == '-' || c == '+' || c == '.')
|
||||
|
|
|
@ -58,12 +58,21 @@ struct MuxcoverWorker
|
|||
bool use_mux16;
|
||||
bool nodecode;
|
||||
|
||||
int cost_mux2;
|
||||
int cost_mux4;
|
||||
int cost_mux8;
|
||||
int cost_mux16;
|
||||
|
||||
MuxcoverWorker(Module *module) : module(module), sigmap(module)
|
||||
{
|
||||
use_mux4 = false;
|
||||
use_mux8 = false;
|
||||
use_mux16 = false;
|
||||
nodecode = false;
|
||||
cost_mux2 = COST_MUX2;
|
||||
cost_mux4 = COST_MUX4;
|
||||
cost_mux8 = COST_MUX8;
|
||||
cost_mux16 = COST_MUX16;
|
||||
decode_mux_counter = 0;
|
||||
}
|
||||
|
||||
|
@ -157,7 +166,7 @@ struct MuxcoverWorker
|
|||
if (std::get<2>(entry))
|
||||
return 0;
|
||||
|
||||
return COST_MUX2 / GetSize(std::get<1>(entry));
|
||||
return cost_mux2 / GetSize(std::get<1>(entry));
|
||||
}
|
||||
|
||||
void implement_decode_mux(SigBit ctrl_bit)
|
||||
|
@ -209,7 +218,7 @@ struct MuxcoverWorker
|
|||
mux.inputs.push_back(B);
|
||||
mux.selects.push_back(S1);
|
||||
|
||||
mux.cost += COST_MUX2;
|
||||
mux.cost += cost_mux2;
|
||||
mux.cost += find_best_cover(tree, A);
|
||||
mux.cost += find_best_cover(tree, B);
|
||||
|
||||
|
@ -247,7 +256,7 @@ struct MuxcoverWorker
|
|||
mux.selects.push_back(S1);
|
||||
mux.selects.push_back(T1);
|
||||
|
||||
mux.cost += COST_MUX4;
|
||||
mux.cost += cost_mux4;
|
||||
mux.cost += find_best_cover(tree, A);
|
||||
mux.cost += find_best_cover(tree, B);
|
||||
mux.cost += find_best_cover(tree, C);
|
||||
|
@ -310,7 +319,7 @@ struct MuxcoverWorker
|
|||
mux.selects.push_back(T1);
|
||||
mux.selects.push_back(U1);
|
||||
|
||||
mux.cost += COST_MUX8;
|
||||
mux.cost += cost_mux8;
|
||||
mux.cost += find_best_cover(tree, A);
|
||||
mux.cost += find_best_cover(tree, B);
|
||||
mux.cost += find_best_cover(tree, C);
|
||||
|
@ -414,7 +423,7 @@ struct MuxcoverWorker
|
|||
mux.selects.push_back(U1);
|
||||
mux.selects.push_back(V1);
|
||||
|
||||
mux.cost += COST_MUX16;
|
||||
mux.cost += cost_mux16;
|
||||
mux.cost += find_best_cover(tree, A);
|
||||
mux.cost += find_best_cover(tree, B);
|
||||
mux.cost += find_best_cover(tree, C);
|
||||
|
@ -569,9 +578,11 @@ struct MuxcoverPass : public Pass {
|
|||
log("\n");
|
||||
log("Cover trees of $_MUX_ cells with $_MUX{4,8,16}_ cells\n");
|
||||
log("\n");
|
||||
log(" -mux4, -mux8, -mux16\n");
|
||||
log(" Use the specified types of MUXes. If none of those options are used,\n");
|
||||
log(" the effect is the same as if all of them where used.\n");
|
||||
log(" -mux4[=cost], -mux8[=cost], -mux16[=cost]\n");
|
||||
log(" Use the specified types of MUXes (with optional integer costs). If none\n");
|
||||
log(" of these options are given, the effect is the same as if all of them are.\n");
|
||||
log(" Default costs: $_MUX_ = %d, $_MUX4_ = %d,\n", COST_MUX2, COST_MUX4);
|
||||
log(" $_MUX8_ = %d, $_MUX16_ = %d\n", COST_MUX8, COST_MUX16);
|
||||
log("\n");
|
||||
log(" -nodecode\n");
|
||||
log(" Do not insert decoder logic. This reduces the number of possible\n");
|
||||
|
@ -587,23 +598,39 @@ struct MuxcoverPass : public Pass {
|
|||
bool use_mux8 = false;
|
||||
bool use_mux16 = false;
|
||||
bool nodecode = false;
|
||||
int cost_mux4 = COST_MUX4;
|
||||
int cost_mux8 = COST_MUX8;
|
||||
int cost_mux16 = COST_MUX16;
|
||||
|
||||
size_t argidx;
|
||||
for (argidx = 1; argidx < args.size(); argidx++)
|
||||
{
|
||||
if (args[argidx] == "-mux4") {
|
||||
const auto &arg = args[argidx];
|
||||
if (arg.size() >= 5 && arg.substr(0,5) == "-mux4") {
|
||||
use_mux4 = true;
|
||||
if (arg.size() > 5) {
|
||||
if (arg[5] != '=') break;
|
||||
cost_mux4 = atoi(arg.substr(5).c_str());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-mux8") {
|
||||
if (arg.size() >= 5 && arg.substr(0,5) == "-mux8") {
|
||||
use_mux8 = true;
|
||||
if (arg.size() > 5) {
|
||||
if (arg[5] != '=') break;
|
||||
cost_mux8 = atoi(arg.substr(5).c_str());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-mux16") {
|
||||
if (arg.size() >= 6 && arg.substr(0,6) == "-mux16") {
|
||||
use_mux16 = true;
|
||||
if (arg.size() > 6) {
|
||||
if (arg[6] != '=') break;
|
||||
cost_mux16 = atoi(arg.substr(6).c_str());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-nodecode") {
|
||||
if (arg == "-nodecode") {
|
||||
nodecode = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -623,6 +650,9 @@ struct MuxcoverPass : public Pass {
|
|||
worker.use_mux4 = use_mux4;
|
||||
worker.use_mux8 = use_mux8;
|
||||
worker.use_mux16 = use_mux16;
|
||||
worker.cost_mux4 = cost_mux4;
|
||||
worker.cost_mux8 = cost_mux8;
|
||||
worker.cost_mux16 = cost_mux16;
|
||||
worker.nodecode = nodecode;
|
||||
worker.run();
|
||||
}
|
||||
|
|
|
@ -178,7 +178,17 @@ struct ShregmapTechXilinx7 : ShregmapTech
|
|||
|
||||
// Only map if $shiftx exclusively covers the shift register
|
||||
if (shiftx->type == "$shiftx") {
|
||||
if (GetSize(taps) != shiftx->getParam("\\A_WIDTH").as_int())
|
||||
if (GetSize(taps) > shiftx->getParam("\\A_WIDTH").as_int())
|
||||
return false;
|
||||
// Due to padding the most significant bits of A may be 1'bx,
|
||||
// and if so, discount them
|
||||
if (GetSize(taps) < shiftx->getParam("\\A_WIDTH").as_int()) {
|
||||
const SigSpec A = shiftx->getPort("\\A");
|
||||
const int A_width = shiftx->getParam("\\A_WIDTH").as_int();
|
||||
for (int i = GetSize(taps); i < A_width; ++i)
|
||||
if (A[i] != RTLIL::Sx) return false;
|
||||
}
|
||||
else if (GetSize(taps) != shiftx->getParam("\\A_WIDTH").as_int())
|
||||
return false;
|
||||
}
|
||||
else if (shiftx->type == "$mux") {
|
||||
|
@ -596,6 +606,9 @@ struct ShregmapPass : public Pass {
|
|||
log(" -tech greenpak4\n");
|
||||
log(" map to greenpak4 shift registers.\n");
|
||||
log("\n");
|
||||
log(" -tech xilinx\n");
|
||||
log(" map to xilinx dynamic-length shift registers.\n");
|
||||
log("\n");
|
||||
}
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ struct ZinitPass : public Pass {
|
|||
size_t argidx;
|
||||
for (argidx = 1; argidx < args.size(); argidx++)
|
||||
{
|
||||
if (args[argidx] == "-singleton") {
|
||||
if (args[argidx] == "-all") {
|
||||
all_mode = true;
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue