diff options
Diffstat (limited to 'passes/techmap/simplemap.cc')
-rw-r--r-- | passes/techmap/simplemap.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/passes/techmap/simplemap.cc b/passes/techmap/simplemap.cc index fbd86d591..e06a80bbd 100644 --- a/passes/techmap/simplemap.cc +++ b/passes/techmap/simplemap.cc @@ -60,16 +60,28 @@ static void simplemap_pos(RTLIL::Module *module, RTLIL::Cell *cell) module->connections.push_back(RTLIL::SigSig(sig_y, sig_a)); } +static void simplemap_bu0(RTLIL::Module *module, RTLIL::Cell *cell) +{ + int width = cell->parameters.at("\\Y_WIDTH").as_int(); + + RTLIL::SigSpec sig_a = cell->connections.at("\\A"); + sig_a.extend_u0(width, cell->parameters.at("\\A_SIGNED").as_bool()); + + RTLIL::SigSpec sig_y = cell->connections.at("\\Y"); + + module->connections.push_back(RTLIL::SigSig(sig_y, sig_a)); +} + static void simplemap_bitop(RTLIL::Module *module, RTLIL::Cell *cell) { int width = cell->parameters.at("\\Y_WIDTH").as_int(); RTLIL::SigSpec sig_a = cell->connections.at("\\A"); - sig_a.extend(width, cell->parameters.at("\\A_SIGNED").as_bool()); + sig_a.extend_u0(width, cell->parameters.at("\\A_SIGNED").as_bool()); sig_a.expand(); RTLIL::SigSpec sig_b = cell->connections.at("\\B"); - sig_b.extend(width, cell->parameters.at("\\B_SIGNED").as_bool()); + sig_b.extend_u0(width, cell->parameters.at("\\B_SIGNED").as_bool()); sig_b.expand(); RTLIL::SigSpec sig_y = cell->connections.at("\\Y"); @@ -454,6 +466,7 @@ void simplemap_get_mappers(std::map<std::string, void(*)(RTLIL::Module*, RTLIL:: { mappers["$not"] = simplemap_not; mappers["$pos"] = simplemap_pos; + mappers["$bu0"] = simplemap_bu0; mappers["$and"] = simplemap_bitop; mappers["$or"] = simplemap_bitop; mappers["$xor"] = simplemap_bitop; @@ -485,7 +498,7 @@ struct SimplemapPass : public Pass { log("This pass maps a small selection of simple coarse-grain cells to yosys gate\n"); log("primitives. The following internal cell types are mapped by this pass:\n"); log("\n"); - log(" $not, $pos, $and, $or, $xor, $xnor\n"); + log(" $not, $pos, $bu0, $and, $or, $xor, $xnor\n"); log(" $reduce_and, $reduce_or, $reduce_xor, $reduce_xnor, $reduce_bool\n"); log(" $logic_not, $logic_and, $logic_or, $mux\n"); log(" $sr, $dff, $dffsr, $adff, $dlatch\n"); |