alignment = element[3]
else:
alignment = 0
- reg = CSRStorage(nbits + alignment, reset=reset, atomic_write=atomic, name=prefix + name)
+ reg = CSRStorage(nbits + alignment, reset=reset, atomic_write=atomic,
+ alignment_bits=alignment, name=prefix + name)
csrs.append(reg)
- assigns.append(getattr(target, name).eq(reg.storage[alignment:]))
+ assigns.append(getattr(target, name).eq(reg.storage))
return csrs, assigns
(MODE_EXTERNAL, MODE_SINGLE_SHOT, MODE_CONTINUOUS) = range(3)
def __init__(self, layout, mode):
self.source = Source(_convert_layout(layout))
self.busy = Signal()
- self._csrs, assigns = _create_csrs_assign(layout, self.source.payload,
- mode != MODE_SINGLE_SHOT)
+ self._csrs, assigns = _create_csrs_assign(layout, self.source.payload, mode != MODE_SINGLE_SHOT)
if mode == MODE_EXTERNAL:
- trigger = self.trigger = Signal()
+ self.trigger = Signal()
+ trigger = self.trigger
elif mode == MODE_SINGLE_SHOT:
shoot = CSR()
self._csrs.insert(0, shoot)
raise ValueError
self.comb += self.busy.eq(self.source.stb)
stmts = [self.source.stb.eq(trigger)] + assigns
- self.sync += [If(self.source.ack | ~self.source.stb, *stmts)]
+ self.sync += If(self.source.ack | ~self.source.stb, *stmts)
def get_csrs(self):
return self._csrs