Skip to content

Commit

Permalink
Bug fix in UnaryOperatorExpressionAst::value
Browse files Browse the repository at this point in the history
  • Loading branch information
dhower-qc committed Jul 18, 2024
1 parent 16ea130 commit c554d30
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/idl/ast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2337,7 +2337,7 @@ def type_check(symtab)
# @!macro value
def value(symtab)
val = val_trunc = eval("#{op}#{exp.value(symtab)}", binding, __FILE__, __LINE__)
if type(symtab).integral? && val != val_trunc
if type(symtab).integral?
val_trunc = val & ((1 << type(symtab).width) - 1)
if type(symtab).signed? && ((((val_trunc >> (type(symtab).width - 1))) & 1) == 1)
# need to make this negative!
Expand Down Expand Up @@ -2981,7 +2981,7 @@ def value(symtab)

memoize = true
if width.nil?
width = archdef.config_params["XLEN"]
width = symtab.archdef.config_params["XLEN"]
memoize = false
end

Expand All @@ -3007,7 +3007,6 @@ def unsigned_value
case text_value.delete("_")
when /([0-9]+)?'(s?)([bodh]?)(.*)/
# verilog-style literal
signed = ::Regexp.last_match(2)
radix_id = ::Regexp.last_match(3)
value = ::Regexp.last_match(4)

Expand Down

0 comments on commit c554d30

Please sign in to comment.