Trait haybale::backend::BV

source ·
pub trait BV: Clone + PartialEq + Eq + Debug {
    type SolverRef: SolverRef<BV = Self>;

Show 82 methods // Required methods fn new(solver: Self::SolverRef, width: u32, name: Option<&str>) -> Self; fn from_bool(solver: Self::SolverRef, b: bool) -> Self; fn from_i32(solver: Self::SolverRef, i: i32, width: u32) -> Self; fn from_u32(solver: Self::SolverRef, u: u32, width: u32) -> Self; fn from_i64(solver: Self::SolverRef, i: i64, width: u32) -> Self; fn from_u64(solver: Self::SolverRef, u: u64, width: u32) -> Self; fn zero(solver: Self::SolverRef, width: u32) -> Self; fn one(solver: Self::SolverRef, width: u32) -> Self; fn ones(solver: Self::SolverRef, width: u32) -> Self; fn from_binary_str(solver: Self::SolverRef, bits: &str) -> Self; fn from_dec_str(solver: Self::SolverRef, num: &str, width: u32) -> Self; fn from_hex_str(solver: Self::SolverRef, num: &str, width: u32) -> Self; fn as_binary_str(&self) -> Option<String>; fn as_u64(&self) -> Option<u64>; fn as_bool(&self) -> Option<bool>; fn get_a_solution(&self) -> Result<BVSolution>; fn get_solver(&self) -> Self::SolverRef; fn get_id(&self) -> i32; fn get_width(&self) -> u32; fn get_symbol(&self) -> Option<&str>; fn set_symbol(&mut self, symbol: Option<&str>); fn is_const(&self) -> bool; fn has_same_width(&self, other: &Self) -> bool; fn assert(&self) -> Result<()>; fn is_failed_assumption(&self) -> bool; fn _eq(&self, other: &Self) -> Self; fn _ne(&self, other: &Self) -> Self; fn add(&self, other: &Self) -> Self; fn sub(&self, other: &Self) -> Self; fn mul(&self, other: &Self) -> Self; fn udiv(&self, other: &Self) -> Self; fn sdiv(&self, other: &Self) -> Self; fn urem(&self, other: &Self) -> Self; fn srem(&self, other: &Self) -> Self; fn smod(&self, other: &Self) -> Self; fn inc(&self) -> Self; fn dec(&self) -> Self; fn neg(&self) -> Self; fn uaddo(&self, other: &Self) -> Self; fn saddo(&self, other: &Self) -> Self; fn usubo(&self, other: &Self) -> Self; fn ssubo(&self, other: &Self) -> Self; fn umulo(&self, other: &Self) -> Self; fn smulo(&self, other: &Self) -> Self; fn sdivo(&self, other: &Self) -> Self; fn not(&self) -> Self; fn and(&self, other: &Self) -> Self; fn or(&self, other: &Self) -> Self; fn xor(&self, other: &Self) -> Self; fn nand(&self, other: &Self) -> Self; fn nor(&self, other: &Self) -> Self; fn xnor(&self, other: &Self) -> Self; fn sll(&self, other: &Self) -> Self; fn srl(&self, other: &Self) -> Self; fn sra(&self, other: &Self) -> Self; fn rol(&self, other: &Self) -> Self; fn ror(&self, other: &Self) -> Self; fn redand(&self) -> Self; fn redor(&self) -> Self; fn redxor(&self) -> Self; fn ugt(&self, other: &Self) -> Self; fn ugte(&self, other: &Self) -> Self; fn sgt(&self, other: &Self) -> Self; fn sgte(&self, other: &Self) -> Self; fn ult(&self, other: &Self) -> Self; fn ulte(&self, other: &Self) -> Self; fn slt(&self, other: &Self) -> Self; fn slte(&self, other: &Self) -> Self; fn zext(&self, i: u32) -> Self; fn sext(&self, i: u32) -> Self; fn slice(&self, high: u32, low: u32) -> Self; fn concat(&self, other: &Self) -> Self; fn repeat(&self, n: u32) -> Self; fn iff(&self, other: &Self) -> Self; fn implies(&self, other: &Self) -> Self; fn cond_bv(&self, truebv: &Self, falsebv: &Self) -> Self; // Provided methods fn zero_extend_to_bits(&self, bits: u32) -> Self { ... } fn sign_extend_to_bits(&self, bits: u32) -> Self { ... } fn uadds(&self, other: &Self) -> Self { ... } fn sadds(&self, other: &Self) -> Self { ... } fn usubs(&self, other: &Self) -> Self { ... } fn ssubs(&self, other: &Self) -> Self { ... }
}
Expand description

