Skip to content

Commit

Permalink
litex/gen/verilog: use format_constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Dennison committed Jul 28, 2024
1 parent 12e1f3f commit cd3364a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions litex/gen/fhdl/verilog.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from litex.gen import LiteXContext
from litex.gen.fhdl.namer import build_signal_namespace
from litex.gen.fhdl.hierarchy import LiteXHierarchyExplorer
from litex.gen.format import format_constant

from litex.build.tools import get_litex_git_revision

Expand Down Expand Up @@ -165,10 +166,10 @@ def _generate_hierarchy(top):
# Print Constant -----------------------------------------------------------------------------------

def _generate_constant(node):
return "{sign}{bits}'d{value}".format(
return "{sign}{bits}'{value}".format(
sign = "" if node.value >= 0 else "-",
bits = str(node.nbits),
value = abs(node.value),
value = format_constant(abs(node.value), verilog=True),
), node.signed

# Print Signal -------------------------------------------------------------------------------------
Expand Down

0 comments on commit cd3364a

Please sign in to comment.