#include "kernel/register.h"
#include "kernel/log.h"
#include <stdlib.h>
#include <sstream>
Go to the source code of this file.
|
USING_YOSYS_NAMESPACE
PRIVATE_NAMESPACE_BEGIN void | normalize_sig (RTLIL::Module *module, RTLIL::SigSpec &sig) |
|
bool | find_sig_before_dff (RTLIL::Module *module, std::vector< RTLIL::Cell * > &dff_cells, RTLIL::SigSpec &sig, RTLIL::SigSpec &clk, bool &clk_polarity, bool after=false) |
|
void | handle_wr_cell (RTLIL::Module *module, std::vector< RTLIL::Cell * > &dff_cells, RTLIL::Cell *cell) |
|
void | disconnect_dff (RTLIL::Module *module, RTLIL::SigSpec sig) |
|
void | handle_rd_cell (RTLIL::Module *module, std::vector< RTLIL::Cell * > &dff_cells, RTLIL::Cell *cell) |
|
void | handle_module (RTLIL::Module *module, bool flag_wr_only) |
|
Definition at line 111 of file memory_dff.cc.
116 std::stringstream sstr;
117 sstr <<
"$memory_dff_disconnected$" << (
autoidx++);
121 for (
auto cell : module->
cells())
122 if (cell->type ==
"$dff") {
125 cell->setPort(
"\\Q", new_q);
RTLIL::Wire * addWire(RTLIL::IdString name, int width=1)
RTLIL::ObjRange< RTLIL::Cell * > cells()
void replace(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec &with)
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN void normalize_sig(RTLIL::Module *module, RTLIL::SigSpec &sig)
YOSYS_NAMESPACE_BEGIN int autoidx
Definition at line 34 of file memory_dff.cc.
43 for (
auto cell : dff_cells)
46 if (cell->getPort(
"\\CLK") != clk)
48 if (cell->parameters[
"\\CLK_POLARITY"].as_bool() !=
clk_polarity)
60 clk = cell->getPort(
"\\CLK");
61 clk_polarity = cell->parameters[
"\\CLK_POLARITY"].as_bool();
62 goto replaced_this_bit;
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN void normalize_sig(RTLIL::Module *module, RTLIL::SigSpec &sig)
RTLIL::SigSpec extract(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec *other=NULL) const
Definition at line 167 of file memory_dff.cc.
169 std::vector<RTLIL::Cell*> dff_cells;
171 for (
auto cell : module->
cells())
172 if (cell->type ==
"$dff")
173 dff_cells.push_back(cell);
176 if (cell->type ==
"$memwr" && !cell->parameters[
"\\CLK_ENABLE"].as_bool())
181 if (cell->type ==
"$memrd" && !cell->parameters[
"\\CLK_ENABLE"].as_bool())
void handle_wr_cell(RTLIL::Module *module, std::vector< RTLIL::Cell * > &dff_cells, RTLIL::Cell *cell)
void handle_rd_cell(RTLIL::Module *module, std::vector< RTLIL::Cell * > &dff_cells, RTLIL::Cell *cell)
std::vector< RTLIL::Cell * > selected_cells() const
RTLIL::ObjRange< RTLIL::Cell * > cells()
Definition at line 129 of file memory_dff.cc.
141 cell->
setPort(
"\\CLK", clk_data);
142 cell->
setPort(
"\\DATA", sig_data);
146 log(
"merged data $dff to cell.\n");
155 cell->
setPort(
"\\CLK", clk_addr);
156 cell->
setPort(
"\\ADDR", sig_addr);
160 log(
"merged address $dff to cell.\n");
164 log(
"no (compatible) $dff found.\n");
const char * c_str() const
void setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
std::map< RTLIL::IdString, RTLIL::Const > parameters
const RTLIL::SigSpec & getPort(RTLIL::IdString portname) const
void disconnect_dff(RTLIL::Module *module, RTLIL::SigSpec sig)
void log(const char *format,...)
bool find_sig_before_dff(RTLIL::Module *module, std::vector< RTLIL::Cell * > &dff_cells, RTLIL::SigSpec &sig, RTLIL::SigSpec &clk, bool &clk_polarity, bool after=false)
Definition at line 72 of file memory_dff.cc.
81 log(
"no (compatible) $dff for address input found.\n");
87 log(
"no (compatible) $dff for data input found.\n");
93 log(
"no (compatible) $dff for enable input found.\n");
99 cell->
setPort(
"\\ADDR", sig_addr);
100 cell->
setPort(
"\\DATA", sig_data);
104 log(
"merged $dff to cell.\n");
108 log(
"no (compatible) $dff found.\n");
const char * c_str() const
void setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
std::map< RTLIL::IdString, RTLIL::Const > parameters
const RTLIL::SigSpec & getPort(RTLIL::IdString portname) const
void log(const char *format,...)
bool find_sig_before_dff(RTLIL::Module *module, std::vector< RTLIL::Cell * > &dff_cells, RTLIL::SigSpec &sig, RTLIL::SigSpec &clk, bool &clk_polarity, bool after=false)
Definition at line 28 of file memory_dff.cc.
31 sig.
replace(conn.first, conn.second);
const std::vector< RTLIL::SigSig > & connections() const
void replace(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec &with)