@@ -67,6 +67,11 @@ struct PrepPass : public ScriptPass
67
67
log (" -nokeepdc\n " );
68
68
log (" do not call opt_* with -keepdc\n " );
69
69
log (" \n " );
70
+ log (" -barriers\n " );
71
+ log (" add optimization barriers to all public wires to preserve their structure.\n " );
72
+ log (" this limits the optimizations that can be applied to the design to only\n " );
73
+ log (" those involving private wires.\n " );
74
+ log (" \n " );
70
75
log (" -run <from_label>[:<to_label>]\n " );
71
76
log (" only run the commands between the labels (see below). an empty\n " );
72
77
log (" from label is synonymous to 'begin', and empty to label is\n " );
@@ -79,7 +84,7 @@ struct PrepPass : public ScriptPass
79
84
}
80
85
81
86
string top_module, fsm_opts;
82
- bool autotop, flatten, ifxmode, memxmode, nomemmode, nokeepdc, rdff;
87
+ bool autotop, flatten, ifxmode, memxmode, nomemmode, nokeepdc, rdff, barriers ;
83
88
84
89
void clear_flags () override
85
90
{
@@ -92,6 +97,7 @@ struct PrepPass : public ScriptPass
92
97
nomemmode = false ;
93
98
nokeepdc = false ;
94
99
rdff = false ;
100
+ barriers = false ;
95
101
}
96
102
97
103
void execute (std::vector<std::string> args, RTLIL::Design *design) override
@@ -148,6 +154,10 @@ struct PrepPass : public ScriptPass
148
154
nokeepdc = true ;
149
155
continue ;
150
156
}
157
+ if (args[argidx] == " -barriers" ) {
158
+ barriers = true ;
159
+ continue ;
160
+ }
151
161
break ;
152
162
}
153
163
extra_args (args, argidx, design);
@@ -183,12 +193,16 @@ struct PrepPass : public ScriptPass
183
193
184
194
if (check_label (" coarse" ))
185
195
{
196
+ if (help_mode || barriers)
197
+ run (" optbarriers" , " (if -barriers)" );
186
198
if (help_mode)
187
199
run (" proc [-ifx]" );
188
200
else
189
201
run (ifxmode ? " proc -ifx" : " proc" );
190
- if (help_mode || flatten)
191
- run (" flatten" , " (if -flatten)" );
202
+ if (help_mode)
203
+ run (" flatten [-barriers]" , " (if -flatten)" );
204
+ else if (flatten)
205
+ run (barriers ? " flatten -barriers" : " flatten" );
192
206
run (" future" );
193
207
run (nokeepdc ? " opt_expr" : " opt_expr -keepdc" );
194
208
run (" opt_clean" );
0 commit comments