frontend/avalon: Simplify start condition.

This commit is contained in:
Florent Kermarrec 2023-05-31 09:21:14 +02:00 committed by Hans Baier
parent 17527092db
commit 9950904cb5
1 changed files with 14 additions and 12 deletions

View File

@ -53,8 +53,7 @@ class LiteDRAMAvalonMM2Native(LiteXModule):
address = Signal(port.address_width) address = Signal(port.address_width)
byteenable = Signal(avalon_data_width//8) byteenable = Signal(avalon_data_width//8)
writedata = Signal(avalon_data_width) writedata = Signal(avalon_data_width)
start_transaction = Signal() start = Signal()
start_condition = Signal()
cmd_ready_seen = Signal() cmd_ready_seen = Signal()
cmd_ready_count = Signal(9) cmd_ready_count = Signal(9)
@ -66,11 +65,11 @@ class LiteDRAMAvalonMM2Native(LiteXModule):
] ]
self.comb += [ self.comb += [
burst_start .eq(avalon.burstcount >= 2), burst_start .eq(avalon.burstcount > 1),
burst_active.eq(burst_count >= 1), burst_active.eq(burst_count > 0),
] ]
self.sync += [ self.sync += [
If(start_transaction, If(start,
byteenable.eq(avalon.byteenable), byteenable.eq(avalon.byteenable),
burst_count.eq(avalon.burstcount), burst_count.eq(avalon.burstcount),
address.eq(avalon.address - offset), address.eq(avalon.address - offset),
@ -87,17 +86,20 @@ class LiteDRAMAvalonMM2Native(LiteXModule):
port.cmd.valid.eq(avalon.read | avalon.write) port.cmd.valid.eq(avalon.read | avalon.write)
), ),
start_transaction.eq(avalon.read | avalon.write), If(avalon.read | avalon.write,
If(downconvert, If(downconvert,
start_condition.eq(start_transaction) start.eq(1)
).Else( ).Else(
start_condition.eq(start_transaction & (burst_start | port.cmd.ready)) start.eq(burst_start | port.cmd.ready)
)
), ),
If(start_condition, If(start,
If(downconvert, If(downconvert,
avalon.waitrequest.eq(1) avalon.waitrequest.eq(1)
).Else( ).Else(
If(~burst_start, avalon.waitrequest.eq(0)) If(~burst_start,
avalon.waitrequest.eq(0)
)
), ),
If(avalon.write, If(avalon.write,
If(burst_start, If(burst_start,