ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
kitty::dynamic_truth_table Struct Reference

#include <kitty_dynamic_tt.hpp>

Public Member Functions

 dynamic_truth_table (uint32_t num_vars)
 
 dynamic_truth_table ()
 
dynamic_truth_table construct () const
 
uint32_t num_vars () const noexcept
 
uint32_t num_blocks () const noexcept
 
uint32_t num_bits () const noexcept
 
std::vector< uint64_t >::iterator begin () noexcept
 Begin iterator to bits.
 
std::vector< uint64_t >::iterator end () noexcept
 End iterator to bits.
 
std::vector< uint64_t >::const_iterator begin () const noexcept
 Begin iterator to bits.
 
std::vector< uint64_t >::const_iterator end () const noexcept
 End iterator to bits.
 
std::vector< uint64_t >::reverse_iterator rbegin () noexcept
 Reverse begin iterator to bits.
 
std::vector< uint64_t >::reverse_iterator rend () noexcept
 Reverse end iterator to bits.
 
std::vector< uint64_t >::const_iterator cbegin () const noexcept
 Constant begin iterator to bits.
 
std::vector< uint64_t >::const_iterator cend () const noexcept
 Constant end iterator to bits.
 
std::vector< uint64_t >::const_reverse_iterator crbegin () const noexcept
 Constant reverse begin iterator to bits.
 
std::vector< uint64_t >::const_reverse_iterator crend () const noexcept
 Constant teverse end iterator to bits.
 
template<class TT>
dynamic_truth_tableoperator= (const TT &other)
 Assign other truth table.
 
void mask_bits () noexcept
 

Detailed Description

Truth table in which number of variables is known at runtime.

Definition at line 18 of file kitty_dynamic_tt.hpp.

Constructor & Destructor Documentation

◆ dynamic_truth_table() [1/2]

kitty::dynamic_truth_table::dynamic_truth_table ( uint32_t num_vars)
inlineexplicit

Standard constructor.

The number of variables provided to the truth table can be computed at runtime. However, once the truth table is constructed its number of variables cannot change anymore.

The constructor computes the number of blocks and resizes the vector accordingly.

Parameters
num_varsNumber of variables

Definition at line 31 of file kitty_dynamic_tt.hpp.

32 : _bits( ( num_vars <= 6 ) ? 1u : ( 1u << ( num_vars - 6 ) ) ),
33 _num_vars( num_vars )
34 {
35 }
uint32_t num_vars() const noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dynamic_truth_table() [2/2]

kitty::dynamic_truth_table::dynamic_truth_table ( )
inline

Empty constructor.

Creates an empty truth table. It has 0 variables, but no bits, i.e., it is different from a truth table for the constant function. This constructor is only used for convenience, if algorithms require the existence of default constructable classes.

Definition at line 44 of file kitty_dynamic_tt.hpp.

44: _num_vars( 0 ) {}
Here is the caller graph for this function:

Member Function Documentation

◆ begin() [1/2]

std::vector< uint64_t >::const_iterator kitty::dynamic_truth_table::begin ( ) const
inlinenoexcept

Begin iterator to bits.

Definition at line 74 of file kitty_dynamic_tt.hpp.

74{ return _bits.begin(); }

◆ begin() [2/2]

std::vector< uint64_t >::iterator kitty::dynamic_truth_table::begin ( )
inlinenoexcept

Begin iterator to bits.

Definition at line 66 of file kitty_dynamic_tt.hpp.

66{ return _bits.begin(); }
Here is the caller graph for this function:

◆ cbegin()

std::vector< uint64_t >::const_iterator kitty::dynamic_truth_table::cbegin ( ) const
inlinenoexcept

Constant begin iterator to bits.

Definition at line 90 of file kitty_dynamic_tt.hpp.

90{ return _bits.cbegin(); }

◆ cend()

std::vector< uint64_t >::const_iterator kitty::dynamic_truth_table::cend ( ) const
inlinenoexcept

Constant end iterator to bits.

Definition at line 94 of file kitty_dynamic_tt.hpp.

94{ return _bits.cend(); }

◆ construct()

