Compare commits

..

No commits in common. "d6248865b37566eb4583b8492e4c5b67c324a270" and "ff9ad9e94a65f52aed4dec0c34bc9ee3821155b8" have entirely different histories.

18 changed files with 34 additions and 76 deletions

View File

@ -1,40 +0,0 @@
#!/bin/bash
PDFS=false
while getopts "p" flag
do
case "${flag}" in
p) PDFS=true;;
esac
done
echo "Generating gallery images"
set -- ./gallery/*.typ
cnt="$#"
i=1
for f
do
f2="${f/typ/png}"
echo "($i/$cnt) $f -> $f2"
typst c --root ./ "$f" "$f2"
i=$((i+1))
done
if [ "$PDFS" = true ]
then
echo
echo "Generating gallery PDFs"
set -- ./gallery/*.typ
cnt="$#"
i=1
for f
do
f2="${f/typ/pdf}"
echo "($i/$cnt) $f -> $f2"
typst c --root ./ "$f" "$f2"
i=$((i+1))
done
fi

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

View File

@ -1,6 +1,6 @@
#import "../src/lib.typ": circuit, element, util, wire #import "../src/lib.typ": circuit, element, util, wire
#set page(width: auto, height: auto, margin: .5cm) #set page(flipped: true)
#circuit({ #circuit({
element.block( element.block(

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

View File

@ -1,6 +1,6 @@
#import "../src/lib.typ": circuit, element, util, wire #import "../src/lib.typ": circuit, element, util, wire
#set page(width: auto, height: auto, margin: .5cm) #set page(flipped: true)
#circuit({ #circuit({
element.block( element.block(

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

View File

@ -1,7 +1,8 @@
#import "@preview/cetz:0.2.2": draw #import "@preview/cetz:0.2.2": draw
#import "../src/lib.typ": circuit, element, util, wire #import "../src/lib.typ": circuit, element, util, wire
#set page(width: auto, height: auto, margin: .5cm) #set page(flipped: true)
#let debug = false
#circuit({ #circuit({
element.block( element.block(
@ -13,14 +14,18 @@
(id: "out1"), (id: "out1"),
(id: "out2"), (id: "out2"),
) )
),
debug: (
ports: debug
) )
) )
element.gate-and( element.gate-and(
x: 4, y: 0, w: 2, h: 2, id: "and1", x: 4, y: 0, w: 2, h: 2, id: "and1", debug: (ports: debug),
inverted: ("in1") inverted: ("in1")
) )
element.gate-or( element.gate-or(
x: 7, y: 0, w: 2, h: 2, id: "or1", x: 7, y: 0, w: 2, h: 2, id: "or1", debug: (ports: debug),
inverted: ("in0", "out") inverted: ("in0", "out")
) )
@ -42,7 +47,7 @@
) )
element.gate-and( element.gate-and(
x: 11, y: 0, w: 2, h: 2, id: "and2", inputs: 3, x: 11, y: 0, w: 2, h: 2, id: "and2", inputs: 3, debug: (ports: debug),
inverted: ("in0", "in2") inverted: ("in0", "in2")
) )
for i in range(3) { for i in range(3) {
@ -50,35 +55,35 @@
} }
element.gate-xor( element.gate-xor(
x: 14, y: 0, w: 2, h: 2, id: "xor", x: 14, y: 0, w: 2, h: 2, id: "xor", debug: (ports: debug),
inverted: ("in1") inverted: ("in1")
) )
element.gate-buf( element.gate-buf(
x: 0, y: -3, w: 2, h: 2, id: "buf" x: 0, y: -3, w: 2, h: 2, id: "buf", debug: (ports: debug)
) )
element.gate-not( element.gate-not(
x: 0, y: -6, w: 2, h: 2, id: "not" x: 0, y: -6, w: 2, h: 2, id: "not", debug: (ports: debug)
) )
element.gate-and( element.gate-and(
x: 3, y: -3, w: 2, h: 2, id: "and" x: 3, y: -3, w: 2, h: 2, id: "and", debug: (ports: debug)
) )
element.gate-nand( element.gate-nand(
x: 3, y: -6, w: 2, h: 2, id: "nand" x: 3, y: -6, w: 2, h: 2, id: "nand", debug: (ports: debug)
) )
element.gate-or( element.gate-or(
x: 6, y: -3, w: 2, h: 2, id: "or" x: 6, y: -3, w: 2, h: 2, id: "or", debug: (ports: debug)
) )
element.gate-nor( element.gate-nor(
x: 6, y: -6, w: 2, h: 2, id: "nor" x: 6, y: -6, w: 2, h: 2, id: "nor", debug: (ports: debug)
) )
element.gate-xor( element.gate-xor(
x: 9, y: -3, w: 2, h: 2, id: "xor" x: 9, y: -3, w: 2, h: 2, id: "xor", debug: (ports: debug)
) )
element.gate-xnor( element.gate-xnor(
x: 9, y: -6, w: 2, h: 2, id: "xnor" x: 9, y: -6, w: 2, h: 2, id: "xnor", debug: (ports: debug)
) )
}) })

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

View File

@ -1,7 +1,7 @@
#import "@preview/cetz:0.2.2": draw #import "@preview/cetz:0.2.2": draw
#import "../src/lib.typ": * #import "../src/lib.typ": *
#set page(width: auto, height: auto, margin: .5cm) #set page(flipped: true)
#circuit({ #circuit({
element.group(id: "toplvl", name: "Toplevel", { element.group(id: "toplvl", name: "Toplevel", {
@ -200,22 +200,18 @@
draw.content("dmem.south-west", [*External Memories*], anchor: "north", padding: 10pt) draw.content("dmem.south-west", [*External Memories*], anchor: "north", padding: 10pt)
}) })
draw.line(name: "w-dp-clk", wire.wire(
"dp-port-clk", "w-dp-clk",
(rel: (0, .5), to: ()), ("dp-port-clk", (-1, 4.2)),
( style: "zigzag",
rel: (-.5, 0), zigzag-dir: "horizontal",
to: (horizontal: "toplvl.west", vertical: ()) zigzag-ratio: 100%
)
) )
draw.content("w-dp-clk.end", "clk", anchor: "east", padding: 3pt) draw.content("w-dp-clk.end", "clk", anchor: "east", padding: 3pt)
draw.line(name: "w-dp-rst", wire.wire(
"dp-port-rst", "w-dp-rst",
( ("dp-port-rst", (horizontal: (-1, 0), vertical: ()))
rel: (-.5, 0),
to: (horizontal: "toplvl.west", vertical: ())
)
) )
draw.content("w-dp-rst.end", "rst", anchor: "east", padding: 3pt) draw.content("w-dp-rst.end", "rst", anchor: "east", padding: 3pt)
}) })

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 KiB

View File

@ -1,7 +1,7 @@
#import "@preview/cetz:0.2.2": draw #import "@preview/cetz:0.2.2": draw
#import "../src/lib.typ": * #import "../src/lib.typ": *
#set page(width: auto, height: auto, margin: .5cm) #set page(flipped: true, paper: "a3")
#circuit({ #circuit({
element.multiplexer( element.multiplexer(

Binary file not shown.

View File

@ -192,18 +192,15 @@
let second-pos = points.at(1) let second-pos = points.at(1)
if reverse { if reverse {
(first-pt, last-pt) = (last-pt, first-pt) (first-pt, last-pt) = (last-pt, first-pt)
(first-pos, second-pos) = (second-pos, first-pos)
} }
let angle = 0deg let angle = 0deg
if rotate-name { if rotate-name {
(ctx, first-pos) = coordinate.resolve(ctx, first-pos) (ctx, first-pos) = coordinate.resolve(ctx, first-pos)
(ctx, second-pos) = coordinate.resolve(ctx, second-pos) (ctx, second-pos) = coordinate.resolve(ctx, second-pos)
let (x1, y1, _) = first-pos
if reverse { let (x2, y2, _) = second-pos
(first-pos, second-pos) = (second-pos, first-pos)
}
let (x1, y1, ..) = first-pos
let (x2, y2, ..) = second-pos
angle = calc.atan2(x2 - x1, y2 - y1) angle = calc.atan2(x2 - x1, y2 - y1)
} }