Skip to content

Commit df1aa91

Browse files
committed
extract instantiate_var_mapt into a separate header file
1 parent f20c412 commit df1aa91

File tree

2 files changed

+62
-35
lines changed

2 files changed

+62
-35
lines changed

src/trans-netlist/instantiate_netlist.cpp

+2-35
Original file line numberDiff line numberDiff line change
@@ -13,48 +13,15 @@ Author: Daniel Kroening, [email protected]
1313
#include <util/std_expr.h>
1414

1515
#include <ebmc/ebmc_error.h>
16-
#include <solvers/flattening/boolbv.h>
1716
#include <solvers/prop/literal_expr.h>
1817
#include <temporal-logic/temporal_logic.h>
1918
#include <verilog/sva_expr.h>
2019

20+
#include "netlist_boolbv.h"
21+
2122
#include <cassert>
2223
#include <cstdlib>
2324

24-
/*******************************************************************\
25-
26-
Class: instantiate_var_mapt
27-
28-
Purpose:
29-
30-
\*******************************************************************/
31-
32-
class instantiate_var_mapt:public boolbvt
33-
{
34-
public:
35-
instantiate_var_mapt(const namespacet &_ns, propt &solver,
36-
message_handlert &message_handler,
37-
const var_mapt &_var_map)
38-
: boolbvt(_ns, solver, message_handler), var_map(_var_map) {}
39-
40-
typedef boolbvt SUB;
41-
42-
// overloading
43-
using boolbvt::get_literal;
44-
45-
virtual literalt convert_bool(const exprt &expr);
46-
virtual literalt get_literal(const std::string &symbol, const unsigned bit);
47-
virtual bvt convert_bitvector(const exprt &expr);
48-
49-
protected:
50-
// disable smart variable allocation,
51-
// we already have literals for all variables
52-
virtual bool boolbv_set_equality_to_true(const equal_exprt &expr) { return true; }
53-
virtual bool set_equality_to_true(const equal_exprt &expr) { return true; }
54-
55-
const var_mapt &var_map;
56-
};
57-
5825
/*******************************************************************\
5926
6027
Function: instantiate_constraint

src/trans-netlist/netlist_boolbv.h

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*******************************************************************\
2+
3+
Module: boolbvt for Netlists
4+
5+
Author: Daniel Kroening, [email protected]
6+
7+
\*******************************************************************/
8+
9+
#ifndef CPROVER_TRANS_NETLIST_NETLIST_BOOLBV_H
10+
#define CPROVER_TRANS_NETLIST_NETLIST_BOOLBV_H
11+
12+
#include <solvers/flattening/boolbv.h>
13+
14+
#include "var_map.h"
15+
16+
/*******************************************************************\
17+
18+
Class: instantiate_var_mapt
19+
20+
Purpose:
21+
22+
\*******************************************************************/
23+
24+
class instantiate_var_mapt : public boolbvt
25+
{
26+
public:
27+
instantiate_var_mapt(
28+
const namespacet &_ns,
29+
propt &solver,
30+
message_handlert &message_handler,
31+
const var_mapt &_var_map)
32+
: boolbvt(_ns, solver, message_handler), var_map(_var_map)
33+
{
34+
}
35+
36+
typedef boolbvt SUB;
37+
38+
// overloading
39+
literalt convert_bool(const exprt &) override;
40+
bvt convert_bitvector(const exprt &expr) override;
41+
42+
using boolbvt::get_literal;
43+
literalt get_literal(const std::string &symbol, const unsigned bit);
44+
45+
protected:
46+
// disable smart variable allocation,
47+
// we already have literals for all variables
48+
bool boolbv_set_equality_to_true(const equal_exprt &) override
49+
{
50+
return true;
51+
}
52+
bool set_equality_to_true(const equal_exprt &expr) override
53+
{
54+
return true;
55+
}
56+
57+
const var_mapt &var_map;
58+
};
59+
60+
#endif // CPROVER_TRANS_NETLIST_NETLIST_BOOLBV_H

0 commit comments

Comments
 (0)