Add some cleanup code to memory_nordff

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-05-28 16:42:06 +02:00
parent 9a946c207f
commit 74efafc1cf
1 changed files with 38 additions and 28 deletions

View File

@ -61,15 +61,17 @@ struct MemoryNordffPass : public Pass {
SigSpec rd_addr = cell->getPort("\\RD_ADDR"); SigSpec rd_addr = cell->getPort("\\RD_ADDR");
SigSpec rd_data = cell->getPort("\\RD_DATA"); SigSpec rd_data = cell->getPort("\\RD_DATA");
SigSpec rd_clk = cell->getPort("\\RD_CLK");
SigSpec rd_en = cell->getPort("\\RD_EN");
Const rd_clk_enable = cell->getParam("\\RD_CLK_ENABLE"); Const rd_clk_enable = cell->getParam("\\RD_CLK_ENABLE");
Const rd_clk_polarity = cell->getParam("\\RD_CLK_POLARITY");
for (int i = 0; i < rd_ports; i++) for (int i = 0; i < rd_ports; i++)
{ {
bool clk_enable = rd_clk_enable[i] == State::S1; bool clk_enable = rd_clk_enable[i] == State::S1;
if (!clk_enable) if (clk_enable)
continue; {
bool clk_polarity = cell->getParam("\\RD_CLK_POLARITY")[i] == State::S1; bool clk_polarity = cell->getParam("\\RD_CLK_POLARITY")[i] == State::S1;
bool transparent = cell->getParam("\\RD_TRANSPARENT")[i] == State::S1; bool transparent = cell->getParam("\\RD_TRANSPARENT")[i] == State::S1;
@ -98,12 +100,20 @@ struct MemoryNordffPass : public Pass {
log("Extracted %s FF from read port %d of %s.%s: %s\n", transparent ? "addr" : "data", log("Extracted %s FF from read port %d of %s.%s: %s\n", transparent ? "addr" : "data",
i, log_id(module), log_id(cell), log_id(c)); i, log_id(module), log_id(cell), log_id(c));
}
rd_en[i] = State::S1;
rd_clk[i] = State::S0;
rd_clk_enable[i] = State::S0; rd_clk_enable[i] = State::S0;
rd_clk_polarity[i] = State::S1;
} }
cell->setPort("\\RD_ADDR", rd_addr); cell->setPort("\\RD_ADDR", rd_addr);
cell->setPort("\\RD_DATA", rd_data); cell->setPort("\\RD_DATA", rd_data);
cell->setPort("\\RD_CLK", rd_clk);
cell->setPort("\\RD_EN", rd_en);
cell->setParam("\\RD_CLK_ENABLE", rd_clk_enable); cell->setParam("\\RD_CLK_ENABLE", rd_clk_enable);
cell->setParam("\\RD_CLK_POLARITY", rd_clk_polarity);
} }
} }
} MemoryNordffPass; } MemoryNordffPass;