# aigverse.generators

Provides generators for random and structured benchmark construction.

## Module Contents

### random_aig(, num_pis: [int](https://docs.python.org/3/builtins/functions.html#int), num_gates: [int](https://docs.python.org/3/builtins/functions.html#int), seed: [int](https://docs.python.org/3/builtins/functions.html#int) = 3405688830) → [Aig](../networks/index.html.md#aigverse.networks.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**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If `num_pis` or `num_gates` is `0`.
  * [**TypeError**](https://docs.python.org/3/builtins/exceptions.html#TypeError) – If `num_pis` or `num_gates` cannot be converted to `uint32`.

### ripple_carry_adder(bitwidth: [int](https://docs.python.org/3/builtins/functions.html#int)) → [Aig](../networks/index.html.md#aigverse.networks.Aig)

Creates a complete ripple-carry adder benchmark network.

* **Parameters:**
  **bitwidth** – Number of bits per operand.
* **Returns:**
  An `Aig` with `2 * bitwidth` primary inputs and
  `bitwidth + 1` primary outputs (sum plus carry-out).
* **Raises:**
  [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If `bitwidth` is not greater than `0`.

### carry_lookahead_adder(bitwidth: [int](https://docs.python.org/3/builtins/functions.html#int)) → [Aig](../networks/index.html.md#aigverse.networks.Aig)

Creates a complete carry-lookahead adder benchmark network.

* **Parameters:**
  **bitwidth** – Number of bits per operand.
* **Returns:**
  An `Aig` with `2 * bitwidth` primary inputs and
  `bitwidth + 1` primary outputs (sum plus carry-out).
* **Raises:**
  [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If `bitwidth` is not greater than `0`.

### ripple_carry_multiplier(bitwidth: [int](https://docs.python.org/3/builtins/functions.html#int)) → [Aig](../networks/index.html.md#aigverse.networks.Aig)

Creates a complete ripple-carry multiplier benchmark network.

* **Parameters:**
  **bitwidth** – Number of bits per operand.
* **Returns:**
  An `Aig` with `2 * bitwidth` primary inputs and
  `2 * bitwidth` primary outputs representing the product bits.
* **Raises:**
  [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If `bitwidth` is not greater than `0`.

### sideways_sum_adder(bitwidth: [int](https://docs.python.org/3/builtins/functions.html#int)) → [Aig](../networks/index.html.md#aigverse.networks.Aig)

Creates a complete sideways sum adder benchmark network.

* **Parameters:**
  **bitwidth** – Number of input bits.
* **Returns:**
  An `Aig` with `bitwidth` primary inputs and output bits encoding
  the population count of the input word.
* **Raises:**
  [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If `bitwidth` is not greater than `0`.

### multiplexer(bitwidth: [int](https://docs.python.org/3/builtins/functions.html#int)) → [Aig](../networks/index.html.md#aigverse.networks.Aig)

Creates a complete word-level n-bit 2:1 MUX network.

* **Parameters:**
  **bitwidth** – Number of bits in each data input word.
* **Returns:**
  An `Aig` with `1 + 2 * bitwidth` primary inputs and `bitwidth`
  primary outputs.
* **Raises:**
  [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If `bitwidth` is not greater than `0`.

### binary_decoder(num_select_bits: [int](https://docs.python.org/3/builtins/functions.html#int)) → [Aig](../networks/index.html.md#aigverse.networks.Aig)

Creates a complete binary-decoder network.

* **Parameters:**
  **num_select_bits** – Number of select input bits.
* **Returns:**
  An `Aig` with `num_select_bits` primary inputs and
  `2 ** num_select_bits` primary outputs.
* **Raises:**
  [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If `num_select_bits` is not greater than `0`.
