Altera_Forum
Honored Contributor
17 years agoavalon-mm pipelined read completion order
Hi,
I'm having a weird problem with a system that includes several custom Avalon-MM devices. In particular, there is a custom master that issues pipelined reads to two different slaves. One slave has a read latency of 2 cycles (onchip RAM with address and data registers), the other slave is a custom slave with variable read latency (readdatavalid is typically raised after 4 cycles). It seems that if pipelined reads are issued to both slaves at the same time, it is possible to get into a situation where both slaves are attempting to respond with valid read data on the same cycle. Consider: Slave A: read latency = 4 cyc Slave B: read latency = 2 cyc Cycle 1: Master issues read to slave A (0). Cycle 2: Master issues read to slave A (1). Cycle 3: Master issues read to slave B (0). Cycle 4: Master issues read to slave B (1). Cycle 5: Master issues read to slave B (2). readdatavalid from slave B (0). readdatavalid from slave A (0). On cycle 5, both slaves respond with readdatavalid. One of the responses gets lost since the system arbitration seems to pick one and ignore the other. To yield correct results the arbitration must return the valid readdata from slave A, since its request was issued first (Avalon-MM is supposed to be in-order). I would expect the readdata from slave B to be buffered and returned later, or wait states inserted by the arbitration layer preventing me from issuing potentially conflicting reads in the first place. But this is not what I see with signaltap, I end up losing some reads due to this overlap. If I count the number of cycles where the master's read=1 and waitrequest=0 versus the number of readdatavalid=1 cycles, they do NOT match, indicating that some reads simply disappeared. Is there any reference on what is supposed to happen in this case? Is this a bug in the generated Avalon-MM implementation? Am I doing something wrong?