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: e844b0e0958d
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: 43e4833ddb5f
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jan 26, 2019

  1. hdl.ast: fix ValueKey for Cat.

    whitequark committed Jan 26, 2019
    Copy the full SHA
    bc5a127 View commit details
  2. back.rtlil: accept ast.Const as cell parameter.

    whitequark committed Jan 26, 2019
    Copy the full SHA
    43e4833 View commit details
Showing with 8 additions and 3 deletions.
  1. +6 −1 nmigen/back/rtlil.py
  2. +2 −2 nmigen/hdl/ast.py
7 changes: 6 additions & 1 deletion nmigen/back/rtlil.py
Original file line number Diff line number Diff line change
@@ -114,9 +114,14 @@ def cell(self, kind, name=None, params={}, ports={}, src=""):
if isinstance(value, str):
self._append(" parameter \\{} \"{}\"\n",
param, value.translate(self._escape_map))
else:
elif isinstance(value, int):
self._append(" parameter \\{} {:d}\n",
param, value)
elif isinstance(value, ast.Const):
self._append(" parameter \\{} {}'{:b}\n",
param, len(value), value.value)
else:
assert False
for port, wire in ports.items():
self._append(" connect {} {}\n", port, wire)
self._append(" end\n")
4 changes: 2 additions & 2 deletions nmigen/hdl/ast.py
Original file line number Diff line number Diff line change
@@ -1122,7 +1122,7 @@ def __hash__(self):
return hash((ValueKey(self.value.value), ValueKey(self.value.offset),
self.value.width))
elif isinstance(self.value, Cat):
return hash(tuple(ValueKey(o) for o in self.value.operands))
return hash(tuple(ValueKey(o) for o in self.value.parts))
elif isinstance(self.value, ArrayProxy):
return hash((ValueKey(self.value.index),
tuple(ValueKey(e) for e in self.value._iter_as_values())))
@@ -1159,7 +1159,7 @@ def __eq__(self, other):
self.value.width == other.value.width)
elif isinstance(self.value, Cat):
return all(ValueKey(a) == ValueKey(b)
for a, b in zip(self.value.operands, other.value.operands))
for a, b in zip(self.value.parts, other.value.parts))
elif isinstance(self.value, ArrayProxy):
return (ValueKey(self.value.index) == ValueKey(other.value.index) and
len(self.value.elems) == len(other.value.elems) and