actorlib/spi/collector: atomic update for write_count
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Tue, 9 Oct 2012 17:08:09 +0000 (19:08 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Tue, 9 Oct 2012 17:08:09 +0000 (19:08 +0200)
migen/actorlib/spi.py

index 8f44f0b07964e8606f27319b8281ab44e03987c0..e5565a5dff0600aefb6a13a6f783c8dff67d63b5 100644 (file)
@@ -10,9 +10,8 @@ class Collector(Actor):
                self._depth = depth
                self._dw = sum(len(s) for s in self.token("sink").flatten())
                
-               # TODO: reg_wc should have atomic update
                self._reg_wa = RegisterField("write_address", bits_for(self._depth-1), access_bus=READ_WRITE, access_dev=READ_WRITE)
-               self._reg_wc = RegisterField("write_count", bits_for(self._depth), access_bus=READ_WRITE, access_dev=READ_WRITE)
+               self._reg_wc = RegisterField("write_count", bits_for(self._depth), access_bus=READ_WRITE, access_dev=READ_WRITE, atomic_update=True)
                self._reg_ra = RegisterField("read_address", bits_for(self._depth-1), access_bus=READ_WRITE, access_dev=READ_ONLY)
                self._reg_rd = RegisterField("read_data", self._dw, access_bus=READ_ONLY, access_dev=WRITE_ONLY)