Repository navigation
fix(sv): read string characters as signed bytes - #2446
Merged
Merged
Conversation
IEEE 1800-2023 6.16 makes a single character of a string variable a `byte`, and 6.16.3 declares `function byte getc(int i)`; 6.11 makes `byte` a signed 2-state type. Celox typed `s[i]` and `s.getc(i)` as unsigned 8-bit values, so a character code above 127 converted to a positive integer. Type them as signed bytes. Impact: a character with code 128..255 now reads as a negative value when it is widened, compared or printed as a number (`int n = s[0]` gives -1 for 8'hff, `s[0] < 0` is true, `%0d` prints -1). ASCII characters, `putc`, assignments of characters to 8-bit variables and string contents are unchanged. The shared string::characters_are_signed_bytes case checks the LRM values. xezim 0.11.3 agrees; Verilator 5.052 and Icarus 13.0 read the code as 255. The Verilator disagreement is retained with a standalone probe, and the case joins Icarus' existing getc limitation. sv-tests conformance is unchanged. Change-Id: I394404abf48a74110753cecf60a1e35952fa5924
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
|
Queued — the merge queue status continues in this comment ↓. |
Contributor
✅ Merged into
|
| Condition | Required by | |
|---|---|---|
| ✅ | check-success = Conventional Commit title |
— |
| ✅ | check-success = Queue validation |
— |
| ✅ | any of: check-success = @github-actions/Lint & Format, check-neutral = @github-actions/Lint & Format, check-skipped = @github-actions/Lint & Format |
GitHub repository ruleset rule master |
| ✅ | any of: check-success = @github-actions/Rust Test & NAPI Build, check-neutral = @github-actions/Rust Test & NAPI Build, check-skipped = @github-actions/Rust Test & NAPI Build |
GitHub repository ruleset rule master |
| ✅ | any of: check-success = @github-actions/JS Test (Ubuntu), check-neutral = @github-actions/JS Test (Ubuntu), check-skipped = @github-actions/JS Test (Ubuntu) |
GitHub repository ruleset rule master |
| ✅ | any of: check-success = @github-actions/Conventional Commit title, check-neutral = @github-actions/Conventional Commit title, check-skipped = @github-actions/Conventional Commit title |
GitHub repository ruleset rule master |
| ✅ | any of: check-success = @github-actions/Queue validation, check-neutral = @github-actions/Queue validation, check-skipped = @github-actions/Queue validation |
GitHub repository ruleset rule master |
Times in UTC · dashboard · how the merge queue works
This was referenced Oct 28, 2026
Closed
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.
IEEE 1800-2023 6.16 makes a single character of a string variable a
byte,and 6.16.3 declares
function byte getc(int i); 6.11 makesbytea signed2-state type. Celox typed
s[i]ands.getc(i)as unsigned 8-bit values, so acharacter code above 127 converted to a positive integer. Type them as signed
bytes.
Impact: a character with code 128..255 now reads as a negative value when it
is widened, compared or printed as a number (
int n = s[0]gives -1 for 8'hff,s[0] < 0is true,%0dprints -1). ASCII characters,putc, assignments ofcharacters to 8-bit variables and string contents are unchanged.
The shared string::characters_are_signed_bytes case checks the LRM values.
xezim 0.11.3 agrees; Verilator 5.052 and Icarus 13.0 read the code as 255.
The Verilator disagreement is retained with a standalone probe, and the case
joins Icarus' existing getc limitation. sv-tests conformance is unchanged.