Simulation pattern generation
Header: mockturtle/algorithms/pattern_generation.hpp
The following example shows how to generate expressive simulation patterns for an AIG network. It starts with 256 random patterns, generates stuck-at patterns to make every node’s signature has at least 3 bits of 0 and 3 bits of 1 which are observable at at least 5 levels of fan-out. The generated patterns are then written out to a file.
/* derive some AIG */
aig_network aig = ...;
pattern_generation_params ps;
ps.num_stuck_at = 3;
ps.odc_levels = 5;
partial_simulator sim( aig.num_pis(), 256 );
pattern_generation( aig, sim, ps );
write_patterns( sim, "patterns.pat" );
Parameters and statistics
-
struct pattern_generation_params
Public Members
-
uint32_t num_stuck_at = {1}
Number of patterns each node should have for both values.
When this parameter is set to greater than 1, and if the network has more than 2048 PIs, the
BUFFER_SIZE
inlib/bill/sat/interface/abc_bsat2.hpp
has to be increased to at leastntk.num_pis()
.
-
int32_t odc_levels = {0}
Whether to consider observability, and how many levels. 0 = no. -1 = Consider TFO until PO.
-
bool progress = {false}
Show progress.
-
bool verbose = {false}
Be verbose. Note that it will take more time to do extra ODC computation if this is turned on.
-
std::default_random_engine::result_type random_seed = {1}
Random seed.
-
uint32_t conflict_limit = {1000}
Conflict limit of the SAT solver.
-
uint32_t max_clauses = {1000}
Maximum number of clauses of the SAT solver. (incremental CNF construction)
-
uint32_t num_stuck_at = {1}
-
struct pattern_generation_stats
Public Members
-
uint32_t num_constant = {0}
Number of constant nodes.
-
uint32_t num_generated_patterns = {0}
Number of generated patterns.
-
uint32_t unobservable_type1 = {0}
Number of stuck-at patterns that is re-generated because the original one was unobservable.
-
uint32_t unobservable_type2 = {0}
Number of additional patterns generated because the node was unobservable with one value.
-
uint32_t unobservable_node = {0}
Number of unobservable nodes (node for which an observable pattern can not be found).
-
uint32_t num_constant = {0}
Algorithm
-
template<bool substitute_const = false, class Ntk, class Simulator>
void mockturtle::pattern_generation(Ntk &ntk, Simulator &sim, pattern_generation_params const &ps = {}, pattern_generation_stats *pst = nullptr) Expressive simulation pattern generation.
This function implements two simulation pattern generation methods: stuck-at value checking and observability checking. Please refer to [1] for details of the algorithm and its purpose.
[1] Simulation-Guided Boolean Resubstitution. IWLS 2020 (arXiv:2007.02579).
- Parameters:
sim – Reference of a
partial_simulator
orbit_packed_simulator
object where the generated patterns will be stored. It can be empty (Simulator( ntk.num_pis(), 0 )
) or already containing some patterns generated from previous runs (Simulator( filename )
) or randomly generated (Simulator( ntk.num_pis(), num_random_patterns )
). The generated patterns can then be written out withwrite_patterns
or directly be used by passing the simulator to another algorithm.