diff --git a/litedram/core/bankmachine.py b/litedram/core/bankmachine.py index 8783481..4533ed2 100644 --- a/litedram/core/bankmachine.py +++ b/litedram/core/bankmachine.py @@ -61,9 +61,12 @@ class BankMachine(Module): cmd_bufferRead.sink.valid.eq(cmd_buffer_lookahead.source.valid & ~cmd_buffer_lookahead.source.we), cmd_bufferWrite.sink.valid.eq(cmd_buffer_lookahead.source.valid & cmd_buffer_lookahead.source.we), - cmd_buffer_lookahead.source.ready.eq( - ((cmd_bufferRead.sink.ready | cmd_bufferRead.source.ready) & ~cmd_buffer_lookahead.source.we) - | ((cmd_bufferWrite.sink.ready | cmd_bufferWrite.source.ready) & cmd_buffer_lookahead.source.we)), + cmd_buffer_lookahead.source.ready.eq(req.rdata_valid | req.wdata_ready + | (cmd_buffer_lookahead.source.we & cmd_bufferWrite.source.ready) + | (~cmd_buffer_lookahead.source.we & cmd_bufferRead.source.ready)), + #cmd_buffer_lookahead.source.ready.eq( + # ((cmd_bufferRead.sink.ready | cmd_bufferRead.source.ready) & ~cmd_buffer_lookahead.source.we) + # | ((cmd_bufferWrite.sink.ready | cmd_bufferWrite.source.ready) & cmd_buffer_lookahead.source.we)), cmd_bufferRead.source.ready.eq(req.rdata_valid), cmd_bufferWrite.source.ready.eq(req.wdata_ready), diff --git a/litedram/core/multiplexer.py b/litedram/core/multiplexer.py index 3ccecf5..9654680 100644 --- a/litedram/core/multiplexer.py +++ b/litedram/core/multiplexer.py @@ -46,18 +46,10 @@ class _CommandChooser(Module): cmd.valid.eq(choices[arbiter.grant]) ] - for name in ["a", "ba", "is_read", "is_write", "is_cmd", "is_activate"]: + for name in ["a", "ba", "cas", "ras", "we", "is_read", "is_write", "is_cmd", "is_activate"]: choices = Array(getattr(req, name) for req in requests) self.comb += getattr(cmd, name).eq(choices[arbiter.grant]) - for name in ["cas", "ras", "we"]: - # we should only assert those signals when valid is 1 - choices = Array(getattr(req, name) for req in requests) - self.comb += \ - If(cmd.valid, - getattr(cmd, name).eq(choices[arbiter.grant]) - ) - for i, request in enumerate(requests): self.comb += \ If(cmd.valid & cmd.ready & (arbiter.grant == i),