From 516857f3ba662f467d56df562eeca9ed214ac702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcelina=20Ko=C5=9Bcielnicka?= Date: Wed, 8 Apr 2020 17:36:12 +0200 Subject: [NFCI] Deduplicate builtin FF cell types list A few passes included the same list of FF cell types. Make it a global const instead. The zinit pass also seems to include a list like that, but given that it seems to be completely broken at the time (see #1568 discussion), I'm going to pretend I didn't see that. --- kernel/rtlil.cc | 47 +++++++++++++++++++++++++++++++++++++++++++++++ kernel/rtlil.h | 2 ++ 2 files changed, 49 insertions(+) (limited to 'kernel') diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 00c116115..6a7eba2fa 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -47,6 +47,53 @@ int RTLIL::IdString::last_created_idx_ptr_; dict RTLIL::constpad; +const pool &RTLIL::builtin_ff_cell_types() { + static const pool res = { + ID($sr), + ID($ff), + ID($dff), + ID($dffe), + ID($dffsr), + ID($adff), + ID($dlatch), + ID($dlatchsr), + ID($_DFFE_NN_), + ID($_DFFE_NP_), + ID($_DFFE_PN_), + ID($_DFFE_PP_), + ID($_DFFSR_NNN_), + ID($_DFFSR_NNP_), + ID($_DFFSR_NPN_), + ID($_DFFSR_NPP_), + ID($_DFFSR_PNN_), + ID($_DFFSR_PNP_), + ID($_DFFSR_PPN_), + ID($_DFFSR_PPP_), + ID($_DFF_NN0_), + ID($_DFF_NN1_), + ID($_DFF_NP0_), + ID($_DFF_NP1_), + ID($_DFF_N_), + ID($_DFF_PN0_), + ID($_DFF_PN1_), + ID($_DFF_PP0_), + ID($_DFF_PP1_), + ID($_DFF_P_), + ID($_DLATCHSR_NNN_), + ID($_DLATCHSR_NNP_), + ID($_DLATCHSR_NPN_), + ID($_DLATCHSR_NPP_), + ID($_DLATCHSR_PNN_), + ID($_DLATCHSR_PNP_), + ID($_DLATCHSR_PPN_), + ID($_DLATCHSR_PPP_), + ID($_DLATCH_N_), + ID($_DLATCH_P_), + ID($_FF_), + }; + return res; +} + RTLIL::Const::Const() { flags = RTLIL::CONST_FLAG_NONE; diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 7279835ea..fb65f7a03 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -383,6 +383,8 @@ namespace RTLIL extern dict constpad; + const pool &builtin_ff_cell_types(); + static inline std::string escape_id(const std::string &str) { if (str.size() > 0 && str[0] != '\\' && str[0] != '$') return "\\" + str; -- cgit v1.2.3