Skip to content

Commit

Permalink
litex/gen/fhdl/instance: Switch to expression.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Jan 14, 2025
1 parent 0bfaf39 commit e71e404
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions litex/gen/fhdl/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
# SPDX-License-Identifier: BSD-2-Clause

from migen.fhdl.structure import *
from migen.fhdl.verilog import _printexpr as verilog_printexpr
from migen.fhdl.specials import *

from litex.gen.fhdl.expression import _generate_expression

# Helpers ------------------------------------------------------------------------------------------

def get_max_name_length(ios):
Expand Down Expand Up @@ -48,7 +49,7 @@ def _instance_generate_verilog(instance, ns, add_data_file):
r += f"\t.{p.name}{' '*(ident-len(p.name))} ("
# Constant.
if isinstance(p.value, Constant):
r += verilog_printexpr(ns, p.value)[0]
r += _generate_expression(ns, p.value)[0]
# Float.
elif isinstance(p.value, float):
r += str(p.value)
Expand Down Expand Up @@ -84,7 +85,7 @@ def _instance_generate_verilog(instance, ns, add_data_file):
if len(inouts) and (io is inouts[0]):
r += "\n\t// InOuts.\n"
name_inst = io.name
name_design = verilog_printexpr(ns, io.expr)[0]
name_design = _generate_expression(ns, io.expr)[0]
first = False
r += f"\t.{name_inst}{' '*(ident-len(name_inst))} ({name_design})"
if not first:
Expand Down

0 comments on commit e71e404

Please sign in to comment.