From f3899696a7d67ee0822efd6b00bef0e9b359c2f2 Mon Sep 17 00:00:00 2001 From: YRabbit Date: Tue, 31 Aug 2021 07:53:15 +1000 Subject: gowin: Place DFFs of different types in the slice. Allow the registers of the same type or pairs shown below to be placed in the same slide: |--------|--------| | DFFS | DFFR | | DFFSE | DFFRE | | DFFP | DFFC | | DFFPE | DFFCE | | DFFNS | DFFNR | | DFFNSE | DFFNRE | | DFFNP | DFFNC | | DFFNPE | DFFNCE | Signed-off-by: YRabbit --- gowin/arch.cc | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/gowin/arch.cc b/gowin/arch.cc index 813d52ed..022c93c3 100644 --- a/gowin/arch.cc +++ b/gowin/arch.cc @@ -804,6 +804,27 @@ Arch::Arch(ArchArgs args) : args(args) } } } + + // Permissible combinations of modes in a single slice + dff_comp_mode[id_DFF] = id_DFF; + dff_comp_mode[id_DFFE] = id_DFFE; + dff_comp_mode[id_DFFS] = id_DFFR; + dff_comp_mode[id_DFFR] = id_DFFS; + dff_comp_mode[id_DFFSE] = id_DFFRE; + dff_comp_mode[id_DFFRE] = id_DFFSE; + dff_comp_mode[id_DFFP] = id_DFFC; + dff_comp_mode[id_DFFC] = id_DFFP; + dff_comp_mode[id_DFFPE] = id_DFFCE; + dff_comp_mode[id_DFFCE] = id_DFFPE; + dff_comp_mode[id_DFFNS] = id_DFFNR; + dff_comp_mode[id_DFFNR] = id_DFFNS; + dff_comp_mode[id_DFFNSE] = id_DFFNRE; + dff_comp_mode[id_DFFNRE] = id_DFFNSE; + dff_comp_mode[id_DFFNP] = id_DFFNC; + dff_comp_mode[id_DFFNC] = id_DFFNP; + dff_comp_mode[id_DFFNPE] = id_DFFNCE; + dff_comp_mode[id_DFFNCE] = id_DFFNPE; + BaseArch::init_cell_types(); BaseArch::init_bel_buckets(); } @@ -1251,8 +1272,11 @@ bool Arch::cellsCompatible(const CellInfo **cells, int count) const return false; if (mode[cls] == IdString()) mode[cls] = ci->ff_type; - else if (mode[cls] != ci->ff_type) - return false; + else if (mode[cls] != ci->ff_type) { + auto res = dff_comp_mode.find(mode[cls]); + if (res == dff_comp_mode.end() || res->second != ci->ff_type) + return false; + } } } return true; -- cgit v1.2.3