Trait for things which can act like bitvectors.

These methods mirror the methods available on boolector::BV; detailed docs are available there.

Required Associated Types§

source

type SolverRef: SolverRef<BV = Self>

Required Methods§

source

fn new(solver: Self::SolverRef, width: u32, name: Option<&str>) -> Self

source

fn from_bool(solver: Self::SolverRef, b: bool) -> Self

source

fn from_i32(solver: Self::SolverRef, i: i32, width: u32) -> Self

source

fn from_u32(solver: Self::SolverRef, u: u32, width: u32) -> Self

source

fn from_i64(solver: Self::SolverRef, i: i64, width: u32) -> Self

source

fn from_u64(solver: Self::SolverRef, u: u64, width: u32) -> Self

source

fn zero(solver: Self::SolverRef, width: u32) -> Self

source

fn one(solver: Self::SolverRef, width: u32) -> Self

source

fn ones(solver: Self::SolverRef, width: u32) -> Self

source

fn from_binary_str(solver: Self::SolverRef, bits: &str) -> Self

source

fn from_dec_str(solver: Self::SolverRef, num: &str, width: u32) -> Self

source

fn from_hex_str(solver: Self::SolverRef, num: &str, width: u32) -> Self

source

fn as_binary_str(&self) -> Option<String>

source

fn as_u64(&self) -> Option<u64>

source

fn as_bool(&self) -> Option<bool>

source

fn get_a_solution(&self) -> Result<BVSolution>

source

fn get_solver(&self) -> Self::SolverRef

source

fn get_id(&self) -> i32

source

fn get_width(&self) -> u32

source

fn get_symbol(&self) -> Option<&str>

source

fn set_symbol(&mut self, symbol: Option<&str>)

source

fn is_const(&self) -> bool

source

fn has_same_width(&self, other: &Self) -> bool

source

fn assert(&self) -> Result<()>

source

fn is_failed_assumption(&self) -> bool

source

fn _eq(&self, other: &Self) -> Self

source

fn _ne(&self, other: &Self) -> Self

source

fn add(&self, other: &Self) -> Self

source

fn sub(&self, other: &Self) -> Self

source

fn mul(&self, other: &Self) -> Self

source

fn udiv(&self, other: &Self) -> Self

source

fn sdiv(&self, other: &Self) -> Self

source

fn urem(&self, other: &Self) -> Self

source

fn srem(&self, other: &Self) -> Self

source

fn smod(&self, other: &Self) -> Self

source

fn inc(&self) -> Self

source

fn dec(&self) -> Self

source

fn neg(&self) -> Self

source

fn uaddo(&self, other: &Self) -> Self

source

fn saddo(&self, other: &Self) -> Self

source

fn usubo(&self, other: &Self) -> Self

source

fn ssubo(&self, other: &Self) -> Self

source

fn umulo(&self, other: &Self) -> Self

source

fn smulo(&self, other: &Self) -> Self

source

fn sdivo(&self, other: &Self) -> Self

source

fn not(&self) -> Self

source

fn and(&self, other: &Self) -> Self

source

fn or(&self, other: &Self) -> Self

source

fn xor(&self, other: &Self) -> Self

source

fn nand(&self, other: &Self) -> Self

source

fn nor(&self, other: &Self) -> Self

source

