cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
boolbv_not.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module:
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
9
#include "
boolbv.h
"
10
11
#include <
util/bitvector_types.h
>
12
13
bvt
boolbvt::convert_not
(
const
not_exprt
&expr)
14
{
15
const
bvt
&op_bv=
convert_bv
(expr.
op
());
16
CHECK_RETURN
(!op_bv.empty());
17
18
const
typet
&op_type=expr.
op
().
type
();
19
20
if
(op_type.
id
()!=ID_verilog_signedbv ||
21
op_type.
id
()!=ID_verilog_unsignedbv)
22
{
23
if
(
24
(expr.
type
().
id
() == ID_verilog_signedbv ||
25
expr.
type
().
id
() == ID_verilog_unsignedbv) &&
26
to_bitvector_type
(expr.
type
()).get_width() == 1)
27
{
28
literalt
has_x_or_z=
bv_utils
.verilog_bv_has_x_or_z(op_bv);
29
literalt
normal_bits_zero=
30
bv_utils
.is_zero(
bv_utils
.verilog_bv_normal_bits(op_bv));
31
32
bvt
bv;
33
bv.resize(2);
34
35
// this returns 'x' for 'z'
36
bv[0]=
prop
.lselect(has_x_or_z,
const_literal
(
false
), normal_bits_zero);
37
bv[1]=has_x_or_z;
38
39
return
bv;
40
}
41
}
42
43
44
return
conversion_failed
(expr);
45
}
bitvector_types.h
Pre-defined bitvector types.
to_bitvector_type
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
Definition
bitvector_types.h:32
boolbv.h
boolbvt::convert_bv
virtual const bvt & convert_bv(const exprt &expr, const std::optional< std::size_t > expected_width={})
Convert expression to vector of literalts, using an internal cache to speed up conversion if availabl...
Definition
boolbv.cpp:40
boolbvt::convert_not
virtual bvt convert_not(const not_exprt &expr)
Definition
boolbv_not.cpp:13
boolbvt::bv_utils
bv_utilst bv_utils
Definition
boolbv.h:121
boolbvt::conversion_failed
bvt conversion_failed(const exprt &expr)
Print that the expression of x has failed conversion, then return a vector of x's width.
Definition
boolbv.cpp:95
exprt::type
typet & type()
Return the type of the expression.
Definition
expr.h:85
irept::id
const irep_idt & id() const
Definition
irep.h:388
literalt
Definition
literal.h:26
not_exprt
Boolean negation.
Definition
std_expr.h:2378
prop_conv_solvert::prop
propt & prop
Definition
prop_conv_solver.h:130
typet
The type of an expression, extends irept.
Definition
type.h:29
unary_exprt::op
const exprt & op() const
Definition
std_expr.h:384
bvt
std::vector< literalt > bvt
Definition
literal.h:201
const_literal
literalt const_literal(bool value)
Definition
literal.h:188
CHECK_RETURN
#define CHECK_RETURN(CONDITION)
Definition
invariant.h:495
solvers
flattening
boolbv_not.cpp
Generated by
1.17.0