3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-15 03:35:40 +00:00

rtlil: replace SigSig actions with new type SyncAction

(cherry picked from commit 94a53e08bc)
This commit is contained in:
Emil J. Tywoniak 2025-11-02 11:22:03 +01:00
parent 0372902ad0
commit 2330860c48
19 changed files with 297 additions and 238 deletions

View file

@ -122,6 +122,7 @@ namespace RTLIL
struct CaseRule;
struct SwitchRule;
struct MemWriteAction;
struct SyncAction;
struct SyncRule;
struct Process;
struct Binding;
@ -1340,6 +1341,10 @@ struct RTLIL::AttrObject
// void set_strpool_attribute(IdString id, const pool<string> &data);
// void add_strpool_attribute(IdString id, const pool<string> &data);
// pool<string> get_strpool_attribute(RTLIL::IdString id) const;
void transfer_attribute(const AttrObject* from, const IdString& attr) {
if (from->has_attribute(attr))
attributes[attr] = from->attributes.at(attr);
}
void set_hdlname_attribute(const vector<string> &hierarchy);
vector<string> get_hdlname_attribute() const;
@ -2359,6 +2364,7 @@ public:
// Transfer src from `source` verbatim (same pool). Asserts attached
// to a design.
void adopt_src_from(const RTLIL::AttrObject *source);
void transfer_src_attribute(const RTLIL::AttrObject *source) { adopt_src_from(source); }
void absorb_attrs(dict<RTLIL::IdString, RTLIL::Const> &&buf);
bool known_driver() const { return driverCell_ != nullptr; }
@ -2465,6 +2471,7 @@ public:
void set_src_attribute(TwineRef src);
std::string get_src_attribute() const;
void adopt_src_from(const RTLIL::AttrObject *source);
void transfer_src_attribute(const RTLIL::AttrObject *source) { adopt_src_from(source); }
void absorb_attrs(dict<RTLIL::IdString, RTLIL::Const> &&buf);
// access cell ports
@ -2517,7 +2524,7 @@ struct RTLIL::CaseRule : public RTLIL::AttrObject
RTLIL::Module *module = nullptr;
std::vector<RTLIL::SigSpec> compare;
std::vector<RTLIL::SigSig> actions;
std::vector<RTLIL::SyncAction> actions;
std::vector<RTLIL::SwitchRule*> switches;
~CaseRule();
@ -2592,11 +2599,17 @@ struct RTLIL::MemWriteAction : RTLIL::AttrObject
void absorb_attrs(dict<RTLIL::IdString, RTLIL::Const> &&buf);
};
struct RTLIL::SyncAction
{
RTLIL::SigSpec lhs;
RTLIL::SigSpec rhs;
};
struct RTLIL::SyncRule
{
RTLIL::SyncType type;
RTLIL::SigSpec signal;
std::vector<RTLIL::SigSig> actions;
std::vector<RTLIL::SyncAction> actions;
std::vector<RTLIL::MemWriteAction> mem_write_actions;
template<typename T> void rewrite_sigspecs(T &functor);
@ -3260,8 +3273,8 @@ void RTLIL::CaseRule::rewrite_sigspecs(T &functor) {
for (auto &it : compare)
functor(it);
for (auto &it : actions) {
functor(it.first);
functor(it.second);
functor(it.lhs);
functor(it.rhs);
}
for (auto it : switches)
it->rewrite_sigspecs(functor);
@ -3272,7 +3285,7 @@ void RTLIL::CaseRule::rewrite_sigspecs2(T &functor) {
for (auto &it : compare)
functor(it);
for (auto &it : actions) {
functor(it.first, it.second);
functor(it.lhs, it.rhs);
}
for (auto it : switches)
it->rewrite_sigspecs2(functor);
@ -3299,8 +3312,8 @@ void RTLIL::SyncRule::rewrite_sigspecs(T &functor)
{
functor(signal);
for (auto &it : actions) {
functor(it.first);
functor(it.second);
functor(it.lhs);
functor(it.rhs);
}
for (auto &it : mem_write_actions) {
functor(it.address);
@ -3314,7 +3327,7 @@ void RTLIL::SyncRule::rewrite_sigspecs2(T &functor)
{
functor(signal);
for (auto &it : actions) {
functor(it.first, it.second);
functor(it.lhs, it.rhs);
}
for (auto &it : mem_write_actions) {
functor(it.address);