ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
kitty_operators.hpp
Go to the documentation of this file.
1#ifndef _KITTY_OPERATORS_TT_H_
2#define _KITTY_OPERATORS_TT_H_
3#pragma once
4
5#include <algorithm>
6#include <cassert>
7#include <functional>
8#include <iterator>
9
10#include "kitty_constants.hpp"
11#include "kitty_dynamic_tt.hpp"
12#include "kitty_static_tt.hpp"
13#include "kitty_operations.hpp"
14
16
17namespace kitty
18{
19
22{
23 return unary_not( tt );
24}
25
27template<uint32_t NumVars>
32
35{
36 return binary_and( first, second );
37}
38
40template<uint32_t NumVars>
42{
43 return binary_and( first, second );
44}
45
47inline void operator&=( dynamic_truth_table& first, const dynamic_truth_table& second )
48{
49 first = binary_and( first, second );
50}
51
53template<uint32_t NumVars>
55{
56 first = binary_and( first, second );
57}
58
61{
62 return binary_or( first, second );
63}
64
66template<uint32_t NumVars>
68{
69 return binary_or( first, second );
70}
71
73inline void operator|=( dynamic_truth_table& first, const dynamic_truth_table& second )
74{
75 first = binary_or( first, second );
76}
77
79template<uint32_t NumVars>
81{
82 // first = binary_or( first, second );
83 /* runtime improved version */
84 first._bits |= second._bits;
85 first.mask_bits();
86}
87
89template<uint32_t NumVars>
91{
92 // first = binary_or( first, second );
93 /* runtime improved version */
94 if ( NumVars == 7 )
95 {
96 first._bits[0] |= second._bits[0];
97 first._bits[1] |= second._bits[1];
98 }
99 else if ( NumVars == 8 )
100 {
101 first._bits[0] |= second._bits[0];
102 first._bits[1] |= second._bits[1];
103 first._bits[2] |= second._bits[2];
104 first._bits[3] |= second._bits[3];
105 }
106 else if ( NumVars == 9 )
107 {
108 first._bits[0] |= second._bits[0];
109 first._bits[1] |= second._bits[1];
110 first._bits[2] |= second._bits[2];
111 first._bits[3] |= second._bits[3];
112 first._bits[4] |= second._bits[4];
113 first._bits[5] |= second._bits[5];
114 first._bits[6] |= second._bits[6];
115 first._bits[7] |= second._bits[7];
116 }
117 else
118 {
119 for ( uint32_t i = 0; i < first.num_blocks(); ++i )
120 {
121 first._bits[i] |= second._bits[i];
122 }
123 }
124}
125
126} // namespace kitty
127
129
130#endif // _KITTY_OPERATORS_TT_H_
unsigned int uint32_t
Definition Fxch.h:32
#define ABC_NAMESPACE_CXX_HEADER_START
#define ABC_NAMESPACE_CXX_HEADER_END
TT binary_or(const TT &first, const TT &second)
Bitwise OR of two truth tables.
dynamic_truth_table operator~(const dynamic_truth_table &tt)
Operator for unary_not.
void operator|=(dynamic_truth_table &first, const dynamic_truth_table &second)
Operator for binary_or and assign.
TT binary_and(const TT &first, const TT &second)
Bitwise AND of two truth tables.
dynamic_truth_table operator&(const dynamic_truth_table &first, const dynamic_truth_table &second)
Operator for binary_and.
TT unary_not(const TT &tt)
Inverts all bits in a truth table.
dynamic_truth_table operator|(const dynamic_truth_table &first, const dynamic_truth_table &second)
Operator for binary_or.
void operator&=(dynamic_truth_table &first, const dynamic_truth_table &second)
Operator for binary_and and assign.