@@ -86,17 +86,16 @@ int hw_cbmc_parse_optionst::doit()
86
86
prop_convt &prop_conv=cbmc_solver->prop_conv ();
87
87
hw_bmct hw_bmc (options, symbol_table, ui_message_handler, prop_conv);
88
88
89
- if (cmdline.isset (" bound" ))
90
- hw_bmc.unwind_no_timeframes =safe_string2unsigned (cmdline.get_value (" bound" ))+1 ;
91
- else
92
- hw_bmc.unwind_no_timeframes =1 ;
93
-
94
89
goto_functionst goto_functions;
95
90
96
- int get_goto_program_ret=get_goto_program (options, hw_bmc, goto_functions);
91
+ int get_goto_program_ret=get_goto_program (
92
+ options, hw_bmc.bmc_constraints , goto_functions);
97
93
if (get_goto_program_ret!=-1 )
98
94
return get_goto_program_ret;
99
95
96
+ hw_bmc.unwind_no_timeframes =get_bound ();
97
+ hw_bmc.unwind_module =get_top_module ();
98
+
100
99
label_properties (goto_functions);
101
100
102
101
if (cmdline.isset (" show-properties" ))
@@ -115,7 +114,7 @@ int hw_cbmc_parse_optionst::doit()
115
114
116
115
/* ******************************************************************\
117
116
118
- Function: hw_cbmc_parse_optionst::get_modules
117
+ Function: hw_cbmc_parse_optionst::get_top_module
119
118
120
119
Inputs:
121
120
@@ -125,28 +124,71 @@ Function: hw_cbmc_parse_optionst::get_modules
125
124
126
125
\*******************************************************************/
127
126
128
- int hw_cbmc_parse_optionst::get_modules (bmct &bmc )
127
+ irep_idt hw_cbmc_parse_optionst::get_top_module ( )
129
128
{
130
- //
131
- // unwinding of transition systems
132
- //
133
-
134
129
std::string top_module;
135
130
136
131
if (cmdline.isset (" module" ))
137
132
top_module=cmdline.get_value (" module" );
138
133
else if (cmdline.isset (" top" ))
139
134
top_module=cmdline.get_value (" top" );
140
135
141
- if (top_module!=" " )
136
+ if (top_module==" " )
137
+ return irep_idt ();
138
+
139
+ return get_module (
140
+ symbol_table, top_module, get_message_handler ()).name ;
141
+ }
142
+
143
+ /* ******************************************************************\
144
+
145
+ Function: hw_cbmc_parse_optionst::get_bound
146
+
147
+ Inputs:
148
+
149
+ Outputs:
150
+
151
+ Purpose: add additional (synchonous) modules
152
+
153
+ \*******************************************************************/
154
+
155
+ unsigned hw_cbmc_parse_optionst::get_bound ()
156
+ {
157
+ if (cmdline.isset (" bound" ))
158
+ return safe_string2unsigned (cmdline.get_value (" bound" ))+1 ;
159
+ else
160
+ return 1 ;
161
+ }
162
+
163
+ /* ******************************************************************\
164
+
165
+ Function: hw_cbmc_parse_optionst::get_modules
166
+
167
+ Inputs:
168
+
169
+ Outputs:
170
+
171
+ Purpose: add additional (synchonous) modules
172
+
173
+ \*******************************************************************/
174
+
175
+ int hw_cbmc_parse_optionst::get_modules (expr_listt &bmc_constraints)
176
+ {
177
+ //
178
+ // unwinding of transition systems
179
+ //
180
+
181
+ irep_idt top_module=get_top_module ();
182
+
183
+ if (!top_module.empty ())
142
184
{
143
185
try
144
186
{
145
- const symbolt &symbol=
146
- get_module (symbol_table, top_module, get_message_handler ());
147
-
148
187
if (cmdline.isset (" gen-interface" ))
149
188
{
189
+ const symbolt &symbol=
190
+ namespacet (symbol_table).lookup (top_module);
191
+
150
192
if (cmdline.isset (" outfile" ))
151
193
{
152
194
std::ofstream out (cmdline.get_value (" outfile" ).c_str ());
@@ -164,10 +206,6 @@ int hw_cbmc_parse_optionst::get_modules(bmct &bmc)
164
206
return 0 ; // done
165
207
}
166
208
167
- hw_bmct &hw_bmc=dynamic_cast <hw_bmct &>(bmc);
168
-
169
- hw_bmc.unwind_module =symbol.name ;
170
-
171
209
//
172
210
// map HDL variables to C variables
173
211
//
@@ -176,10 +214,10 @@ int hw_cbmc_parse_optionst::get_modules(bmct &bmc)
176
214
177
215
map_vars (
178
216
symbol_table,
179
- symbol. name ,
180
- hw_bmc. bmc_constraints ,
181
- ui_message_handler ,
182
- hw_bmc. unwind_no_timeframes );
217
+ top_module ,
218
+ bmc_constraints,
219
+ get_message_handler () ,
220
+ get_bound () );
183
221
}
184
222
185
223
catch (int e) { return 6 ; }
0 commit comments