Repository navigation
fix: code review - latch detection, naming, I2C decoding, signal matching - #5
Merged
Merged
Conversation
- Fix _check_latch_inference depth counter initialization (start at 1 instead of 0) - Improve _check_naming camelCase detection (allow short clk/rst prefixes) - Fix I2C protocol decoder to use address_bits config for 10-bit addresses - Improve signal name matching in _get_signal_values (exact > prefix > contains) - Enable ACK detection in I2C decoder These fixes address potential bugs found during code review: 1. Case statement depth counting was off by one 2. CamelCase naming check was too permissive for clk/rst prefixes 3. I2C 10-bit address decoding was not implemented 4. Signal matching could incorrectly match substrings
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.
Summary
This PR fixes several issues found during code review of the SuperRTL codebase.
1. Fix case statement depth counting in latch detection
src/superrtl/tools/review.py_check_latch_inferencefunction initializeddepth = 0when detecting acasestatement, but the firstcasekeyword was then matched by"case" in case_lineinside the loop, incrementing depth to 1 immediately. This meant the loop would look for one extraendcasethat didn't exist, potentially running past the actual end of the case block.depth = 0todepth = 1and addedj != iguard to skip double-counting the firstcase.2. Improve camelCase naming detection
src/superrtl/tools/review.py_check_namingfunction excluded all signals starting withclkorrstfrom camelCase warnings, including longer names likeclkDividerorrstGeneratorthat should use snake_case.clkDiv,rstN.3. Fix I2C 10-bit address decoding
src/superrtl/tools/protocol_decode.pyaddress_bitsconfig parameter was read from config but never used in the actual decoding logic. All addresses were decoded as 7-bit regardless of the setting.4. Improve signal name matching precision
src/superrtl/tools/protocol_decode.py_get_signal_valuesfunction used simple substring matching (in), which could incorrectly match signals liketx_datawhen looking fortx, orspi_misowhen looking forsck(becausesckappears inspi_sck)._,.,[) > substring fallback.5. Enable I2C ACK detection
src/superrtl/tools/protocol_decode.pypass.Testing