# visualize.sh -- AIGER Visualization Wrapper

## Purpose

Convenience wrapper that renders an AIGER circuit as SVG/PNG using either
`aigtodot` + Graphviz or Yosys. Handles tool detection and output directory
creation.

## Usage

```bash
bash scripts/visualize.sh <circuit.aag> [output_dir] [dot|yosys]
```

- `circuit.aag`: the AIGER file to visualize
- `output_dir`: where to write images (default: `diagrams/`)
- Method: `dot` (default) or `yosys`

## Methods

### `dot` (default)

Requires `aigtodot` (from the [AIGER tools](https://github.com/arminbiere/aiger))
and `graphviz`. Produces a gate-level schematic.

Note: if `aigtodot` is not installed, use `aag2dot.py` instead:

```bash
python3 scripts/aag2dot.py circuits/SPEC.aag | dot -Tpng -o diagrams/SPEC.png
```

### `yosys`

Requires [Yosys](https://github.com/YosysHQ/yosys) and `graphviz`. Produces
a higher-level schematic with recognized logic patterns (muxes, registers, etc.)
drawn as compound symbols rather than individual gates.

## Future Improvements

- **Auto-detect available tools**: Fall back gracefully between aigtodot,
  aag2dot.py, and yosys depending on what's installed.
- **State machine mode**: Add an option to invoke `trace_aiger.py` and render
  the behavioral state machine instead of the gate-level view.
