88
99#include " show_trans.h"
1010
11+ #include < util/cout_message.h>
12+
1113#include < verilog/expr2verilog.h>
1214
1315#include " ebmc_base.h"
2527
2628\*******************************************************************/
2729
28- class show_transt : public ebmc_baset
30+ class show_transt
2931{
3032public:
31- show_transt (
32- const cmdlinet &cmdline,
33- ui_message_handlert &ui_message_handler):
34- ebmc_baset (cmdline, ui_message_handler)
33+ explicit show_transt (const transition_systemt &_transition_system)
34+ : transition_system(_transition_system)
3535 {
3636 }
3737
38- int show_trans_verilog_rtl ();
39- int show_trans_verilog_netlist ();
40- int show_trans ();
38+ int show_trans_verilog_rtl (std::ostream & );
39+ int show_trans_verilog_netlist (std::ostream & );
40+ int show_trans (std::ostream & );
4141
4242protected:
43- int show_trans_verilog_rtl (std::ostream &out) ;
44- int show_trans_verilog_netlist (std::ostream &out);
43+ const transition_systemt &transition_system ;
44+
4545 void verilog_header (std::ostream &out, const std::string &desc);
4646 void
4747 print_verilog_constraints (const exprt &, const namespacet &, std::ostream &);
@@ -60,11 +60,11 @@ Function: show_trans_verilog_netlist
6060\*******************************************************************/
6161
6262int show_trans_verilog_netlist (
63- const cmdlinet &cmdline ,
64- ui_message_handlert &ui_message_handler )
63+ const transition_systemt &transition_system ,
64+ std::ostream &out )
6565{
66- show_transt show_trans (cmdline, ui_message_handler);
67- return show_trans.show_trans_verilog_netlist ();
66+ show_transt show_trans (transition_system);
67+ return show_trans.show_trans_verilog_netlist (out );
6868}
6969
7070/* ******************************************************************\
@@ -80,11 +80,11 @@ Function: show_trans_verilog_rtl
8080\*******************************************************************/
8181
8282int show_trans_verilog_rtl (
83- const cmdlinet &cmdline ,
84- ui_message_handlert &ui_message_handler )
83+ const transition_systemt &transition_system ,
84+ std::ostream &out )
8585{
86- show_transt show_trans (cmdline, ui_message_handler);
87- return show_trans.show_trans_verilog_rtl ();
86+ show_transt show_trans (transition_system);
87+ return show_trans.show_trans_verilog_rtl (out );
8888}
8989
9090/* ******************************************************************\
@@ -101,8 +101,10 @@ Function: show_transt::show_trans_verilog_netlist
101101
102102int show_transt::show_trans_verilog_netlist (std::ostream &out)
103103{
104+ console_message_handlert message_handler;
105+
104106 output_verilog_netlistt output_verilog (
105- transition_system.symbol_table , out, message. get_message_handler () );
107+ transition_system.symbol_table , out, message_handler );
106108
107109 try
108110 {
@@ -145,8 +147,10 @@ Function: show_transt::show_trans_verilog_rtl
145147
146148int show_transt::show_trans_verilog_rtl (std::ostream &out)
147149{
150+ console_message_handlert message_handler;
151+
148152 output_verilog_rtlt output_verilog (
149- transition_system.symbol_table , out, message. get_message_handler () );
153+ transition_system.symbol_table , out, message_handler );
150154
151155 try
152156 {
@@ -177,6 +181,24 @@ int show_transt::show_trans_verilog_rtl(std::ostream &out)
177181
178182/* ******************************************************************\
179183
184+ Function: show_transt::show_trans
185+
186+ Inputs:
187+
188+ Outputs:
189+
190+ Purpose:
191+
192+ \*******************************************************************/
193+
194+ int show_transt::show_trans (std::ostream &out)
195+ {
196+ transition_system.output (out);
197+ return 0 ;
198+ }
199+
200+ /* ******************************************************************\
201+
180202Function: show_transt::verilog_header
181203
182204 Inputs:
@@ -226,86 +248,6 @@ void show_transt::print_verilog_constraints(
226248
227249/* ******************************************************************\
228250
229- Function: show_transt::show_trans
230-
231- Inputs:
232-
233- Outputs:
234-
235- Purpose:
236-
237- \*******************************************************************/
238-
239- int show_transt::show_trans ()
240- {
241- transition_system =
242- get_transition_system (cmdline, message.get_message_handler ());
243-
244- transition_system.output (std::cout);
245-
246- return 0 ;
247- }
248-
249- /* ******************************************************************\
250-
251- Function: show_transt::show_trans_verilog_rtl
252-
253- Inputs:
254-
255- Outputs:
256-
257- Purpose:
258-
259- \*******************************************************************/
260-
261- int show_transt::show_trans_verilog_rtl ()
262- {
263- transition_system =
264- get_transition_system (cmdline, message.get_message_handler ());
265-
266- if (cmdline.isset (" outfile" ))
267- {
268- const std::string filename=cmdline.get_value (" outfile" );
269- auto outfile = output_filet{filename};
270- show_trans_verilog_rtl (outfile.stream ());
271- }
272- else
273- show_trans_verilog_rtl (std::cout);
274-
275- return 0 ;
276- }
277-
278- /* ******************************************************************\
279-
280- Function: show_transt::show_trans_verilog_netlist
281-
282- Inputs:
283-
284- Outputs:
285-
286- Purpose:
287-
288- \*******************************************************************/
289-
290- int show_transt::show_trans_verilog_netlist ()
291- {
292- transition_system =
293- get_transition_system (cmdline, message.get_message_handler ());
294-
295- if (cmdline.isset (" outfile" ))
296- {
297- const std::string filename=cmdline.get_value (" outfile" );
298- auto outfile = output_filet{filename};
299- show_trans_verilog_netlist (outfile.stream ());
300- }
301- else
302- show_trans_verilog_netlist (std::cout);
303-
304- return 0 ;
305- }
306-
307- /* ******************************************************************\
308-
309251Function: show_trans
310252
311253 Inputs:
@@ -316,11 +258,8 @@ Function: show_trans
316258
317259\*******************************************************************/
318260
319- int show_trans (
320- const cmdlinet &cmdline,
321- ui_message_handlert &ui_message_handler)
261+ int show_trans (const transition_systemt &transition_system, std::ostream &out)
322262{
323- show_transt show_trans (cmdline, ui_message_handler );
324- return show_trans.show_trans ();
263+ show_transt show_trans (transition_system );
264+ return show_trans.show_trans (out );
325265}
326-
0 commit comments