Files
circuiteria/README.md
T

88 lines
2.5 KiB
Markdown

# circuiteria
Circuiteria is a [Typst](https://typst.app) package for drawing block circuit diagrams using the [CeTZ](https://typst.app/universe/package/cetz) package.
<p align="center">
<img src="./gallery/platypus.png" alt="A platypus / Perry the Platypus meme made with colored rounded rectangles">
</p>
## Examples
<table>
<tr>
<td colspan="2">
<a href="./gallery/test.typ">
<img src="./gallery/test.png" width="500px" alt="Block diagram of a multi-cycle RISC-V FPGA processor">
</a>
</td>
</tr>
<tr>
<td colspan="2">A bit of everything</td>
</tr>
<tr>
<td colspan="2">
<a href="./gallery/test5.typ">
<img src="./gallery/test5.png" width="500px" alt="Block diagram of a single-cycle RISC-V processor">
</a>
</td>
</tr>
<tr>
<td colspan="2">Wires everywhere</td>
</tr>
<tr>
<td>
<a href="./gallery/test4.typ">
<img src="./gallery/test4.png" width="250px" alt="Top-level block diagram of a single-cycle RISC-V processor">
</a>
</td>
<td>
<a href="./gallery/test6.typ">
<img src="./gallery/test6.png" width="250px" alt="Block diagram of a simple single-cycle RISC-V ALU">
</a>
</td>
</tr>
<tr>
<td>Groups</td>
<td>Rotated</td>
</tr>
<tr>
<td colspan="2">
<a href="./gallery/verilog.typ">
<img src="./gallery/verilog.png" width="500px" alt="Block automatically generated from a Verilog module">
</a>
</td>
</tr>
<tr>
<td colspan="2">Generated from a Verilog module</td>
</tr>
</table>
> **Note**\
> These circuit layouts were copied from a digital design course given by prof. S. Zahno and recreated using this package
*Click on the example image to jump to the code.*
## Usage
For more information, see the [manual](manual.pdf)
To use this package, simply import [circuiteria](https://typst.app/universe/package/circuiteria) and call the `circuit` function:
```typ
#import "@preview/circuiteria:0.2.1"
#circuiteria.circuit({
import circuiteria: *
...
})
```
### Verilog modules
Blocks can be generated automatically from Verilog/SystemVerilog sources.
AXI4, AXI4-Lite, AXI4-Stream and Vivado BRAM interface signals are grouped
into single bus ports, and clock/reset signals are detected and placed
together:
```typ
#circuiteria.circuit({
import circuiteria: *
verilog.block(read("my_module.v"), x: 0, y: 0)
})
```
The port ids are the signal names, or the bus prefixes for inferred buses
(e.g. `"my_module-port-s_axi"`).