aigverse.generators¶
Provides generators for random and structured benchmark construction.
Module Contents¶
- random_aig(*, num_pis: int, num_gates: int, seed: int = 3405688830) Aig¶
Generates a single random AIG with a fixed size.
- Parameters:
num_pis – Number of primary inputs.
num_gates – Number of logic gates.
seed – Seed controlling random choices.
- Returns:
A randomly generated AIG.
- Raises:
ValueError – If
num_pisornum_gatesis0.TypeError – If
num_pisornum_gatescannot be converted touint32.
- ripple_carry_adder(bitwidth: int) Aig¶
Creates a complete ripple-carry adder benchmark network.
- Parameters:
bitwidth – Number of bits per operand.
- Returns:
An
Aigwith2 * bitwidthprimary inputs andbitwidth + 1primary outputs (sum plus carry-out).- Raises:
ValueError – If
bitwidthis not greater than0.
- carry_lookahead_adder(bitwidth: int) Aig¶
Creates a complete carry-lookahead adder benchmark network.
- Parameters:
bitwidth – Number of bits per operand.
- Returns:
An
Aigwith2 * bitwidthprimary inputs andbitwidth + 1primary outputs (sum plus carry-out).- Raises:
ValueError – If
bitwidthis not greater than0.
- ripple_carry_multiplier(bitwidth: int) Aig¶
Creates a complete ripple-carry multiplier benchmark network.
- Parameters:
bitwidth – Number of bits per operand.
- Returns:
An
Aigwith2 * bitwidthprimary inputs and2 * bitwidthprimary outputs representing the product bits.- Raises:
ValueError – If
bitwidthis not greater than0.
- sideways_sum_adder(bitwidth: int) Aig¶
Creates a complete sideways sum adder benchmark network.
- Parameters:
bitwidth – Number of input bits.
- Returns:
An
Aigwithbitwidthprimary inputs and output bits encoding the population count of the input word.- Raises:
ValueError – If
bitwidthis not greater than0.
- multiplexer(bitwidth: int) Aig¶
Creates a complete word-level n-bit 2:1 MUX network.
- Parameters:
bitwidth – Number of bits in each data input word.
- Returns:
An
Aigwith1 + 2 * bitwidthprimary inputs andbitwidthprimary outputs.- Raises:
ValueError – If
bitwidthis not greater than0.
- binary_decoder(num_select_bits: int) Aig¶
Creates a complete binary-decoder network.
- Parameters:
num_select_bits – Number of select input bits.
- Returns:
An
Aigwithnum_select_bitsprimary inputs and2 ** num_select_bitsprimary outputs.- Raises:
ValueError – If
num_select_bitsis not greater than0.