Repository navigation
Use a single power value for Redpiler nodes - #264
Closed
Paul1365972 wants to merge 9 commits into
Closed
Paul1365972 wants to merge 9 commits into
Paul1365972 wants to merge 9 commits into
Conversation
Paul1365972
force-pushed
the
refactor/redpiler-node-state
branch
from
September 18, 2026 02:50
a36e7c8 to
896e896
Compare
Paul1365972
force-pushed
the
refactor/redpiler-node-state
branch
from
September 30, 2026 15:23
896e896 to
9211ae6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #260.
Every node stored both a
poweredflag and a power level (output_powerin the backend,output_strengthin the compile graph and exported graph).For the behavior Redpiler currently implements, we can derive the boolean from the power level instead.
There is now just
power, withis_powered()checking whether it is nonzero.Lamps, trapdoors and note blocks store their activation as 0 or 15 too, which is why I went with
powerrather thanoutput_strength.SignalStrengthis arepr(u8)enum with 16 variants covering 0 to 15.It takes one byte and gives the compiler the valid range, while conversions and deserialization reject out-of-range values.
Option<SignalStrength>also replacesNonMaxU8for comparator far inputs without taking more space.Flushing is also restructured.
write_blockswrites a node's blocks andplay_pending_notesplays pending notes, soresetwrites every changed node directly instead of going throughflush.Whether
flushwrites a node is decided at compile time:is_iobecomesvisible(!io_only || is_input || is_output), andJITBackend::flushloses itsio_onlyparameter.Some related cleanup:
sstoweightfor consistency.lockedtorepeater_locked.NodeInput, with private buckets and capacity checking during construction.comparator_output_powerbetween the update and tick paths.Nodemethods and keep propagation inset_power_and_propagate.Input histograms now also start valid and stay nonzero, so power lookup uses
NonZeroU128and drops the zero check we had before.Valid RIL syntax is unchanged.
The parser now rejects powers outside 0..=15 and link weights above 255 instead of truncating them, and
docs/RIL.mddocuments link weights as they are parsed.Exported graphs lose the separate
poweredfield and will need to be regenerated.Quick link to review only the refactor.