dynamic_truth_table kitty::dynamic_truth_table::construct ( ) const
inline

Constructs a new dynamic truth table instance with the same number of variables.

Definition at line 47 of file kitty_dynamic_tt.hpp.

48 {
49 return dynamic_truth_table( _num_vars );
50 }
Here is the call graph for this function:

◆ crbegin()

std::vector< uint64_t >::const_reverse_iterator kitty::dynamic_truth_table::crbegin ( ) const
inlinenoexcept

Constant reverse begin iterator to bits.

Definition at line 98 of file kitty_dynamic_tt.hpp.

98{ return _bits.crbegin(); }

◆ crend()

std::vector< uint64_t >::const_reverse_iterator kitty::dynamic_truth_table::crend ( ) const
inlinenoexcept

Constant teverse end iterator to bits.

Definition at line 102 of file kitty_dynamic_tt.hpp.

102{ return _bits.crend(); }

◆ end() [1/2]

std::vector< uint64_t >::const_iterator kitty::dynamic_truth_table::end ( ) const
inlinenoexcept

End iterator to bits.

Definition at line 78 of file kitty_dynamic_tt.hpp.

78{ return _bits.end(); }

◆ end() [2/2]

std::vector< uint64_t >::iterator kitty::dynamic_truth_table::end ( )
inlinenoexcept

End iterator to bits.

Definition at line 70 of file kitty_dynamic_tt.hpp.

70{ return _bits.end(); }

◆ mask_bits()

void kitty::dynamic_truth_table::mask_bits ( )
inlinenoexcept

Masks the number of valid truth table bits.

If the truth table has less than 6 variables, it may not use all the bits. This operation makes sure to zero out all non-valid bits.

Definition at line 132 of file kitty_dynamic_tt.hpp.

133 {
134 if ( _num_vars < 6 )
135 {
136 _bits[0u] &= detail::masks[_num_vars];
137 }
138 }
Here is the caller graph for this function:

◆ num_bits()

uint32_t kitty::dynamic_truth_table::num_bits ( ) const
inlinenoexcept

Returns number of bits.

Definition at line 62 of file kitty_dynamic_tt.hpp.

62{ return uint64_t( 1 ) << _num_vars; }

◆ num_blocks()

uint32_t kitty::dynamic_truth_table::num_blocks ( ) const
inlinenoexcept

Returns number of blocks.

Definition at line 58 of file kitty_dynamic_tt.hpp.

58{ return _bits.size(); }

◆ num_vars()

uint32_t kitty::dynamic_truth_table::num_vars ( ) const
inlinenoexcept

Returns number of variables.

Definition at line 54 of file kitty_dynamic_tt.hpp.

54{ return _num_vars; }
Here is the caller graph for this function:

◆ operator=()

template<class TT>
dynamic_truth_table & kitty::dynamic_truth_table::operator= ( const TT & other)
inline

Assign other truth table.

This replaces the current truth table with another truth table. The truth table type has to be complete. The vector of bits is resized accordingly.

Parameters
otherOther truth table

Definition at line 112 of file kitty_dynamic_tt.hpp.

113 {
114 _bits.resize( other.num_blocks() );
115 std::copy( other.begin(), other.end(), begin() );
116 _num_vars = other.num_vars();
117
118 if ( _num_vars < 6 )
119 {
120 mask_bits();
121 }
122
123 return *this;
124 }
std::vector< uint64_t >::iterator begin() noexcept
Begin iterator to bits.
Here is the call graph for this function:

◆ rbegin()

std::vector< uint64_t >::reverse_iterator kitty::dynamic_truth_table::rbegin ( )
inlinenoexcept

Reverse begin iterator to bits.

Definition at line 82 of file kitty_dynamic_tt.hpp.

82{ return _bits.rbegin(); }

◆ rend()

std::vector< uint64_t >::reverse_iterator kitty::dynamic_truth_table::rend ( )
inlinenoexcept

Reverse end iterator to bits.

Definition at line 86 of file kitty_dynamic_tt.hpp.

86{ return _bits.rend(); }

The documentation for this struct was generated from the following file: