Compare commits

...

3 Commits

18 changed files with 39 additions and 29 deletions

View File

@ -140,4 +140,11 @@ element.block(id: "b3", w: 2, h: 3,
wire.wire("w1", ("b1-port-out", "b3-port-in1"))
wire.wire("w2", ("b2-port-out", "b3-port-in2"),
style: "zigzag")
```)
#let intersection = example(```
wire.wire("w1", ((0, 0), (1, 1)), style: "zigzag")
wire.wire("w2", ((0, 0), (1, -.5)),
style: "zigzag", zigzag-ratio: 80%)
wire.intersection("w1.zig")
```)

Binary file not shown.

View File

@ -294,6 +294,6 @@
bus: true
)
wire.intersection("wResMP-RegFile.dodge-end")
wire.intersection("wResMP-AdrSrc.dodge-end")
wire.intersection("wResMP-RegFile.dodge-end", radius: .2)
wire.intersection("wResMP-AdrSrc.dodge-end", radius: .2)
})

Binary file not shown.

View File

@ -307,6 +307,6 @@
bus: true
)
wire.intersection("wResMP-RegFile.dodge-end")
wire.intersection("wResMP-AdrSrc.dodge-end")
wire.intersection("wResMP-RegFile.dodge-end", radius: .2)
wire.intersection("wResMP-AdrSrc.dodge-end", radius: .2)
})

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 KiB

After

Width:  |  Height:  |  Size: 276 KiB

View File

@ -202,8 +202,8 @@
style: "zigzag",
zigzag-ratio: 1
)
wire.intersection("wPC2.zig", radius: 2pt)
wire.intersection("wPC2.zag", radius: 2pt)
wire.intersection("wPC2.zig")
wire.intersection("wPC2.zag")
wire.stub("PCAdd-port-in2", "west", name: "4", length: 1.5)
wire.wire(
"wPC+4", ("PCAdd-port-out", "PCMux-port-in0"),
@ -278,11 +278,11 @@
reverse: true,
slice: (31, 7)
)
wire.intersection("wF3.end", radius: 2pt)
wire.intersection("wF7.end", radius: 2pt)
wire.intersection("wA1.end", radius: 2pt)
wire.intersection("wA2.end", radius: 2pt)
wire.intersection("wA3.end", radius: 2pt)
wire.intersection("wF3.end")
wire.intersection("wF7.end")
wire.intersection("wA1.end")
wire.intersection("wA2.end")
wire.intersection("wA3.end")
wire.stub("RegFile-port-clk", "north", name: "clk", length: 0.25)
wire.wire("wRD2", ("RegFile-port-RD2", "SrcBMux-port-in0"))
@ -293,7 +293,7 @@
name: "WriteData",
name-pos: "end"
)
wire.intersection("wWD.zig", radius: 2pt)
wire.intersection("wWD.zig")
wire.wire(
"wImmALU", ("Ext-port-out", "SrcBMux-port-in1"),
@ -305,7 +305,7 @@
wire.wire(
"wImmJump", ("Ext-port-out", "JumpAdd-port-in2")
)
wire.intersection("wImmALU.zig", radius: 2pt)
wire.intersection("wImmALU.zig")
wire.wire(
"wJumpPC", ("JumpAdd-port-out", "PCMux-port-in1"),
style: "dodge",
@ -351,7 +351,7 @@
dodge-y: 2,
dodge-margins: (3, 2)
)
wire.intersection("wALURes2.start2", radius: 2pt)
wire.intersection("wALURes2.start2")
wire.stub("DMem-port-clk", "north", name: "clk", length: 0.25)
wire.wire(

Binary file not shown.

View File

@ -86,6 +86,7 @@
ports-y: (
in1: (h) => {h * 0.225},
in2: (h) => {h * 0.775},
out: (h) => {h * 0.5}
),
debug: debug
)

View File

@ -71,7 +71,7 @@
let out-pct = if align-out {h-ratio / 2} else {50%}
let ports-y = (
"in": (h) => {h - h * (h-ratio / 200%)},
"out": (h) => {h * (out-pct / 100%)}
"out": (h) => {h - h * (out-pct / 100%)}
)
element.elmt(

View File

@ -33,7 +33,7 @@
y: none,
w: none,
h: none,
inputs: 2,
inputs: 1,
fill: none,
stroke: black + 1pt,
id: "",
@ -65,7 +65,7 @@
y: none,
w: none,
h: none,
inputs: 2,
inputs: 1,
fill: none,
stroke: black + 1pt,
id: "",

View File

@ -33,7 +33,7 @@
stroke: black + 1pt,
id: "",
inverted: (),
inverted-radius: 0.2,
inverted-radius: 0.1,
debug: (
ports: false
)
@ -58,19 +58,16 @@
if (type(y) == dictionary) {
let from = y.from
let to = y.to
let (to-side, i) = find-port(ports, to)
let margins = (0%, 0%)
if to-side in ports-margins {
margins = ports-margins.at(to-side)
}
let used-pct = 100% - margins.at(0) - margins.at(1)
let used-height = height * used-pct / 100%
let top-margin = height * margins.at(0) / 100%
let dy = used-height * (i + 1) / (ports.at(to-side).len() + 1)
let dy
if to == "out" {
dy = height / 2
} else {
dy = height * (i + 0.5) / inputs
}
let (ctx, from-pos) = coordinate.resolve(ctx, from)
y = from-pos.at(1) + dy - height + top-margin
y = from-pos.at(1) + dy - height
}
let tl = (x, y + height)

View File

@ -7,7 +7,12 @@
#let signal-width = 1pt
#let bus-width = 1.5pt
#let intersection(pt, radius: .2, fill: black) = {
/// Draws a wire intersection at the given anchor
/// #examples.intersection
/// - pt (point): A CeTZ compatible point / anchor
/// - radius (number): The radius of the intersection
/// - fill (color): The fill color
#let intersection(pt, radius: .1, fill: black) = {
draw.circle(pt, radius: radius, stroke: none, fill: fill)
}