CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boolbv_not.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9#include "boolbv.h"
10
12
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
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 {
31
32 bvt bv;
33 bv.resize(2);
34
35 // this returns 'x' for 'z'
37 bv[1]=has_x_or_z;
38
39 return bv;
40 }
41 }
42
43
44 return conversion_failed(expr);
45}
Pre-defined bitvector types.
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
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:39
virtual bvt convert_not(const not_exprt &expr)
bv_utilst bv_utils
Definition boolbv.h:118
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:94
static bvt verilog_bv_normal_bits(const bvt &)
literalt is_zero(const bvt &op)
Definition bv_utils.h:143
literalt verilog_bv_has_x_or_z(const bvt &)
typet & type()
Return the type of the expression.
Definition expr.h:84
const irep_idt & id() const
Definition irep.h:388
Boolean negation.
Definition std_expr.h:2454
virtual literalt lselect(literalt a, literalt b, literalt c)=0
The type of an expression, extends irept.
Definition type.h:29
const exprt & op() const
Definition std_expr.h:391
std::vector< literalt > bvt
Definition literal.h:201
literalt const_literal(bool value)
Definition literal.h:188
#define CHECK_RETURN(CONDITION)
Definition invariant.h:495