diff --git a/gallery.bash b/gallery.bash new file mode 100644 index 0000000..f87679c --- /dev/null +++ b/gallery.bash @@ -0,0 +1,40 @@ +#!/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 \ No newline at end of file diff --git a/gallery/test.pdf b/gallery/test.pdf index 18778e4..f7f1fc5 100644 Binary files a/gallery/test.pdf and b/gallery/test.pdf differ diff --git a/gallery/test.png b/gallery/test.png new file mode 100644 index 0000000..e090778 Binary files /dev/null and b/gallery/test.png differ diff --git a/gallery/test.typ b/gallery/test.typ index d1475e4..0996c21 100644 --- a/gallery/test.typ +++ b/gallery/test.typ @@ -1,6 +1,6 @@ #import "../src/lib.typ": circuit, element, util, wire -#set page(flipped: true) +#set page(width: auto, height: auto, margin: .5cm) #circuit({ element.block( diff --git a/gallery/test2.pdf b/gallery/test2.pdf index 8eafa77..83fe331 100644 Binary files a/gallery/test2.pdf and b/gallery/test2.pdf differ diff --git a/gallery/test2.png b/gallery/test2.png new file mode 100644 index 0000000..e090778 Binary files /dev/null and b/gallery/test2.png differ diff --git a/gallery/test2.typ b/gallery/test2.typ index 7e62cc4..e58b243 100644 --- a/gallery/test2.typ +++ b/gallery/test2.typ @@ -1,6 +1,6 @@ #import "../src/lib.typ": circuit, element, util, wire -#set page(flipped: true) +#set page(width: auto, height: auto, margin: .5cm) #circuit({ element.block( diff --git a/gallery/test3.pdf b/gallery/test3.pdf index 254a340..7fbd809 100644 Binary files a/gallery/test3.pdf and b/gallery/test3.pdf differ diff --git a/gallery/test3.png b/gallery/test3.png new file mode 100644 index 0000000..fa3e14a Binary files /dev/null and b/gallery/test3.png differ diff --git a/gallery/test3.typ b/gallery/test3.typ index f3d5c76..a0d7f88 100644 --- a/gallery/test3.typ +++ b/gallery/test3.typ @@ -1,8 +1,7 @@ #import "@preview/cetz:0.2.2": draw #import "../src/lib.typ": circuit, element, util, wire -#set page(flipped: true) -#let debug = false +#set page(width: auto, height: auto, margin: .5cm) #circuit({ element.block( @@ -14,18 +13,14 @@ (id: "out1"), (id: "out2"), ) - ), - debug: ( - ports: debug - ) ) element.gate-and( - x: 4, y: 0, w: 2, h: 2, id: "and1", debug: (ports: debug), + x: 4, y: 0, w: 2, h: 2, id: "and1", inverted: ("in1") ) element.gate-or( - x: 7, y: 0, w: 2, h: 2, id: "or1", debug: (ports: debug), + x: 7, y: 0, w: 2, h: 2, id: "or1", inverted: ("in0", "out") ) @@ -47,7 +42,7 @@ ) element.gate-and( - x: 11, y: 0, w: 2, h: 2, id: "and2", inputs: 3, debug: (ports: debug), + x: 11, y: 0, w: 2, h: 2, id: "and2", inputs: 3, inverted: ("in0", "in2") ) for i in range(3) { @@ -55,35 +50,35 @@ } element.gate-xor( - x: 14, y: 0, w: 2, h: 2, id: "xor", debug: (ports: debug), + x: 14, y: 0, w: 2, h: 2, id: "xor", inverted: ("in1") ) element.gate-buf( - x: 0, y: -3, w: 2, h: 2, id: "buf", debug: (ports: debug) + x: 0, y: -3, w: 2, h: 2, id: "buf" ) element.gate-not( - x: 0, y: -6, w: 2, h: 2, id: "not", debug: (ports: debug) + x: 0, y: -6, w: 2, h: 2, id: "not" ) element.gate-and( - x: 3, y: -3, w: 2, h: 2, id: "and", debug: (ports: debug) + x: 3, y: -3, w: 2, h: 2, id: "and" ) element.gate-nand( - x: 3, y: -6, w: 2, h: 2, id: "nand", debug: (ports: debug) + x: 3, y: -6, w: 2, h: 2, id: "nand" ) element.gate-or( - x: 6, y: -3, w: 2, h: 2, id: "or", debug: (ports: debug) + x: 6, y: -3, w: 2, h: 2, id: "or" ) element.gate-nor( - x: 6, y: -6, w: 2, h: 2, id: "nor", debug: (ports: debug) + x: 6, y: -6, w: 2, h: 2, id: "nor" ) element.gate-xor( - x: 9, y: -3, w: 2, h: 2, id: "xor", debug: (ports: debug) + x: 9, y: -3, w: 2, h: 2, id: "xor" ) element.gate-xnor( - x: 9, y: -6, w: 2, h: 2, id: "xnor", debug: (ports: debug) + x: 9, y: -6, w: 2, h: 2, id: "xnor" ) }) \ No newline at end of file diff --git a/gallery/test4.pdf b/gallery/test4.pdf index d16be3c..209a78f 100644 Binary files a/gallery/test4.pdf and b/gallery/test4.pdf differ diff --git a/gallery/test4.png b/gallery/test4.png new file mode 100644 index 0000000..530f8c8 Binary files /dev/null and b/gallery/test4.png differ diff --git a/gallery/test4.typ b/gallery/test4.typ index bfb96c8..392b156 100644 --- a/gallery/test4.typ +++ b/gallery/test4.typ @@ -1,7 +1,7 @@ #import "@preview/cetz:0.2.2": draw #import "../src/lib.typ": * -#set page(flipped: true) +#set page(width: auto, height: auto, margin: .5cm) #circuit({ element.group(id: "toplvl", name: "Toplevel", { @@ -200,18 +200,22 @@ draw.content("dmem.south-west", [*External Memories*], anchor: "north", padding: 10pt) }) - wire.wire( - "w-dp-clk", - ("dp-port-clk", (-1, 4.2)), - style: "zigzag", - zigzag-dir: "horizontal", - zigzag-ratio: 100% + draw.line(name: "w-dp-clk", + "dp-port-clk", + (rel: (0, .5), to: ()), + ( + rel: (-.5, 0), + to: (horizontal: "toplvl.west", vertical: ()) + ) ) draw.content("w-dp-clk.end", "clk", anchor: "east", padding: 3pt) - wire.wire( - "w-dp-rst", - ("dp-port-rst", (horizontal: (-1, 0), vertical: ())) + draw.line(name: "w-dp-rst", + "dp-port-rst", + ( + rel: (-.5, 0), + to: (horizontal: "toplvl.west", vertical: ()) + ) ) draw.content("w-dp-rst.end", "rst", anchor: "east", padding: 3pt) }) diff --git a/gallery/test5.pdf b/gallery/test5.pdf index 17c13f0..a953c43 100644 Binary files a/gallery/test5.pdf and b/gallery/test5.pdf differ diff --git a/gallery/test5.png b/gallery/test5.png new file mode 100644 index 0000000..b98ec6b Binary files /dev/null and b/gallery/test5.png differ diff --git a/gallery/test5.typ b/gallery/test5.typ index f8a14ce..e327a6c 100644 --- a/gallery/test5.typ +++ b/gallery/test5.typ @@ -1,7 +1,7 @@ #import "@preview/cetz:0.2.2": draw #import "../src/lib.typ": * -#set page(flipped: true, paper: "a3") +#set page(width: auto, height: auto, margin: .5cm) #circuit({ element.multiplexer( diff --git a/manual.pdf b/manual.pdf index d767eb8..590122d 100644 Binary files a/manual.pdf and b/manual.pdf differ