31 log(
"Creating $memrd and $memwr for memory `%s' in module `%s':\n",
36 while (module->
memories.count(mem_name) != 0)
46 int abits = memory->
parameters.at(
"\\ABITS").as_int();
47 int num_rd_ports = memory->
parameters.at(
"\\RD_PORTS").as_int();
48 int num_wr_ports = memory->
parameters.at(
"\\WR_PORTS").as_int();
50 for (
int i = 0; i < num_rd_ports; i++)
64 for (
int i = 0; i < num_wr_ports; i++)
84 std::vector<RTLIL::IdString> memcells;
85 for (
auto &cell_it : module->
cells_)
86 if (cell_it.second->type ==
"$mem" && design->
selected(module, cell_it.second))
87 memcells.push_back(cell_it.first);
88 for (
auto &it : memcells)
98 log(
" memory_unpack [selection]\n");
100 log(
"This pass converts the multi-port $mem memory cells into individual $memrd and\n");
101 log(
"$memwr cells. It is the counterpart to the memory_collect pass.\n");
105 log_header(
"Executing MEMORY_UNPACK pass (generating $memrd/$memwr cells form $mem cells).\n");
107 for (
auto &mod_it : design->
modules_)
108 if (design->
selected(mod_it.second))
const char * c_str() const
bool selected(T1 *module) const
std::string stringf(const char *fmt,...)
RTLIL::Cell * addCell(RTLIL::IdString name, RTLIL::IdString type)
void log_header(const char *format,...)
RTLIL::Const as_const() const
void setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
std::map< RTLIL::IdString, RTLIL::Memory * > memories
virtual void execute(std::vector< std::string > args, RTLIL::Design *design)
std::map< RTLIL::IdString, RTLIL::Const > parameters
void handle_module(RTLIL::Design *design, RTLIL::Module *module)
static std::string escape_id(std::string str)
#define PRIVATE_NAMESPACE_BEGIN
const RTLIL::SigSpec & getPort(RTLIL::IdString portname) const
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN void handle_memory(RTLIL::Module *module, RTLIL::Cell *memory)
#define PRIVATE_NAMESPACE_END
#define USING_YOSYS_NAMESPACE
std::map< RTLIL::IdString, RTLIL::Module * > modules_
std::map< RTLIL::IdString, RTLIL::Cell * > cells_
void remove(const std::set< RTLIL::Wire * > &wires)
MemoryUnpackPass MemoryUnpackPass
void log(const char *format,...)
RTLIL::SigSpec extract(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec *other=NULL) const
void extra_args(std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true)
YOSYS_NAMESPACE_BEGIN int autoidx