fn xnor(&self, other: &Self) -> Self

source

fn sll(&self, other: &Self) -> Self

source

fn srl(&self, other: &Self) -> Self

source

fn sra(&self, other: &Self) -> Self

source

fn rol(&self, other: &Self) -> Self

source

fn ror(&self, other: &Self) -> Self

source

fn redand(&self) -> Self

source

fn redor(&self) -> Self

source

fn redxor(&self) -> Self

source

fn ugt(&self, other: &Self) -> Self

source

fn ugte(&self, other: &Self) -> Self

source

fn sgt(&self, other: &Self) -> Self

source

fn sgte(&self, other: &Self) -> Self

source

fn ult(&self, other: &Self) -> Self

source

fn ulte(&self, other: &Self) -> Self

source

fn slt(&self, other: &Self) -> Self

source

fn slte(&self, other: &Self) -> Self

source

fn zext(&self, i: u32) -> Self

source

fn sext(&self, i: u32) -> Self

source

fn slice(&self, high: u32, low: u32) -> Self

source

fn concat(&self, other: &Self) -> Self

source

fn repeat(&self, n: u32) -> Self

source

fn iff(&self, other: &Self) -> Self

source

fn implies(&self, other: &Self) -> Self

source

fn cond_bv(&self, truebv: &Self, falsebv: &Self) -> Self

Provided Methods§

source

fn zero_extend_to_bits(&self, bits: u32) -> Self

Zero-extend a BV to the specified number of bits. The input BV can be already the desired size (in which case this function is a no-op) or smaller (in which case this function will extend), but not larger (in which case this function will panic).

A default implementation is provided in terms of the other trait methods.

source

fn sign_extend_to_bits(&self, bits: u32) -> Self

Sign-extend a BV to the specified number of bits. The input BV can be already the desired size (in which case this function is a no-op) or smaller (in which case this function will extend), but not larger (in which case this function will panic).

A default implementation is provided in terms of the other trait methods.

source

fn uadds(&self, other: &Self) -> Self

Saturating addition, unsigned. The result will be the same as normal addition, except that if the operation would (unsigned) overflow, the maximum value (for that bitwidth) is returned instead.

A default implementation is provided in terms of the other trait methods.

source

fn sadds(&self, other: &Self) -> Self

Saturating addition, signed. The result will be the same as normal addition, except that if the operation would (signed) overflow for being too positive / too negative, the largest / smallest signed value respectively (for that bitwidth) is returned instead.

A default implementation is provided in terms of the other trait methods.

source

fn usubs(&self, other: &Self) -> Self

Saturating subtraction, unsigned. The result will be the same as normal subtraction, except that if the operation would overflow (result in a negative number), zero is returned instead.

A default implementation is provided in terms of the other trait methods.

source

fn ssubs(&self, other: &Self) -> Self

Saturating subtraction, signed. The result will be the same as normal subtraction, except that if the operation would (signed) overflow for being too positive / too negative, the largest / smallest signed value respectively (for that bitwidth) is returned instead.

A default implementation is provided in terms of the other trait methods.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl BV for BV<Rc<Btor>>

Some prototypical BV and Memory implementations: boolector::BV<Rc<Btor>>, crate::simple_memory::Memory, and crate::cell_memory::Memory

§

type SolverRef = Rc<Btor>

source§

fn new(btor: Rc<Btor>, width: u32, name: Option<&str>) -> Self

source§

fn from_bool(btor: Rc<Btor>, b: bool) -> Self

source§

fn from_i32(btor: Rc<Btor>, i: i32, width: u32) -> Self

source§

fn from_u32(btor: Rc<Btor>, u: u32, width: u32) -> Self

source§

fn from_i64(btor: Rc<Btor>, i: i64, width: u32) -> Self

source§

fn from_u64(btor: Rc<Btor>, u: u64, width: u32) -> Self

source§

fn zero(btor: Rc<Btor>, width: u32) -> Self

source§

