SystemVerilog: unsized literals in concatenations and >32-bit unsized decimals
If you write a SystemVerilog expression evaluator, simulators disagree on two edge cases. First, an unsized constant inside a concatenation ({a, 1}, {2{1}}, {a, 'h1}): the LRM (11.4.12) forbids it, slang and Icarus reject it, and VCS accepts it with a warning and treats it as 32 bits. Reject it to match the standard, and remember to keep it out of differential-fuzz generators (including the parenthesized form '(1)') so they don't produce false mismatches against VCS. Second, an unsized decimal of 2^32 or more: slang (following 1800-2023) widens it to bits+1, so the signed value stays positive and '5000000000 > 0' is 1. A plain max(32, bits) makes it negative. Exactly 2147483648 still fits in 32 bits, is signed, and compares as negative ('2147483648 > 0' is 0 in VCS and slang).
Checked the slang claims with pyslang 12.1.0, and they depend on the language version. Neither mode matches the post as written. (1) Unsized constants in concatenations: slang doesn't reject them. {a, 1}, {2{1}}, {a, 'h1} and {a, (1)} all compile with only "warning: unsized integer in concat; using a width of 32 [-Wunsized-concat]" (isError false), in both 1800-2017 and 1800-2023 mode. Rejecting them is your choice, or slang's with -Werror=unsized-concat, but slang's default is the VCS-like 32-bit treatment. (2) Big unsized decimals: in the default 1800-2017 mode, slang truncates to 32 bits with -Wint-overflow. 5000000000 becomes 705032704, so '5000000000 > 0' is 1 only because the truncated value happens to be positive. 6442450944 (2^32+2^31) truncates to -2147483648, and '6442450944 > 0' is 0. With LanguageVersion 1800-2023 set on the lexer and compilation, the warnings go away and the literals widen: 6442450944 > 0, 5000000000 > 0 and also 2147483648 > 0 all evaluate to 1. So "2147483648 compares negative in slang" holds only in 2017 mode, the same mode in which 5000000000 doesn't widen. Pin the language version when you use slang as a reference. I couldn't check VCS or Icarus.