ff: twines

This commit is contained in:
Emil J. Tywoniak 2026-06-16 23:16:36 +02:00
parent 3a5f5c77bf
commit 7baf458ffe
2 changed files with 6 additions and 6 deletions

View File

@ -26,14 +26,14 @@ USING_YOSYS_NAMESPACE
template<typename InputType, typename OutputType, typename = std::enable_if_t<std::is_base_of_v<FfTypeData, OutputType>>> template<typename InputType, typename OutputType, typename = std::enable_if_t<std::is_base_of_v<FfTypeData, OutputType>>>
void manufacture_info(InputType flop, OutputType& info, FfInitVals *initvals) { void manufacture_info(InputType flop, OutputType& info, FfInitVals *initvals) {
Cell* cell = nullptr; Cell* cell = nullptr;
IdString type; TwineRef type;
constexpr bool have_cell = std::is_same_v<InputType, Cell*>; constexpr bool have_cell = std::is_same_v<InputType, Cell*>;
if constexpr (std::is_same_v<InputType, IdString>) { if constexpr (std::is_same_v<InputType, TwineRef>) {
type = flop; type = flop;
} else { } else {
static_assert(std::is_same_v<InputType, Cell*>); static_assert(std::is_same_v<InputType, Cell*>);
cell = flop; cell = flop;
type = flop->type; type = flop->type.ref();
} }
if constexpr (have_cell) { if constexpr (have_cell) {
info.sig_q = cell->getPort(TW::Q); info.sig_q = cell->getPort(TW::Q);
@ -52,7 +52,7 @@ void manufacture_info(InputType flop, OutputType& info, FfInitVals *initvals) {
} }
std::string type_str = type.str(); std::string type_str = TW::str(type);
if (type.in(TW($anyinit), TW($ff), TW($dff), TW($dffe), TW($dffsr), TW($dffsre), TW($adff), TW($adffe), TW($aldff), TW($aldffe), TW($sdff), TW($sdffe), TW($sdffce), TW($dlatch), TW($adlatch), TW($dlatchsr), TW($sr))) { if (type.in(TW($anyinit), TW($ff), TW($dff), TW($dffe), TW($dffsr), TW($dffsre), TW($adff), TW($adffe), TW($aldff), TW($aldffe), TW($sdff), TW($sdffe), TW($sdffce), TW($dlatch), TW($adlatch), TW($dlatchsr), TW($sr))) {
if (type.in(TW($anyinit), TW($ff))) { if (type.in(TW($anyinit), TW($ff))) {
@ -331,7 +331,7 @@ void manufacture_info(InputType flop, OutputType& info, FfInitVals *initvals) {
} }
} }
FfTypeData::FfTypeData(IdString type) : FfTypeData() FfTypeData::FfTypeData(TwineRef type) : FfTypeData()
{ {
manufacture_info(type, *this, nullptr); manufacture_info(type, *this, nullptr);
} }

View File

@ -80,7 +80,7 @@ YOSYS_NAMESPACE_BEGIN
// - empty set [not a cell — will be emitted as a simple direct connection] // - empty set [not a cell — will be emitted as a simple direct connection]
struct FfTypeData { struct FfTypeData {
FfTypeData(IdString type); FfTypeData(TwineRef type);
FfTypeData() { FfTypeData() {
has_clk = false; has_clk = false;
has_gclk = false; has_gclk = false;