aboutsummaryrefslogtreecommitdiffstats
path: root/passes
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-08-23 18:15:49 -0700
committerEddie Hung <eddie@fpgeh.com>2019-08-23 18:15:49 -0700
commit791114382774cdf70b16cc5f1cec689f0ddb5c0b (patch)
treed065cfae037568e7b7e3da58871a07eecef9ea70 /passes
parenta048fc93e8cf187b28bd5ed924643671b9314678 (diff)
downloadyosys-791114382774cdf70b16cc5f1cec689f0ddb5c0b.tar.gz
yosys-791114382774cdf70b16cc5f1cec689f0ddb5c0b.tar.bz2
yosys-791114382774cdf70b16cc5f1cec689f0ddb5c0b.zip
Create new $__XILINX_SHREG_ cell for variable length too
Diffstat (limited to 'passes')
-rw-r--r--passes/pmgen/xilinx_srl.cc61
1 files changed, 30 insertions, 31 deletions
diff --git a/passes/pmgen/xilinx_srl.cc b/passes/pmgen/xilinx_srl.cc
index e1d38d7bd..c332ccb9f 100644
--- a/passes/pmgen/xilinx_srl.cc
+++ b/passes/pmgen/xilinx_srl.cc
@@ -142,50 +142,49 @@ void run_variable(xilinx_srl_pm &pm)
}
pm.autoremove(st.shiftx);
- auto last_cell = ud.chain.front().first;
- auto last_slice = ud.chain.front().second;
-
- Cell *c = last_cell;
- if (c->type.in(ID($dff), ID($dffe))) {
- auto &Q = last_cell->connections_.at(ID(Q));
- Q = Q[last_slice];
- last_cell->setPort(ID(D), first_cell->getPort(ID(D))[first_slice]);
- }
+ Cell *c = pm.module->addCell(NEW_ID, ID($__XILINX_SHREG_));
+ pm.module->swap_names(c, first_cell);
- if (c->type.in(ID($_DFF_N_), ID($_DFF_P_), ID($_DFFE_NN_), ID($_DFFE_NP_), ID($_DFFE_PN_), ID($_DFFE_PP_), ID($dff), ID($dffe))) {
+ if (first_cell->type.in(ID($_DFF_N_), ID($_DFF_P_), ID($_DFFE_NN_), ID($_DFFE_NP_), ID($_DFFE_PN_), ID($_DFFE_PP_), ID($dff), ID($dffe))) {
+ c->setParam(ID(DEPTH), GetSize(ud.chain));
+ c->setParam(ID(INIT), initval.as_const());
Const clkpol, enpol;
- if (c->type.in(ID($_DFF_P_), ID($_DFFE_PN_), ID($_DFFE_PP_)))
+ if (first_cell->type.in(ID($_DFF_P_), ID($_DFFE_PN_), ID($_DFFE_PP_)))
clkpol = 1;
- else if (c->type.in(ID($_DFF_N_), ID($DFFE_NN_), ID($_DFFE_NP_)))
+ else if (first_cell->type.in(ID($_DFF_N_), ID($DFFE_NN_), ID($_DFFE_NP_)))
clkpol = 0;
- else if (c->type.in(ID($dff), ID($dffe))) {
- clkpol = c->getParam(ID(CLK_POLARITY));
- c->setPort(ID(C), c->getPort(ID(CLK)));
- c->unsetPort(ID(CLK));
- }
+ else if (first_cell->type.in(ID($dff), ID($dffe)))
+ clkpol = first_cell->getParam(ID(CLK_POLARITY));
else
log_abort();
- if (c->type.in(ID($_DFFE_NP_), ID($_DFFE_PP_)))
+ if (first_cell->type.in(ID($_DFFE_NP_), ID($_DFFE_PP_)))
enpol = 1;
- else if (c->type.in(ID($_DFFE_NN_), ID($_DFFE_PN_)))
+ else if (first_cell->type.in(ID($_DFFE_NN_), ID($_DFFE_PN_)))
enpol = 0;
- else if (c->type.in(ID($dffe))) {
- enpol = c->getParam(ID(EN_POLARITY));
- c->setPort(ID(E), c->getPort(ID(EN)));
- c->unsetPort(ID(EN));
- }
+ else if (first_cell->type.in(ID($dffe)))
+ enpol = first_cell->getParam(ID(EN_POLARITY));
else
enpol = 2;
- c->parameters.clear();
- c->setParam(ID(DEPTH), GetSize(ud.chain));
- c->setParam(ID(INIT), initval.as_const());
c->setParam(ID(CLKPOL), clkpol);
c->setParam(ID(ENPOL), enpol);
- if (c->type.in(ID($_DFF_N_), ID($_DFF_P_), ID($dff)))
- c->setPort(ID(E), State::S1);
- c->setPort(ID(L), st.shiftx->getPort(ID(B)));
+
+ if (first_cell->type.in(ID($_DFF_N_), ID($_DFF_P_), ID($_DFFE_NN_), ID($_DFFE_NP_), ID($_DFFE_PN_), ID($_DFFE_PP_)))
+ c->setPort(ID(C), first_cell->getPort(ID(C)));
+ else if (first_cell->type.in(ID($dff), ID($dffe)))
+ c->setPort(ID(C), first_cell->getPort(ID(CLK)));
+ else
+ log_abort();
+ c->setPort(ID(D), first_cell->getPort(ID(D))[first_slice]);
c->setPort(ID(Q), st.shiftx->getPort(ID(Y)));
- c->type = ID($__XILINX_SHREG_);
+ c->setPort(ID(L), st.shiftx->getPort(ID(B)));
+ if (first_cell->type.in(ID($_DFF_N_), ID($_DFF_P_), ID($dff)))
+ c->setPort(ID(E), State::S1);
+ else if (first_cell->type.in(ID($_DFFE_NN_), ID($_DFFE_NP_), ID($_DFFE_PN_), ID($_DFFE_PP_)))
+ c->setPort(ID(E), first_cell->getPort(ID(E)));
+ else if (first_cell->type.in(ID($dffe)))
+ c->setPort(ID(E), first_cell->getPort(ID(EN)));
+ else
+ log_abort();
}
else
log_abort();