purpl3F0xandClaude Opus 5.5 6b861553b7 Pack and center Verilog block ports with automatic spacing
- Add `ports-align` ("center" by default, "top", "bottom", or "spread" for
  the previous evenly spread layout) and `ports-pitch` to `verilog.block`.
- Packed layouts use minimal margins, only reserving room for the module
  name and north/south ports, and size the block to the busiest side.
- The automatic height now also adapts to custom `ports-margins`.
- Regenerate the gallery image and the manual.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Stavros Avramidis <stavros9899@gmail.com>
2026-11-03 13:31:07 +02:00
2026-06-30 18:48:34 +02:00
2024-05-16 21:34:50 +00:00

circuiteria

Circuiteria is a Typst package for drawing block circuit diagrams using the CeTZ package.

A platypus / Perry the Platypus meme made with colored rounded rectangles

Examples

Block diagram of a multi-cycle RISC-V FPGA processor
A bit of everything
Block diagram of a single-cycle RISC-V processor
Wires everywhere
Top-level block diagram of a single-cycle RISC-V processor Block diagram of a simple single-cycle RISC-V ALU
Groups Rotated
Block automatically generated from a Verilog module
Generated from a Verilog module

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

To use this package, simply import circuiteria and call the circuit function:

#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, APB and BRAM signals (Vivado BRAM interface, or <prefix>_addr/_dout/_wr_en/_wr_addr/_wr_data/_rd_addr/_rd_data RAM ports) are grouped into single bus ports, and clock/reset signals are detected and placed together:

#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"). Unprefixed buses (e.g. bare PADDR, PSEL, ...) are named after their kind ("my_module-port-apb").

S
Description
Drawing block circuits with Typst made easy, using CeTZ
Readme Apache-2.0
5.5 MiB
0 Stars 1 Watchers 0 Forks
Languages
Typst 97.2%
Verilog 2.6%
Just 0.2%