Skip to content

[ci] Add slang lint#445

Open
micprog wants to merge 6 commits into
mainfrom
slang-action
Open

[ci] Add slang lint#445
micprog wants to merge 6 commits into
mainfrom
slang-action

Conversation

@micprog
Copy link
Copy Markdown
Member

@micprog micprog commented Apr 10, 2026

No description provided.

@micprog micprog marked this pull request as ready for review April 11, 2026 15:05
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! I think automatic variables here will make waveform track difficult since they will not be shown as a signal

Copy link
Copy Markdown
Collaborator

@hopang-0221 hopang-0221 Jun 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! here, with automatic prefix we will not be able to track signal r when debugging waveform

Copy link
Copy Markdown
Collaborator

@hopang-0221 hopang-0221 Jun 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For "VSSUB" assignment (line 312, 318, 324), the functionality is changed:

old code: res.w16[b] = vxsat.w16[b] ? (opb.w16[b][15] ? 16'h8000 : 16'h7FFF) : sub[15:0];
new code: res.w16[b] = &vxsat.w16[b] ? (opb.w16[b][15] ? 16'h8000 : 16'h7FFF) : sub[15:0];

So previously, as long as 1 bit is 1, the boolean is true, the new code needs all vxsat.w16[b] bits to be high.

Maybe we should change it to "res.w16[b] = |vxsat.w16[b] ? (opb.w16[b][15] ? 16'h8000 : 16'h7FFF) : sub[15:0];"

Similar changes apply to "res.w32[b]" and "res.w64[b]" in VSSUB block.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, if I'm not mistaken, the old implementation does not consider all bits of vxsat.w16[b]. The newer implementation takes into account all bits and mirrors the functionality in VSSUBU directly above.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In VSSUBU (EW16 for example), they have "vxsat.w16[b] = {2{sub[16]}};", so they replicate the "sub[16]" single bit to all bits in "vxsat.w16[b]", but in VSSUB, this bit is not replicated to all bits, so they only need to check the lowest bis, this is why "&" would be wrong here.

Comment thread hardware/src/sldu/sldu.sv
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me, this change could reduce the readability of the code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automatic prefix will make debugging hard, they do not exist as named signals in the design hierarchy

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automatic prefix will make debugging hard, they do not exist as named signals in the design hierarchy

Comment thread hardware/src/vlsu/vldu.sv
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automatic prefix will make debugging hard, they do not exist as named signals in the design hierarchy

Comment thread hardware/src/vlsu/vstu.sv
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automatic prefix will make debugging hard, they do not exist as named signals in the design hierarchy

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the functionality, I need to understand the code further

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK this is not a functional change, only a clarification: >> has lower precedence than -; - will be evaluated first

micprog and others added 6 commits June 2, 2026 02:15
PR review (hopang-0221): the automatic variables introduced to silence
slang's -Winferred-latch are not visible in waveforms, since they do not
exist as named signals in the design hierarchy.

Restore them as module-scope signals and break the inferred latches with
unconditional default assignments at the top of their always_comb blocks
instead. No functional change: each of these is always assigned before it
is read on the path that uses it, so the defaults only affect the
otherwise-unread latch paths.

Affected: simd_alu (r), lane_sequencer (extra_stride/vl_tot),
masku (vrgat_res/vrgat_buf), vldu (vrf_word_start_byte),
vstu (vrf_eff_write_bytes), vmfpu (vfrec7/vfrsqrt7 scratch arrays,
narrowing_shuffled_result/narrowing_shuffle_be).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR review (hopang-0221): unlike VSSUBU, the VSSUB saturation flag is not
replicated across all bits of vxsat.w{16,32,64}[b] (only the LSB is set),
so the AND-reduction introduced for the slang -Wint-bool-conv fix is
always 0 and saturation never triggers. Use OR-reduction instead, which
matches the original non-zero test and clears the warning.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR review (hopang-0221): replace the verbose explicit zero-pad
replications (added to avoid an unsized '0 inside a concatenation) with
equivalent implicit zero-extension and a plain literal comparison.
out_pnt_d is wide enough to hold {red_stride_cnt_d, 3'b0}, and the popc
compare is against the value 1 - no functional change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants