mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
Improve A/B reg packing
This commit is contained in:
parent
e075f0dda0
commit
79d63479ea
|
@ -23,6 +23,9 @@
|
||||||
USING_YOSYS_NAMESPACE
|
USING_YOSYS_NAMESPACE
|
||||||
PRIVATE_NAMESPACE_BEGIN
|
PRIVATE_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
template<class T> bool includes(const T &lhs, const T &rhs) {
|
||||||
|
return std::includes(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
|
||||||
|
}
|
||||||
#include "passes/pmgen/xilinx_dsp_pm.h"
|
#include "passes/pmgen/xilinx_dsp_pm.h"
|
||||||
|
|
||||||
void pack_xilinx_dsp(xilinx_dsp_pm &pm)
|
void pack_xilinx_dsp(xilinx_dsp_pm &pm)
|
||||||
|
|
|
@ -9,10 +9,9 @@ endmatch
|
||||||
|
|
||||||
match ffA
|
match ffA
|
||||||
select ffA->type.in($dff, $dffe)
|
select ffA->type.in($dff, $dffe)
|
||||||
select param(ffA, \CLK_POLARITY).as_bool()
|
|
||||||
// select nusers(port(ffA, \Q)) == 2
|
|
||||||
index <pool<SigBit>> port(ffA, \Q).to_sigbit_pool() === port(dsp, \A).remove_const().to_sigbit_pool()
|
|
||||||
// DSP48E1 does not support clock inversion
|
// DSP48E1 does not support clock inversion
|
||||||
|
select param(ffA, \CLK_POLARITY).as_bool()
|
||||||
|
filter includes(port(ffA, \Q).to_sigbit_set(), port(dsp, \A).remove_const().to_sigbit_set())
|
||||||
optional
|
optional
|
||||||
endmatch
|
endmatch
|
||||||
|
|
||||||
|
@ -23,9 +22,9 @@ endcode
|
||||||
|
|
||||||
match ffB
|
match ffB
|
||||||
select ffB->type.in($dff, $dffe)
|
select ffB->type.in($dff, $dffe)
|
||||||
|
// DSP48E1 does not support clock inversion
|
||||||
select param(ffB, \CLK_POLARITY).as_bool()
|
select param(ffB, \CLK_POLARITY).as_bool()
|
||||||
// select nusers(port(ffB, \Q)) == 2
|
filter includes(port(ffB, \Q).to_sigbit_set(), port(dsp, \B).remove_const().to_sigbit_set())
|
||||||
index <pool<SigBit>> port(ffB, \Q).to_sigbit_pool() === port(dsp, \B).remove_const().to_sigbit_pool()
|
|
||||||
optional
|
optional
|
||||||
endmatch
|
endmatch
|
||||||
|
|
||||||
|
@ -52,9 +51,10 @@ endcode
|
||||||
match ffP
|
match ffP
|
||||||
select ffP->type.in($dff, $dffe)
|
select ffP->type.in($dff, $dffe)
|
||||||
select nusers(port(ffP, \D)) == 2
|
select nusers(port(ffP, \D)) == 2
|
||||||
|
// DSP48E1 does not support clock inversion
|
||||||
|
select param(ffP, \CLK_POLARITY).as_bool()
|
||||||
filter param(ffP, \WIDTH).as_int() == P_WIDTH
|
filter param(ffP, \WIDTH).as_int() == P_WIDTH
|
||||||
filter port(ffP, \D) == port(dsp, \P).extract(0, P_WIDTH)
|
filter port(ffP, \D) == port(dsp, \P).extract(0, P_WIDTH)
|
||||||
index <Const> param(ffP, \CLK_POLARITY) === State::S1
|
|
||||||
optional
|
optional
|
||||||
endmatch
|
endmatch
|
||||||
|
|
||||||
|
@ -76,6 +76,8 @@ match ffY
|
||||||
if muxP
|
if muxP
|
||||||
select ffY->type.in($dff, $dffe)
|
select ffY->type.in($dff, $dffe)
|
||||||
select nusers(port(ffY, \D)) == 2
|
select nusers(port(ffY, \D)) == 2
|
||||||
|
// DSP48E1 does not support clock inversion
|
||||||
|
select param(ffY, \CLK_POLARITY).as_bool()
|
||||||
index <SigSpec> port(ffY, \D) === port(muxP, \Y)
|
index <SigSpec> port(ffY, \D) === port(muxP, \Y)
|
||||||
endmatch
|
endmatch
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue