40 log(
"Collecting $memrd and $memwr for memory `%s' in module `%s':\n",
44 while ((1 << addr_bits) < memory->
size)
63 std::vector<RTLIL::Cell*> del_cells;
64 std::vector<RTLIL::Cell*> memcells;
66 for (
auto &cell_it : module->
cells_) {
68 if ((cell->
type ==
"$memwr" || cell->
type ==
"$memrd") && memory->
name == cell->
parameters[
"\\MEMID"].decode_string())
69 memcells.push_back(cell);
74 for (
auto cell : memcells)
76 if (cell->
type ==
"$memwr" && memory->
name == cell->
parameters[
"\\MEMID"].decode_string())
79 del_cells.push_back(cell);
89 clk_enable.
extend(1,
false);
90 clk_polarity.
extend(1,
false);
91 addr.
extend(addr_bits,
false);
96 sig_wr_clk_enable.
append(clk_enable);
97 sig_wr_clk_polarity.
append(clk_polarity);
103 if (cell->
type ==
"$memrd" && memory->
name == cell->
parameters[
"\\MEMID"].decode_string())
106 del_cells.push_back(cell);
116 clk_enable.
extend(1,
false);
117 clk_polarity.
extend(1,
false);
118 transparent.
extend(1,
false);
119 addr.
extend(addr_bits,
false);
123 sig_rd_clk_enable.
append(clk_enable);
124 sig_rd_clk_polarity.
append(clk_polarity);
125 sig_rd_transparent.
append(transparent);
131 std::stringstream sstr;
152 mem->
setPort(
"\\WR_CLK", sig_wr_clk);
153 mem->
setPort(
"\\WR_ADDR", sig_wr_addr);
154 mem->
setPort(
"\\WR_DATA", sig_wr_data);
155 mem->
setPort(
"\\WR_EN", sig_wr_en);
168 mem->
setPort(
"\\RD_CLK", sig_rd_clk);
169 mem->
setPort(
"\\RD_ADDR", sig_rd_addr);
170 mem->
setPort(
"\\RD_DATA", sig_rd_data);
172 for (
auto c : del_cells)
const char * c_str() const
void sort(T *array, int size, LessThan lt)
RTLIL::Cell * addCell(RTLIL::IdString name, RTLIL::IdString type)
RTLIL::Const as_const() const
void setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
std::map< RTLIL::IdString, RTLIL::Const > parameters
const RTLIL::SigSpec & getPort(RTLIL::IdString portname) const
#define log_assert(_assert_expr_)
bool is_fully_const() const
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN bool memcells_cmp(RTLIL::Cell *a, RTLIL::Cell *b)
std::map< RTLIL::IdString, RTLIL::Cell * > cells_
void remove(const std::set< RTLIL::Wire * > &wires)
void log(const char *format,...)
void append(const RTLIL::SigSpec &signal)
void extend(int width, bool is_signed=false)
YOSYS_NAMESPACE_BEGIN int autoidx