mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
Add support for CEP
This commit is contained in:
parent
05282afc25
commit
447a31e75d
|
@ -41,6 +41,7 @@ void pack_xilinx_dsp(dict<SigBit, Cell*> &bit_to_driver, xilinx_dsp_pm &pm)
|
||||||
log("postAdd: %s\n", log_id(st.postAdd, "--"));
|
log("postAdd: %s\n", log_id(st.postAdd, "--"));
|
||||||
log("postAddMux: %s\n", log_id(st.postAddMux, "--"));
|
log("postAddMux: %s\n", log_id(st.postAddMux, "--"));
|
||||||
log("ffP: %s\n", log_id(st.ffP, "--"));
|
log("ffP: %s\n", log_id(st.ffP, "--"));
|
||||||
|
log("ffPmux: %s\n", log_id(st.ffPmux, "--"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
log("Analysing %s.%s for Xilinx DSP packing.\n", log_id(pm.module), log_id(st.dsp));
|
log("Analysing %s.%s for Xilinx DSP packing.\n", log_id(pm.module), log_id(st.dsp));
|
||||||
|
@ -112,34 +113,32 @@ void pack_xilinx_dsp(dict<SigBit, Cell*> &bit_to_driver, xilinx_dsp_pm &pm)
|
||||||
cell->setParam("\\BREG", 1);
|
cell->setParam("\\BREG", 1);
|
||||||
}
|
}
|
||||||
if (st.ffM) {
|
if (st.ffM) {
|
||||||
SigSpec D = st.ffM->getPort("\\D");
|
|
||||||
SigSpec Q = st.ffM->getPort("\\Q");
|
|
||||||
P.replace(pm.sigmap(D), Q);
|
|
||||||
cell->setParam("\\MREG", State::S1);
|
|
||||||
if (st.ffMmux) {
|
if (st.ffMmux) {
|
||||||
cell->setPort("\\CEM", st.ffMmux->getPort("\\S"));
|
cell->setPort("\\CEM", st.ffMmux->getPort("\\S"));
|
||||||
pm.autoremove(st.ffMmux);
|
pm.autoremove(st.ffMmux);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cell->setPort("\\CEM", State::S1);
|
cell->setPort("\\CEM", State::S1);
|
||||||
|
SigSpec D = st.ffM->getPort("\\D");
|
||||||
|
SigSpec Q = st.ffM->getPort("\\Q");
|
||||||
|
P.replace(/*pm.sigmap*/(D), Q);
|
||||||
|
|
||||||
|
cell->setParam("\\MREG", State::S1);
|
||||||
pm.autoremove(st.ffM);
|
pm.autoremove(st.ffM);
|
||||||
}
|
}
|
||||||
if (st.ffP) {
|
if (st.ffP) {
|
||||||
SigSpec D;
|
if (st.ffPmux) {
|
||||||
//if (st.muxP)
|
cell->setPort("\\CEP", st.ffPmux->getPort("\\S"));
|
||||||
// D = st.muxP->getPort("\\B");
|
st.ffPmux->connections_.at("\\Y").replace(P, pm.module->addWire(NEW_ID, GetSize(P)));
|
||||||
//else
|
}
|
||||||
D = st.ffP->getPort("\\D");
|
else
|
||||||
SigSpec Q = st.ffP->getPort("\\Q");
|
|
||||||
P.replace(pm.sigmap(D), Q);
|
|
||||||
cell->setParam("\\PREG", State::S1);
|
|
||||||
if (st.ffP->type == "$dff")
|
|
||||||
cell->setPort("\\CEP", State::S1);
|
cell->setPort("\\CEP", State::S1);
|
||||||
//else if (st.ffP->type == "$dffe")
|
SigSpec D = st.ffP->getPort("\\D");
|
||||||
// cell->setPort("\\CEP", st.ffP->getPort("\\EN"));
|
SigSpec Q = st.ffP->getPort("\\Q");
|
||||||
else log_abort();
|
P.replace(/*pm.sigmap*/(D), Q);
|
||||||
|
|
||||||
st.ffP->connections_.at("\\Q").replace(P, pm.module->addWire(NEW_ID, GetSize(P)));
|
st.ffP->connections_.at("\\Q").replace(P, pm.module->addWire(NEW_ID, GetSize(P)));
|
||||||
|
|
||||||
|
cell->setParam("\\PREG", State::S1);
|
||||||
}
|
}
|
||||||
|
|
||||||
log(" clock: %s (%s)", log_signal(st.clock), "posedge");
|
log(" clock: %s (%s)", log_signal(st.clock), "posedge");
|
||||||
|
|
|
@ -2,7 +2,7 @@ pattern xilinx_dsp
|
||||||
|
|
||||||
state <SigBit> clock
|
state <SigBit> clock
|
||||||
state <SigSpec> sigA sigffAmux sigB sigffBmux sigC sigM sigP
|
state <SigSpec> sigA sigffAmux sigB sigffBmux sigC sigM sigP
|
||||||
state <IdString> ffAmuxAB ffBmuxAB ffMmuxAB postAddAB postAddMuxAB
|
state <IdString> ffAmuxAB ffBmuxAB ffMmuxAB ffPmuxAB postAddAB postAddMuxAB
|
||||||
|
|
||||||
match dsp
|
match dsp
|
||||||
select dsp->type.in(\DSP48E1)
|
select dsp->type.in(\DSP48E1)
|
||||||
|
@ -120,7 +120,7 @@ match ffMmux
|
||||||
filter port(ffMmux, AB) == sigM.extract(0, GetSize(port(ffMmux, \Y)))
|
filter port(ffMmux, AB) == sigM.extract(0, GetSize(port(ffMmux, \Y)))
|
||||||
filter nusers(sigM.extract_end(GetSize(port(ffMmux, AB)))) <= 1
|
filter nusers(sigM.extract_end(GetSize(port(ffMmux, AB)))) <= 1
|
||||||
set ffMmuxAB AB
|
set ffMmuxAB AB
|
||||||
optional
|
semioptional
|
||||||
endmatch
|
endmatch
|
||||||
|
|
||||||
code sigM
|
code sigM
|
||||||
|
@ -199,6 +199,22 @@ code sigC sigP
|
||||||
}
|
}
|
||||||
endcode
|
endcode
|
||||||
|
|
||||||
|
match ffPmux
|
||||||
|
select ffPmux->type.in($mux)
|
||||||
|
select nusers(port(ffPmux, \Y)) == 2
|
||||||
|
filter GetSize(port(ffPmux, \Y)) <= GetSize(sigP)
|
||||||
|
choice <IdString> AB {\A, \B}
|
||||||
|
filter port(ffPmux, AB) == sigP.extract(0, GetSize(port(ffPmux, \Y)))
|
||||||
|
filter nusers(sigP.extract_end(GetSize(port(ffPmux, AB)))) <= 1
|
||||||
|
set ffPmuxAB AB
|
||||||
|
semioptional
|
||||||
|
endmatch
|
||||||
|
|
||||||
|
code sigP
|
||||||
|
if (ffPmux)
|
||||||
|
sigP = port(ffPmux, \Y);
|
||||||
|
endcode
|
||||||
|
|
||||||
match ffP
|
match ffP
|
||||||
if param(dsp, \PREG).as_int() == 0
|
if param(dsp, \PREG).as_int() == 0
|
||||||
select ffP->type.in($dff)
|
select ffP->type.in($dff)
|
||||||
|
@ -207,6 +223,8 @@ match ffP
|
||||||
filter GetSize(port(ffP, \D)) >= GetSize(sigP)
|
filter GetSize(port(ffP, \D)) >= GetSize(sigP)
|
||||||
slice offset GetSize(port(ffP, \D))
|
slice offset GetSize(port(ffP, \D))
|
||||||
filter offset+GetSize(sigP) <= GetSize(port(ffP, \D)) && port(ffP, \D).extract(offset, GetSize(sigP)) == sigP
|
filter offset+GetSize(sigP) <= GetSize(port(ffP, \D)) && port(ffP, \D).extract(offset, GetSize(sigP)) == sigP
|
||||||
|
// Check ffPmux (when present) is a $dff enable mux
|
||||||
|
filter !ffPmux || port(ffP, \Q) == port(ffPmux, ffPmuxAB == \A ? \B : \A)
|
||||||
optional
|
optional
|
||||||
endmatch
|
endmatch
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue