Skip to content

Commit

Permalink
Fix the return type of the $bits system function (issue #1163)
Browse files Browse the repository at this point in the history
Early editions of the SystemVerilog standard did not specify the return
type for $bits, so we made it 32 bit unsigned 2-state. Later editions
state the return type is integer (32 bit signed 4-state), so make it so.
  • Loading branch information
martinwhitaker committed Sep 7, 2024
1 parent 34ed6f6 commit 0136db7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions elab_expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1437,10 +1437,10 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope,
expr->test_width(des, scope, arg_mode);
}

expr_type_ = IVL_VT_BOOL;
expr_type_ = IVL_VT_LOGIC;
expr_width_ = integer_width;
min_width_ = integer_width;
signed_flag_ = false;
signed_flag_ = true;

if (debug_elaborate)
cerr << get_fileline() << ": " << __func__ << ": "
Expand Down

0 comments on commit 0136db7

Please sign in to comment.