fixed multiplexers with named ports + minor changes
This commit is contained in:
parent
7e0209b712
commit
21b5d1cbfe
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
/// Draws a block circuit diagram
|
/// Draws a block circuit diagram
|
||||||
///
|
///
|
||||||
|
/// This function is also available as `circuiteria.circuit()`
|
||||||
|
///
|
||||||
/// - body (none, array, element): A code block in which draw functions have been called
|
/// - body (none, array, element): A code block in which draw functions have been called
|
||||||
/// - length (length, ratio): Optional base unit
|
/// - length (length, ratio): Optional base unit
|
||||||
/// -> none
|
/// -> none
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
stroke: black + 1pt,
|
stroke: black + 1pt,
|
||||||
id: "",
|
id: "",
|
||||||
debug: (
|
debug: (
|
||||||
grid: false,
|
|
||||||
ports: false
|
ports: false
|
||||||
)
|
)
|
||||||
) = {
|
) = {
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
stroke: black + 1pt,
|
stroke: black + 1pt,
|
||||||
id: "",
|
id: "",
|
||||||
debug: (
|
debug: (
|
||||||
grid: false,
|
|
||||||
ports: false
|
ports: false
|
||||||
)
|
)
|
||||||
) = element.elmt(
|
) = element.elmt(
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
auto-ports: true,
|
auto-ports: true,
|
||||||
ports-y: (),
|
ports-y: (),
|
||||||
debug: (
|
debug: (
|
||||||
grid: false,
|
|
||||||
ports: false
|
ports: false
|
||||||
)
|
)
|
||||||
) = draw.get-ctx(ctx => {
|
) = draw.get-ctx(ctx => {
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
stroke: black + 1pt,
|
stroke: black + 1pt,
|
||||||
id: "",
|
id: "",
|
||||||
debug: (
|
debug: (
|
||||||
grid: false,
|
|
||||||
ports: false
|
ports: false
|
||||||
)
|
)
|
||||||
) = {
|
) = {
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
stroke: black + 1pt,
|
stroke: black + 1pt,
|
||||||
id: "",
|
id: "",
|
||||||
debug: (
|
debug: (
|
||||||
grid: false,
|
|
||||||
ports: false
|
ports: false
|
||||||
)
|
)
|
||||||
) = {
|
) = {
|
||||||
@ -45,6 +44,10 @@
|
|||||||
let bits = util.lpad(str(i, base: 2), nbits)
|
let bits = util.lpad(str(i, base: 2), nbits)
|
||||||
ports.push((id: "in" + str(i), name: bits))
|
ports.push((id: "in" + str(i), name: bits))
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (i, port) in entries.enumerate() {
|
||||||
|
ports.push((id: "in" + str(i), name: port))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
element.elmt(
|
element.elmt(
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
///
|
///
|
||||||
/// #example(`#util.lpad("0100", 8)`, mode: "markup")
|
/// #example(`#util.lpad("0100", 8)`, mode: "markup")
|
||||||
///
|
///
|
||||||
/// - s (str): The string to pad
|
/// - string (str): The string to pad
|
||||||
/// - len (int): The target length
|
/// - len (int): The target length
|
||||||
/// -> str
|
/// -> str
|
||||||
#let lpad(s, len) = {
|
#let lpad(string, len) = {
|
||||||
let res = "0" * len + s
|
let res = "0" * len + string
|
||||||
return res.slice(-len)
|
return res.slice(-len)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@
|
|||||||
/// - style (str): The wire's style (see `wire-styles` for possible values)
|
/// - style (str): The wire's style (see `wire-styles` for possible values)
|
||||||
/// - reverse (bool): If true, the start and end points will be swapped (useful in cases where the start point depends on the end point, for example with perpendiculars)
|
/// - reverse (bool): If true, the start and end points will be swapped (useful in cases where the start point depends on the end point, for example with perpendiculars)
|
||||||
/// - zigzag-ratio (ratio): Position of the zigzag vertical relative to the horizontal span (only with style "zigzag")
|
/// - zigzag-ratio (ratio): Position of the zigzag vertical relative to the horizontal span (only with style "zigzag")
|
||||||
/// - dodge-y (int, float, length, ratio): Y position to dodge the wire to (only with style "dodge")
|
/// - dodge-y (number): Y position to dodge the wire to (only with style "dodge")
|
||||||
/// - dodge-sides (array): The start and end sides (going out of the connected element) of the wire (only with style "dodge")
|
/// - dodge-sides (array): The start and end sides (going out of the connected element) of the wire (only with style "dodge")
|
||||||
/// - dodge-margins (array): The start and end margins (i.e. space before dodging) of the wire (only with style "dodge")
|
/// - dodge-margins (array): The start and end margins (i.e. space before dodging) of the wire (only with style "dodge")
|
||||||
#let wire(
|
#let wire(
|
||||||
|
Loading…
Reference in New Issue
Block a user