Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions spec/chip.typ
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
groups = (groups,)
}
assert(groups.all(group => group in all_groups), message: "unknown group")
let selected_constraints = groups.map(g => (g: chip.constraints.at(g))).join()

// Find the group definition in the constraint_groups
let lookup_group(name) = chip.constraint_groups.filter((g) => g.name == name).at(0, default: (name: name))
Expand Down Expand Up @@ -220,16 +221,29 @@
(table.cell(align: right, colspan: 2, [_description_]), eval(constraint.desc, mode: "markup"), [])
}

// Whether there is at least one constraint with a range
// This can be used to see whether the "Range" label should be displayed
let do_display_range = selected_constraints.values().flatten().any(x => "range" in x)

// Whether there is at least one constraint with a multiplicity
// This can be used to see whether the "Multiplicity" label should be displayed
let do_display_multiplicity = selected_constraints.values().flatten().any(x => "multiplicity" in x)

show figure: set block(breakable: true)
figure(table(
columns: (auto, auto, 1fr, auto),
inset: 6pt,
align: (top + left, top + left, top + left, top + center),
stroke: none,
table.header([*Tag*], [*Range*], [*Description*], [*Multiplicity*]),
table.header(
[*Tag*],
if do_display_range {[*Range*]} else {[]},
[*Description*],
if do_display_multiplicity {[*Multiplicity*]} else {[]},
),
table.hline(stroke: stroke(thickness: 2pt)),
..for group in groups {
for constraint in chip.constraints.at(group) {
..for (group, group_constraints) in selected_constraints.pairs() {
for constraint in group_constraints {
(
[#tag(constraint, lookup_group(group))],
[#interval(constraint)],
Expand All @@ -243,6 +257,6 @@
render_polynomial_constraints(constraint)
}
}
},
}
), caption: [Constraint overview of #chip.name chip.])
}