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: a1bc2bbeb044
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: f6f0a7b692da
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Sep 21, 2019

  1. lib.fifo: simplify. NFC.

    whitequark committed Sep 21, 2019
    Copy the full SHA
    f6f0a7b View commit details
Showing with 10 additions and 7 deletions.
  1. +10 −7 nmigen/lib/fifo.py
17 changes: 10 additions & 7 deletions nmigen/lib/fifo.py
Original file line number Diff line number Diff line change
@@ -358,12 +358,13 @@ def elaborate(self, platform):
m.d.comb += consume_enc.i.eq(consume_r_nxt)
m.d[self._r_domain] += consume_r_gry.eq(consume_enc.o)

w_full = Signal()
r_empty = Signal()
m.d.comb += [
self.w_rdy.eq(
(produce_w_gry[-1] == consume_w_gry[-1]) |
(produce_w_gry[-2] == consume_w_gry[-2]) |
(produce_w_gry[:-2] != consume_w_gry[:-2])),
self.r_rdy.eq(consume_r_gry != produce_r_gry)
w_full.eq((produce_w_gry[-1] != consume_w_gry[-1]) &
(produce_w_gry[-2] != consume_w_gry[-2]) &
(produce_w_gry[:-2] == consume_w_gry[:-2])),
r_empty.eq(consume_r_gry == produce_r_gry),
]

storage = Memory(self.width, self.depth)
@@ -373,12 +374,14 @@ def elaborate(self, platform):
m.d.comb += [
w_port.addr.eq(produce_w_bin[:-1]),
w_port.data.eq(self.w_data),
w_port.en.eq(do_write)
w_port.en.eq(do_write),
self.w_rdy.eq(~w_full),
]
m.d.comb += [
r_port.addr.eq((consume_r_bin + do_read)[:-1]),
r_port.addr.eq(consume_r_nxt[:-1]),
self.r_data.eq(r_port.data),
r_port.en.eq(1),
self.r_rdy.eq(~r_empty),
]

if platform == "formal":