fn one(btor: Rc<Btor>, width: u32) -> Self

source§

fn ones(btor: Rc<Btor>, width: u32) -> Self

source§

fn from_binary_str(btor: Rc<Btor>, bits: &str) -> Self

source§

fn from_dec_str(btor: Rc<Btor>, num: &str, width: u32) -> Self

source§

fn from_hex_str(btor: Rc<Btor>, num: &str, width: u32) -> Self

source§

fn as_binary_str(&self) -> Option<String>

source§

fn as_u64(&self) -> Option<u64>

source§

fn as_bool(&self) -> Option<bool>

source§

fn get_a_solution(&self) -> Result<BVSolution>

source§

fn get_solver(&self) -> Self::SolverRef

source§

fn get_id(&self) -> i32

source§

fn get_width(&self) -> u32

source§

fn get_symbol(&self) -> Option<&str>

source§

fn set_symbol(&mut self, symbol: Option<&str>)

source§

fn is_const(&self) -> bool

source§

fn has_same_width(&self, other: &Self) -> bool

source§

fn assert(&self) -> Result<()>

source§

fn is_failed_assumption(&self) -> bool

source§

fn _eq(&self, other: &Self) -> Self

source§

fn _ne(&self, other: &Self) -> Self

source§

fn add(&self, other: &Self) -> Self

source§

fn sub(&self, other: &Self) -> Self

source§

fn mul(&self, other: &Self) -> Self

source§

fn udiv(&self, other: &Self) -> Self

source§

fn sdiv(&self, other: &Self) -> Self

source§

fn urem(&self, other: &Self) -> Self

source§

fn srem(&self, other: &Self) -> Self

source§

fn smod(&self, other: &Self) -> Self

source§

fn inc(&self) -> Self

source§

fn dec(&self) -> Self

source§

fn neg(&self) -> Self

source§

fn uaddo(&self, other: &Self) -> Self

source§

fn saddo(&self, other: &Self) -> Self

source§

fn usubo(&self, other: &Self) -> Self

source§

fn ssubo(&self, other: &Self) -> Self

source§

fn umulo(&self, other: &Self) -> Self

source§

fn smulo(&self, other: &Self) -> Self

source§

fn sdivo(&self, other: &Self) -> Self

source§

fn not(&self) -> Self

source§

fn and(&self, other: &Self) -> Self

source§

fn or(&self, other: &Self) -> Self

source§

fn xor(&self, other: &Self) -> Self

source§

fn nand(&self, other: &Self) -> Self

source§

fn nor(&self, other: &Self) -> Self

source§

fn xnor(&self, other: &Self) -> Self

source§

fn sll(&self, other: &Self) -> Self

source§

fn srl(&self, other: &Self) -> Self

source§

fn sra(&self, other: &Self) -> Self

source§

fn rol(&self, other: &Self) -> Self

source§

fn ror(&self, other: &Self) -> Self

source§

fn redand(&self) -> Self

source§

fn redor(&self) -> Self

source§

fn redxor(&self) -> Self

source§

fn ugt(&self, other: &Self) -> Self

source§

fn ugte(&self, other: &Self) -> Self

source§

fn sgt(&self, other: &Self) -> Self

source§

fn sgte(&self, other: &Self) -> Self

source§

fn ult(&self, other: &Self) -> Self

source§

fn ulte(&self, other: &Self) -> Self

source§

fn slt(&self, other: &Self) -> Self

source§

fn slte(&self, other: &Self) -> Self

source§

fn zext(&self, i: u32) -> Self

source§

fn sext(&self, i: u32) -> Self

source§

fn slice(&self, high: u32, low: u32) -> Self

source§

fn concat(&self, other: &Self) -> Self

source§

fn repeat(&self, n: u32) -> Self

source§

fn iff(&self, other: &Self) -> Self

source§

fn implies(&self, other: &Self) -> Self

source§

fn cond_bv(&self, truebv: &Self, falsebv: &Self) -> Self

Implementors§