Skip to content

Commit

Permalink
gen/fhdl: Revert PR #2161 since introducing regressions.
Browse files Browse the repository at this point in the history
Ex: python3 -m litex_boards.targets.lambdaconcept_ecpix5 --build    --cpu-type rocket --cpu-variant linux --cpu-num-cores 1 --cpu-mem-width 2 --sys-clk-freq 50e6 --with-ethernet --with-sdcard --yosys-flow3
  • Loading branch information
enjoy-digital committed Jan 20, 2025
1 parent e9e7cd9 commit 666c9b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
19 changes: 7 additions & 12 deletions litex/gen/fhdl/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,15 @@ def to_signed(r):
# Print Slice --------------------------------------------------------------------------------------

def _generate_slice(ns, node):
length = len(node)
assert length >= 1
start = 0
while isinstance(node, _Slice):
start += node.start
node = node.value
if len(node) == 1:
sr = "" # Avoid slicing 1-bit Signals.
assert (node.stop - node.start) >= 1
if hasattr(node.value, "__len__") and len(node.value) == 1:
sr = "" # Avoid slicing 1-bit Signals.
else:
if length > 1:
sr = f"[{start+length-1}:{start}]"
if (node.stop - node.start) > 1:
sr = f"[{node.stop-1}:{node.start}]"
else:
sr = f"[{start}]"
r, s = _generate_expression(ns, node)
sr = f"[{node.start}]"
r, s = _generate_expression(ns, node.value)
return r + sr, s

# Print Cat ----------------------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions litex/gen/fhdl/verilog.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ def convert(f, ios=set(), name="top", platform=None,
msg += f"- {f.name}\n"
raise Exception(msg)

# Lower complex slices.
f = lower_complex_slices(f)

# Insert resets.
insert_resets(f)

Expand Down

0 comments on commit 666c9b4

Please sign in to comment.