Skip to content

Commit 35fdabf

Browse files
authored
Merge pull request #889 from diffblue/netlist
extract netlist creation
2 parents 8d43375 + 4ccc1e9 commit 35fdabf

File tree

6 files changed

+62
-27
lines changed

6 files changed

+62
-27
lines changed

src/ebmc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ SRC = \
1919
liveness_to_safety.cpp \
2020
live_signal.cpp \
2121
main.cpp \
22+
netlist.cpp \
2223
neural_liveness.cpp \
2324
output_file.cpp \
2425
output_verilog.cpp \

src/ebmc/bdd_engine.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ Author: Daniel Kroening, [email protected]
2020
#include <temporal-logic/temporal_logic.h>
2121
#include <trans-netlist/aig_prop.h>
2222
#include <trans-netlist/instantiate_netlist.h>
23-
#include <trans-netlist/trans_to_netlist.h>
2423
#include <trans-netlist/trans_trace_netlist.h>
2524
#include <trans-netlist/unwind_netlist.h>
2625
#include <verilog/sva_expr.h>
2726

27+
#include "netlist.h"
28+
2829
#include <algorithm>
2930
#include <iostream>
3031

@@ -193,22 +194,17 @@ property_checker_resultt bdd_enginet::operator()()
193194
if(cmdline.isset("liveness-to-safety"))
194195
liveness_to_safety(transition_system, properties);
195196

196-
const auto property_map = properties.make_property_map();
197-
198197
message.status() << "Building netlist" << messaget::eom;
199198

200-
convert_trans_to_netlist(
201-
transition_system.symbol_table,
202-
transition_system.main_symbol->name,
203-
transition_system.trans_expr,
204-
property_map,
205-
netlist,
206-
message.get_message_handler());
199+
netlist = make_netlist(
200+
transition_system, properties, message.get_message_handler());
207201

208202
message.statistics() << "Latches: " << netlist.var_map.latches.size()
209203
<< ", nodes: " << netlist.number_of_nodes()
210204
<< messaget::eom;
211205

206+
const auto property_map = properties.make_property_map();
207+
212208
for(const auto &[_, expr] : property_map)
213209
get_atomic_propositions(expr);
214210

src/ebmc/ebmc_base.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ Author: Daniel Kroening, [email protected]
1313

1414
#include <trans-netlist/compute_ct.h>
1515
#include <trans-netlist/ldg.h>
16-
#include <trans-netlist/trans_to_netlist.h>
1716

1817
#include "ebmc_error.h"
1918
#include "ebmc_version.h"
19+
#include "netlist.h"
2020

2121
#include <iostream>
2222

@@ -149,13 +149,8 @@ bool ebmc_baset::make_netlist(netlistt &netlist)
149149

150150
try
151151
{
152-
convert_trans_to_netlist(
153-
transition_system.symbol_table,
154-
transition_system.main_symbol->name,
155-
transition_system.trans_expr,
156-
properties.make_property_map(),
157-
netlist,
158-
message.get_message_handler());
152+
netlist = ::make_netlist(
153+
transition_system, properties, message.get_message_handler());
159154
}
160155

161156
catch(const std::string &error_str)

src/ebmc/netlist.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*******************************************************************\
2+
3+
Module: Netlists for EBMC
4+
5+
Author: Daniel Kroening, [email protected]
6+
7+
\*******************************************************************/
8+
9+
#include "netlist.h"
10+
11+
#include <trans-netlist/netlist.h>
12+
#include <trans-netlist/trans_to_netlist.h>
13+
14+
netlistt make_netlist(
15+
transition_systemt &transition_system,
16+
ebmc_propertiest &properties,
17+
message_handlert &message_handler)
18+
{
19+
netlistt netlist;
20+
21+
convert_trans_to_netlist(
22+
transition_system.symbol_table,
23+
transition_system.main_symbol->name,
24+
transition_system.trans_expr,
25+
properties.make_property_map(),
26+
netlist,
27+
message_handler);
28+
29+
return netlist;
30+
}

src/ebmc/netlist.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*******************************************************************\
2+
3+
Module: Netlists for EBMC
4+
5+
Author: Daniel Kroening, [email protected]
6+
7+
\*******************************************************************/
8+
9+
#ifndef CPROVER_EBMC_NETLIST_H
10+
#define CPROVER_EBMC_NETLIST_H
11+
12+
#include "ebmc_properties.h"
13+
#include "transition_system.h"
14+
15+
class netlistt;
16+
17+
netlistt
18+
make_netlist(transition_systemt &, ebmc_propertiest &, message_handlert &);
19+
20+
#endif // CPROVER_EBMC_NETLIST_H

src/ebmc/property_checker.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Author: Daniel Kroening, [email protected]
1111
#include <util/string2int.h>
1212

1313
#include <solvers/sat/satcheck.h>
14-
#include <trans-netlist/trans_to_netlist.h>
1514
#include <trans-netlist/trans_trace_netlist.h>
1615
#include <trans-netlist/unwind_netlist.h>
1716

@@ -21,6 +20,7 @@ Author: Daniel Kroening, [email protected]
2120
#include "ebmc_error.h"
2221
#include "ebmc_solver_factory.h"
2322
#include "k_induction.h"
23+
#include "netlist.h"
2424
#include "output_file.h"
2525
#include "report_results.h"
2626

@@ -221,16 +221,9 @@ property_checker_resultt bit_level_bmc(
221221
throw "no properties";
222222

223223
// make net-list
224-
netlistt netlist;
225224
message.status() << "Generating Netlist" << messaget::eom;
226225

227-
convert_trans_to_netlist(
228-
transition_system.symbol_table,
229-
transition_system.main_symbol->name,
230-
transition_system.trans_expr,
231-
properties.make_property_map(),
232-
netlist,
233-
message.get_message_handler());
226+
auto netlist = make_netlist(transition_system, properties, message_handler);
234227

235228
message.statistics() << "Latches: " << netlist.var_map.latches.size()
236229
<< ", nodes: " << netlist.number_of_nodes()

0 commit comments

Comments
 (0)