Skip to content

Enforce bus wiring rules and highlight connectable ports - #337

Merged
milanofthe merged 3 commits into
mainfrom
feature/bus-connection-rules
Sep 15, 2026
Merged

milanofthe merged 3 commits into
mainfrom
feature/bus-connection-rules

Conversation

@milanofthe

Copy link
Copy Markdown
Member
  • A bus may only be connected to a Bus Creator, a Bus Selector or a subsystem port, and a Bus Selector only takes a bus. Wires breaking these rules are rejected while connecting (isValidConnection) and existing ones are drawn dashed in the error color.
  • While a wire is dragged, the ports that can take it are outlined in their block color: free inputs when dragging from an output, outputs when dragging from an input, both within the bus rules.
  • The rule is busWiringProblem in src/lib/bus/expand.ts, with tests including subsystem ports. The bus analysis is computed once per graph change and reused during drags.
  • pvm spec 4.4 notes that editors should not create such wiring.

Checks: npm test, svelte-check.

@milanofthe
milanofthe merged commit ceefc82 into main Sep 15, 2026
4 checks passed
@milanofthe
milanofthe deleted the feature/bus-connection-rules branch September 15, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant