Skip to content

Conversation

kroening
Copy link
Collaborator

@kroening kroening commented Sep 1, 2024

Verilog allows constants to be marked as signed (e.g., 'sb1). When using base 2, 8 and 16, these need to be sign extended to 32 bits unless the number of bits is given.

@kroening kroening force-pushed the fix-signed-constants branch 6 times, most recently from f2736e5 to ca96560 Compare September 4, 2024 21:03
@kroening kroening marked this pull request as ready for review September 4, 2024 21:05
if(rest[0]!='\'')
{
bits=atoi(rest.c_str());
bits = atol(rest.c_str());
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is probably safe because of the lexer rules, but I would feel better if this used one of the safe_string2... functions instead of atol.

Verilog allows constants to be marked as signed (e.g., 'sb1).  When using
base 2, 8 and 16, these need to be sign extended to 32 bits unless the
number of bits is given.
@kroening kroening force-pushed the fix-signed-constants branch from ca96560 to a8115a8 Compare September 6, 2024 21:02
@kroening kroening merged commit 03d9ee4 into main Sep 6, 2024
8 checks passed
@kroening kroening deleted the fix-signed-constants branch September 6, 2024 21:04
Romy15200 pushed a commit to Romy15200/nws that referenced this pull request Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants