forked from HEL/circuiteria
31 lines
1.0 KiB
Typst
31 lines
1.0 KiB
Typst
// Demonstrates the `(from: <anchor>, to: <port-id>)` port-alignment shorthand
|
|
// for the `x` parameter (analogous to the existing shorthand for `y`).
|
|
#import "/src/lib.typ": circuit, element, util, wire
|
|
|
|
#set page(width: auto, height: auto, margin: .5cm)
|
|
|
|
#circuit({
|
|
// Anchor block: absolute placement, with a single "addr" port on its
|
|
// north side (auto-centred horizontally by circuiteria).
|
|
element.block(
|
|
x: 0, y: 0, w: 2, h: 1.5,
|
|
id: "vcemem",
|
|
fill: util.colors.orange,
|
|
ports: (north: ((id: "addr"),), east: ((id: "out"),))
|
|
)
|
|
|
|
// This block's "addr" port (south side) is x-aligned with vcemem's "addr"
|
|
// port (north side), even though B is wider than vcemem and not
|
|
// horizontally aligned by default.
|
|
element.block(
|
|
x: (from: "vcemem-port-addr", to: "addr"),
|
|
y: (rel: 2, to: "vcemem.north"),
|
|
w: 4.5, h: 1,
|
|
id: "fsm",
|
|
fill: util.colors.yellow,
|
|
ports: (south: ((id: "addr"),), east: ((id: "out"),))
|
|
)
|
|
|
|
wire.wire("wAddr", ("vcemem-port-addr", "fsm-port-addr"), style: "zigzag")
|
|
})
|