3030USING_YOSYS_NAMESPACE
3131PRIVATE_NAMESPACE_BEGIN
3232
33+ // Returns an l-value used in a sync process such that all bits of the l-value
34+ // are used in every sync action that uses at least one of them - i.e. they
35+ // are all subject to the same set of updates. If no such l-values remain,
36+ // returns an empty SigSpec
3337RTLIL::SigSpec find_any_lvalue (const RTLIL::Process& proc)
3438{
3539 RTLIL::SigSpec lvalue;
3640
41+ // Find any l-value
3742 for (const auto * sync : proc.syncs )
3843 for (const auto & action : sync->actions )
3944 if (action.first .size () > 0 ) {
@@ -42,6 +47,8 @@ RTLIL::SigSpec find_any_lvalue(const RTLIL::Process& proc)
4247 break ;
4348 }
4449
50+ // If parts of this l-value appear in other actions, take the intersection
51+ // of bits used in both so that the remaining bits are all updated together
4552 for (const auto * sync : proc.syncs ) {
4653 RTLIL::SigSpec this_lvalue;
4754 for (const auto & action : sync->actions )
@@ -88,7 +95,7 @@ class Dff {
8895
8996 // Edge sensitive assignments (clock)
9097 if (sync->type == RTLIL::SyncType::STp || sync->type == RTLIL::SyncType::STn) {
91- if (sync_edge != NULL && sync_edge != sync)
98+ if (sync_edge != nullptr && sync_edge != sync)
9299 log_error (" Multiple edge sensitive events found for this signal!\n " );
93100 sig_out.replace (action.first , action.second , &sig_in);
94101 sync_edge = sync;
@@ -97,7 +104,7 @@ class Dff {
97104
98105 // Always assignments
99106 if (sync->type == RTLIL::SyncType::STa) {
100- if (sync_always != NULL && sync_always != sync)
107+ if (sync_always != nullptr && sync_always != sync)
101108 log_error (" Multiple always events found for this signal!\n " );
102109 sig_out.replace (action.first , action.second , &sig_in);
103110 sync_always = sync;
0 commit comments