From 1fb904e2816de9f03b50a6642f44226c7187dee7 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Tue, 24 Mar 2026 11:32:29 +0100 Subject: [PATCH] ff: add FfDataSigMapped --- kernel/ff.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/kernel/ff.h b/kernel/ff.h index d6cf99b9b..54342400a 100644 --- a/kernel/ff.h +++ b/kernel/ff.h @@ -221,6 +221,43 @@ struct FfData { void flip_rst_bits(const pool &bits); }; +struct FfDataSigMapped : public FfData { + SigMap& sigmap; + FfDataSigMapped(SigMap& map, Module *module, FfInitVals *initvals = nullptr, IdString name = IdString()) : FfData(module, initvals, name), sigmap(map) {} + + void remap() { + sigmap(sig_q); + sigmap(sig_d); + sigmap(sig_ad); + sigmap(sig_clk); + sigmap(sig_ce); + sigmap(sig_aload); + sigmap(sig_arst); + sigmap(sig_srst); + sigmap(sig_clr); + sigmap(sig_set); + } + FfDataSigMapped(SigMap& map, FfInitVals *initvals, Cell *cell_) : FfData(initvals, cell_), sigmap(map) { + remap(); + } + FfDataSigMapped(SigMap& map, const FfData& base) : FfData(base), sigmap(map) { + remap(); + } + FfDataSigMapped(const FfDataSigMapped& other) : FfData(other), sigmap(other.sigmap) {} + FfDataSigMapped& operator=(const FfDataSigMapped& other) { + FfData::operator=(other); + return *this; + } + Cell* emit() { + Cell* cell = FfData::emit(); + remap(); + return cell; + } + FfDataSigMapped slice(const std::vector &bits) { + return FfDataSigMapped(sigmap, FfData::slice(bits)); + } +}; + YOSYS_NAMESPACE_END #endif