Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/nmigen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 999a2f612a56
Choose a base ref
...
head repository: m-labs/nmigen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 578c1c500e19
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Aug 3, 2019

  1. back.rtlil: actually match shape of left hand side.

    This comes up in code such as:
      Array([Signal(1), Signal(8)]).eq(Const(0, 8))
    whitequark committed Aug 3, 2019
    Copy the full SHA
    578c1c5 View commit details
Showing with 8 additions and 2 deletions.
  1. +8 −2 nmigen/back/rtlil.py
10 changes: 8 additions & 2 deletions nmigen/back/rtlil.py
Original file line number Diff line number Diff line change
@@ -572,8 +572,14 @@ def on_Operator(self, value):
raise TypeError # :nocov:

def match_shape(self, value, new_bits, new_sign):
assert value.shape() == (new_bits, new_sign)
return self(value)
value_bits, value_sign = value.shape()
if new_bits == value_bits:
return self(value)
elif new_bits < value_bits:
return self(ast.Slice(value, 0, new_bits))
else: # new_bits > value_bits
# It is legal to assign to constants on LHS in RTLIL; such assignments are ignored.
return "{{ {}'{} {} }}".format(new_bits, "x" * (new_bits - value_bits), self(value))

def on_Signal(self, value):
if value not in self.s.driven: