ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
acd::ac_decomposition_impl Class Reference

#include <ac_decomposition.hpp>

Public Member Functions

 ac_decomposition_impl (uint32_t num_vars, ac_decomposition_params const &ps, ac_decomposition_stats *pst=nullptr)
 
int run (word *ptt, unsigned delay_profile)
 Runs ACD using late arriving variables.
 
int compute_decomposition ()
 
unsigned get_profile ()
 
void get_decomposition (unsigned char *decompArray)
 

Detailed Description

Definition at line 86 of file ac_decomposition.hpp.

Constructor & Destructor Documentation

◆ ac_decomposition_impl()

acd::ac_decomposition_impl::ac_decomposition_impl ( uint32_t num_vars,
ac_decomposition_params const & ps,
ac_decomposition_stats * pst = nullptr )
inlineexplicit

Definition at line 102 of file ac_decomposition.hpp.

103 : num_vars( num_vars ), ps( ps ), pst( pst )
104 {
105 std::iota( permutations.begin(), permutations.end(), 0 );
106 }

Member Function Documentation

◆ compute_decomposition()

int acd::ac_decomposition_impl::compute_decomposition ( )
inline

Definition at line 152 of file ac_decomposition.hpp.

153 {
154 if ( best_multiplicity == UINT32_MAX )
155 return -1;
156
157 /* compute isets */
158 std::vector<STT> isets = compute_isets();
159
160 generate_support_minimization_encodings();
161
162 /* solves exactly only for small multiplicities */
163 if ( best_multiplicity <= 4u )
164 solve_min_support_exact( isets );
165 else
166 solve_min_support_heuristic( isets );
167
168 /* unfeasible decomposition */
169 assert( !best_bound_sets.empty() );
170
171 return 0;
172 }
#define UINT32_MAX
Definition pstdint.h:388
#define assert(ex)
Definition util_old.h:213

◆ get_decomposition()

void acd::ac_decomposition_impl::get_decomposition ( unsigned char * decompArray)
inline

Definition at line 189 of file ac_decomposition.hpp.

190 {
191 if ( best_free_set > num_vars )
192 return;
193
194 generate_decomposition();
195 get_decomposition_abc( decompArray );
196 }

◆ get_profile()

unsigned acd::ac_decomposition_impl::get_profile ( )
inline

Definition at line 174 of file ac_decomposition.hpp.

175 {
176 unsigned profile = 0;
177
178 if ( best_free_set > num_vars )
179 return -1;
180
181 for ( uint32_t i = 0; i < best_free_set; ++i )
182 {
183 profile |= 1 << permutations[i];
184 }
185
186 return profile;
187 }
unsigned int uint32_t
Definition Fxch.h:32

◆ run()

int acd::ac_decomposition_impl::run ( word * ptt,
unsigned delay_profile )
inline

Runs ACD using late arriving variables.

Definition at line 109 of file ac_decomposition.hpp.

110 {
111 /* truth table is too large for the settings */
112 if ( num_vars > max_num_vars )
113 {
114 return -1;
115 }
116
117 uint32_t late_arriving = __builtin_popcount( delay_profile );
118
119 /* relax maximum number of free set variables if a function has more variables */
120 if ( num_vars > ps.max_free_set_vars + ps.lut_size )
121 {
122 ps.max_free_set_vars = num_vars - ps.lut_size;
123 }
124 if ( late_arriving > ps.max_free_set_vars )
125 {
126 return -1; /* on average avoiding this computation leads to better quality */
127 // ps.max_free_set_vars = late_arriving;
128 }
129
130 /* return a high cost if too many late arriving variables */
131 if ( late_arriving > ps.lut_size - 1 )
132 {
133 return -1;
134 }
135
136 /* convert to static TT */
137 init_truth_table( ptt );
138
139 /* permute late arriving variables to be the least significant */
140 reposition_late_arriving_variables( delay_profile, late_arriving );
141
142 /* run ACD trying different bound sets and free sets */
143 if ( !find_decomposition( delay_profile, late_arriving ) )
144 {
145 return -1;
146 }
147
148 /* return number of levels */
149 return delay_profile == 0 ? 2 : 1;
150 }

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