@@ -33,6 +33,7 @@ struct OptBarriersPass : public Pass {
3333 OptBarriersPass () : Pass(" optbarriers" , " insert optimization barriers" ) {}
3434
3535 void help () override {
36+ // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
3637 log (" \n " );
3738 log (" optbarriers [options] [selection]\n " );
3839 log (" \n " );
@@ -45,6 +46,9 @@ struct OptBarriersPass : public Pass {
4546 log (" -noprocs\n " );
4647 log (" don't add optimization barriers to the outputs of processes\n " );
4748 log (" \n " );
49+ log (" -noconns\n " );
50+ log (" don't add optimization barriers to the left hand sides of connections\n " );
51+ log (" \n " );
4852 log (" -private\n " );
4953 log (" also add optimization barriers to private wires\n " );
5054 log (" \n " );
@@ -58,6 +62,7 @@ struct OptBarriersPass : public Pass {
5862
5963 bool nocells_mode = false ;
6064 bool noprocs_mode = false ;
65+ bool noconns_mode = false ;
6166 bool private_mode = false ;
6267 bool remove_mode = false ;
6368
@@ -72,6 +77,10 @@ struct OptBarriersPass : public Pass {
7277 noprocs_mode = true ;
7378 continue ;
7479 }
80+ if (arg == " -noconns" ) {
81+ noconns_mode = true ;
82+ continue ;
83+ }
7584 if (arg == " -private" ) {
7685 private_mode = true ;
7786 continue ;
@@ -187,23 +196,25 @@ struct OptBarriersPass : public Pass {
187196 }
188197
189198 // Rewrite connections
190- std::vector<RTLIL::SigSig> new_connections;
191- for (const auto & conn : module ->connections ()) {
192- RTLIL::SigSig skip_conn, barrier_conn;
193-
194- for (int i = 0 ; i < GetSize (conn.first ); i++) {
195- auto & sigsig = skip (conn.first [i]) ? skip_conn : barrier_conn;
196- sigsig.first .append (conn.first [i]);
197- sigsig.second .append (conn.second [i]);
198- }
199+ if (!noconns_mode) {
200+ std::vector<RTLIL::SigSig> new_connections;
201+ for (const auto & conn : module ->connections ()) {
202+ RTLIL::SigSig skip_conn, barrier_conn;
203+
204+ for (int i = 0 ; i < GetSize (conn.first ); i++) {
205+ auto & sigsig = skip (conn.first [i]) ? skip_conn : barrier_conn;
206+ sigsig.first .append (conn.first [i]);
207+ sigsig.second .append (conn.second [i]);
208+ }
199209
200- if (!skip_conn.first .empty ())
201- new_connections.emplace_back (std::move (skip_conn));
210+ if (!skip_conn.first .empty ())
211+ new_connections.emplace_back (std::move (skip_conn));
202212
203- if (!barrier_conn.first .empty ())
204- module ->addBarrier (NEW_ID, barrier_conn.second , barrier_conn.first );
213+ if (!barrier_conn.first .empty ())
214+ module ->addBarrier (NEW_ID, barrier_conn.second , barrier_conn.first );
215+ }
216+ module ->new_connections (new_connections);
205217 }
206- module ->new_connections (new_connections);
207218 }
208219 }
209220
0 commit comments