forked from HEL/circuiteria
Compare commits
2 Commits
8c91ccdd54
...
ea8277ee5b
Author | SHA1 | Date | |
---|---|---|---|
ea8277ee5b | |||
c5e4f8039a |
@@ -4,7 +4,7 @@
|
|||||||
#set page(width: auto, height: auto, margin: .5cm)
|
#set page(width: auto, height: auto, margin: .5cm)
|
||||||
|
|
||||||
#circuit({
|
#circuit({
|
||||||
element.gate-iec-buf(
|
element.iec-gate-buf(
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
w: 2,
|
w: 2,
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
)
|
)
|
||||||
wire.stub("iec-buf-port-in0", "west")
|
wire.stub("iec-buf-port-in0", "west")
|
||||||
|
|
||||||
element.gate-iec-not(
|
element.iec-gate-not(
|
||||||
x: 3,
|
x: 3,
|
||||||
y: 0,
|
y: 0,
|
||||||
w: 2,
|
w: 2,
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
)
|
)
|
||||||
wire.stub("iec-not-port-in0", "west")
|
wire.stub("iec-not-port-in0", "west")
|
||||||
|
|
||||||
element.gate-iec-and(
|
element.iec-gate-and(
|
||||||
id: "iec-and",
|
id: "iec-and",
|
||||||
x: 0,
|
x: 0,
|
||||||
y: -3,
|
y: -3,
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
wire.stub("iec-and-port-in" + str(i), "west")
|
wire.stub("iec-and-port-in" + str(i), "west")
|
||||||
}
|
}
|
||||||
|
|
||||||
element.gate-iec-nand(
|
element.iec-gate-nand(
|
||||||
id: "iec-nand",
|
id: "iec-nand",
|
||||||
x: 3,
|
x: 3,
|
||||||
y: -3,
|
y: -3,
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
wire.stub("iec-nand-port-in" + str(i), "west")
|
wire.stub("iec-nand-port-in" + str(i), "west")
|
||||||
}
|
}
|
||||||
|
|
||||||
element.gate-iec-or(
|
element.iec-gate-or(
|
||||||
id: "iec-or",
|
id: "iec-or",
|
||||||
x: 0,
|
x: 0,
|
||||||
y: -6,
|
y: -6,
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
wire.stub("iec-or-port-in" + str(i), "west")
|
wire.stub("iec-or-port-in" + str(i), "west")
|
||||||
}
|
}
|
||||||
|
|
||||||
element.gate-iec-nor(
|
element.iec-gate-nor(
|
||||||
id: "iec-nor",
|
id: "iec-nor",
|
||||||
x: 3,
|
x: 3,
|
||||||
y: -6,
|
y: -6,
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
wire.stub("iec-nor-port-in" + str(i), "west")
|
wire.stub("iec-nor-port-in" + str(i), "west")
|
||||||
}
|
}
|
||||||
|
|
||||||
element.gate-iec-xor(
|
element.iec-gate-xor(
|
||||||
id: "iec-xor",
|
id: "iec-xor",
|
||||||
x: 0,
|
x: 0,
|
||||||
y: -9,
|
y: -9,
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
wire.stub("iec-xor-port-in" + str(i), "west")
|
wire.stub("iec-xor-port-in" + str(i), "west")
|
||||||
}
|
}
|
||||||
|
|
||||||
element.gate-iec-nxor(
|
element.iec-gate-nxor(
|
||||||
id: "iec-nxor",
|
id: "iec-nxor",
|
||||||
x: 3,
|
x: 3,
|
||||||
y: -9,
|
y: -9,
|
||||||
|
@@ -12,9 +12,9 @@
|
|||||||
#import "elements/logic/xor.typ": gate-xor, gate-xnor
|
#import "elements/logic/xor.typ": gate-xor, gate-xnor
|
||||||
#import "elements/logic/buf.typ": gate-buf, gate-not
|
#import "elements/logic/buf.typ": gate-buf, gate-not
|
||||||
#import "elements/logic/iec_gate.typ": iec-gate
|
#import "elements/logic/iec_gate.typ": iec-gate
|
||||||
#import "elements/logic/iec_and.typ": gate-iec-and, gate-iec-nand
|
#import "elements/logic/iec_and.typ": iec-gate-and, iec-gate-nand
|
||||||
#import "elements/logic/iec_buf.typ": gate-iec-buf, gate-iec-not
|
#import "elements/logic/iec_buf.typ": iec-gate-buf, iec-gate-not
|
||||||
#import "elements/logic/iec_or.typ": gate-iec-or, gate-iec-nor
|
#import "elements/logic/iec_or.typ": iec-gate-or, iec-gate-nor
|
||||||
#import "elements/logic/iec_xor.typ": gate-iec-xor, gate-iec-nxor
|
#import "elements/logic/iec_xor.typ": iec-gate-xor, iec-gate-nxor
|
||||||
|
|
||||||
#import "elements/group.typ": group
|
#import "elements/group.typ": group
|
@@ -6,8 +6,8 @@
|
|||||||
/// Draws an IEC-AND gate. This function is also available as `element.iec-gate-and()`
|
/// Draws an IEC-AND gate. This function is also available as `element.iec-gate-and()`
|
||||||
///
|
///
|
||||||
/// For parameters, see #doc-ref("gates.iec-gate")
|
/// For parameters, see #doc-ref("gates.iec-gate")
|
||||||
/// #examples.gate-iec-and
|
/// #examples.iec-gate-and
|
||||||
#let gate-iec-and(
|
#let iec-gate-and(
|
||||||
x: none,
|
x: none,
|
||||||
y: none,
|
y: none,
|
||||||
w: none,
|
w: none,
|
||||||
@@ -40,8 +40,8 @@
|
|||||||
/// Draws an IEC-NAND gate. This function is also available as `element.iec-gate-nand()`
|
/// Draws an IEC-NAND gate. This function is also available as `element.iec-gate-nand()`
|
||||||
///
|
///
|
||||||
/// For parameters, see #doc-ref("gates.iec-gate")
|
/// For parameters, see #doc-ref("gates.iec-gate")
|
||||||
/// #examples.gate-iec-nand
|
/// #examples.iec-gate-nand
|
||||||
#let gate-iec-nand(
|
#let iec-gate-nand(
|
||||||
x: none,
|
x: none,
|
||||||
y: none,
|
y: none,
|
||||||
w: none,
|
w: none,
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
ports: false
|
ports: false
|
||||||
),
|
),
|
||||||
) = {
|
) = {
|
||||||
gate-iec-and(
|
iec-gate-and(
|
||||||
x: x,
|
x: x,
|
||||||
y: y,
|
y: y,
|
||||||
w: w,
|
w: w,
|
||||||
|
@@ -5,8 +5,8 @@
|
|||||||
/// Draws an IEC buffer gate. This function is also available as `element.iec-gate-buf()`
|
/// Draws an IEC buffer gate. This function is also available as `element.iec-gate-buf()`
|
||||||
///
|
///
|
||||||
/// For parameters, see #doc-ref("gates.iec-gate")
|
/// For parameters, see #doc-ref("gates.iec-gate")
|
||||||
/// #examples.gate-iec-buf
|
/// #examples.iec-gate-buf
|
||||||
#let gate-iec-buf(
|
#let iec-gate-buf(
|
||||||
x: none,
|
x: none,
|
||||||
y: none,
|
y: none,
|
||||||
w: none,
|
w: none,
|
||||||
@@ -38,8 +38,8 @@
|
|||||||
/// Draws an IEC NOT gate. This function is also available as `element.iec-gate-not()`
|
/// Draws an IEC NOT gate. This function is also available as `element.iec-gate-not()`
|
||||||
///
|
///
|
||||||
/// For parameters, see #doc-ref("gates.iec-gate")
|
/// For parameters, see #doc-ref("gates.iec-gate")
|
||||||
/// #examples.gate-iec-not
|
/// #examples.iec-gate-not
|
||||||
#let gate-iec-not(
|
#let iec-gate-not(
|
||||||
x: none,
|
x: none,
|
||||||
y: none,
|
y: none,
|
||||||
w: none,
|
w: none,
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
ports: false,
|
ports: false,
|
||||||
),
|
),
|
||||||
) = {
|
) = {
|
||||||
gate-iec-buf(
|
iec-gate-buf(
|
||||||
x: x,
|
x: x,
|
||||||
y: y,
|
y: y,
|
||||||
w: w,
|
w: w,
|
||||||
|
@@ -94,18 +94,15 @@
|
|||||||
let space = 100% / inputs
|
let space = 100% / inputs
|
||||||
for i in range(inputs) {
|
for i in range(inputs) {
|
||||||
let pct = (i + 0.5) * space
|
let pct = (i + 0.5) * space
|
||||||
let a = (tl, pct, bl)
|
let port-pos = (tl, pct, bl)
|
||||||
let b = (tr, pct, br)
|
|
||||||
let int-name = id + "i" + str(i)
|
|
||||||
draw.intersections(
|
|
||||||
int-name,
|
|
||||||
func,
|
|
||||||
draw.hide(draw.line(a, b))
|
|
||||||
)
|
|
||||||
let port-name = "in" + str(i)
|
let port-name = "in" + str(i)
|
||||||
let port-pos = int-name + ".0"
|
|
||||||
if inverted == "all" or port-name in inverted {
|
if inverted == "all" or port-name in inverted {
|
||||||
draw.circle(port-pos, radius: inverted-radius, anchor: "east", stroke: stroke)
|
draw.circle(
|
||||||
|
port-pos,
|
||||||
|
radius: inverted-radius,
|
||||||
|
anchor: "east",
|
||||||
|
stroke: stroke
|
||||||
|
)
|
||||||
port-pos = (rel: (-2 * inverted-radius, 0), to: port-pos)
|
port-pos = (rel: (-2 * inverted-radius, 0), to: port-pos)
|
||||||
}
|
}
|
||||||
add-port(
|
add-port(
|
||||||
|
@@ -4,8 +4,8 @@
|
|||||||
/// Draws an IEC-OR gate. This function is also available as `element.iec-gate-or()`
|
/// Draws an IEC-OR gate. This function is also available as `element.iec-gate-or()`
|
||||||
///
|
///
|
||||||
/// For parameters, see #doc-ref("gates.iec-gate")
|
/// For parameters, see #doc-ref("gates.iec-gate")
|
||||||
/// #examples.gate-iec-or
|
/// #examples.iec-gate-or
|
||||||
#let gate-iec-or(
|
#let iec-gate-or(
|
||||||
x: none,
|
x: none,
|
||||||
y: none,
|
y: none,
|
||||||
w: none,
|
w: none,
|
||||||
@@ -37,8 +37,8 @@
|
|||||||
/// Draws an IEC-NOR gate. This function is also available as `element.iec-gate-nor()`
|
/// Draws an IEC-NOR gate. This function is also available as `element.iec-gate-nor()`
|
||||||
///
|
///
|
||||||
/// For parameters, see #doc-ref("gates.iec-gate")
|
/// For parameters, see #doc-ref("gates.iec-gate")
|
||||||
/// #examples.gate-iec-nor
|
/// #examples.iec-gate-nor
|
||||||
#let gate-iec-nor(
|
#let iec-gate-nor(
|
||||||
x: none,
|
x: none,
|
||||||
y: none,
|
y: none,
|
||||||
w: none,
|
w: none,
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
ports: false
|
ports: false
|
||||||
)
|
)
|
||||||
) = {
|
) = {
|
||||||
gate-iec-or(
|
iec-gate-or(
|
||||||
x: x,
|
x: x,
|
||||||
y: y,
|
y: y,
|
||||||
w: w,
|
w: w,
|
||||||
|
@@ -4,8 +4,8 @@
|
|||||||
/// Draws an IEC-XOR gate. This function is also available as `element.iec-gate-xor()`
|
/// Draws an IEC-XOR gate. This function is also available as `element.iec-gate-xor()`
|
||||||
///
|
///
|
||||||
/// For parameters, see #doc-ref("gates.iec-gate")
|
/// For parameters, see #doc-ref("gates.iec-gate")
|
||||||
/// #examples.gate-iec-xor
|
/// #examples.iec-gate-xor
|
||||||
#let gate-iec-xor(
|
#let iec-gate-xor(
|
||||||
x: none,
|
x: none,
|
||||||
y: none,
|
y: none,
|
||||||
w: none,
|
w: none,
|
||||||
@@ -37,8 +37,8 @@
|
|||||||
/// Draws an IEC-NXOR gate. This function is also available as `element.iec-gate-nxor()`
|
/// Draws an IEC-NXOR gate. This function is also available as `element.iec-gate-nxor()`
|
||||||
///
|
///
|
||||||
/// For parameters, see #doc-ref("gates.iec-gate")
|
/// For parameters, see #doc-ref("gates.iec-gate")
|
||||||
/// #examples.gate-iec-nxor
|
/// #examples.iec-gate-nxor
|
||||||
#let gate-iec-nxor(
|
#let iec-gate-nxor(
|
||||||
x: none,
|
x: none,
|
||||||
y: none,
|
y: none,
|
||||||
w: none,
|
w: none,
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
ports: false
|
ports: false
|
||||||
)
|
)
|
||||||
) = {
|
) = {
|
||||||
gate-iec-xor(
|
iec-gate-xor(
|
||||||
x: x,
|
x: x,
|
||||||
y: y,
|
y: y,
|
||||||
w: w,
|
w: w,
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
#import "elements/logic/xor.typ": gate-xor, gate-xnor
|
#import "elements/logic/xor.typ": gate-xor, gate-xnor
|
||||||
#import "elements/logic/buf.typ": gate-buf, gate-not
|
#import "elements/logic/buf.typ": gate-buf, gate-not
|
||||||
#import "elements/logic/iec_gate.typ": iec-gate
|
#import "elements/logic/iec_gate.typ": iec-gate
|
||||||
#import "elements/logic/iec_and.typ": gate-iec-and, gate-iec-nand
|
#import "elements/logic/iec_and.typ": iec-gate-and, iec-gate-nand
|
||||||
#import "elements/logic/iec_or.typ": gate-iec-or, gate-iec-nor
|
#import "elements/logic/iec_or.typ": iec-gate-or, iec-gate-nor
|
||||||
#import "elements/logic/iec_buf.typ": gate-iec-buf, gate-iec-not
|
#import "elements/logic/iec_buf.typ": iec-gate-buf, iec-gate-not
|
||||||
#import "elements/logic/iec_xor.typ": gate-iec-xor, gate-iec-nxor
|
#import "elements/logic/iec_xor.typ": iec-gate-xor, iec-gate-nxor
|
||||||
|
Reference in New Issue
Block a user