TrickyDicky
Advanced Member level 7
- Joined
- Jun 7, 2010
- Messages
- 7,110
- Helped
- 2,081
- Reputation
- 4,181
- Reaction score
- 2,048
- Trophy points
- 1,393
- Activity points
- 39,769
when the last address in a bust is sent AND accepted by the slave, arvalid should return to 0.
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 wire transaction_is_accepted = (o_axi_arvalid) && (i_axi_arready); always @(posedge clk) begin if(reset) o_axi_araddr <= 0; else o_axi_araddr <= idx_n + idx_r + idx_k; // the DDR address to read data from end // used for generating address (o_axi_araddr) indexes reg [C_AXI_ADDR_WIDTH-1:0] idx_n; reg [C_AXI_ADDR_WIDTH-1:0] idx_r; reg [C_AXI_ADDR_WIDTH-1:0] idx_k; // no multiply in actual synthesized hardware since 'N', 'n', 'Tn' and TILE_LENGTH are constants always @(posedge clk) begin if(reset) idx_n <= n * TILE_LENGTH * TILE_LENGTH; else if ((idx_n < (N * TILE_LENGTH * TILE_LENGTH)) && transaction_is_accepted) idx_n <= idx_n + Tn * TILE_LENGTH * TILE_LENGTH; end // no multiply in actual synthesized hardware since 'r', 'MAX_J' and 'TILE_LENGTH' are constants always @(posedge clk) begin if(reset) idx_r <= r * TILE_LENGTH; else if((idx_r < ((r + MAX_J) * TILE_LENGTH)) && transaction_is_accepted) idx_r <= idx_r + TILE_LENGTH; end always @(posedge clk) begin if(reset) idx_k <= c; else if((idx_k < (c + MAX_K)) && transaction_is_accepted) idx_k <= idx_k + 1; end
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 // ignoring the always stuff // this is slave code that does INCR burst operations. if (ARVALID && ARREADY) // ARADDR has an address to be read from, so grab it my_addr <= ARADDR; else if (RVALID && RREADY) // data @my_addr is being returned by the slave, so my_addr can be updated my_addr <= my_addr + 1; end if; // this is master code that generates addresses in a sequential pattern (non-burst) if (ARVALID && ARREADY) // ARADDR increments every time the address was accepted by the slave ARADDR <= ARADDR + 1; end if;
Thanks Tricky forgot they changed that between AXI3 & AXI4, haven't had to write code for either interface for over 2 years, been stuck using APB and AHB.@ADS-ee out of order transactions are only supported in axi 3. In axi4 all transactions must be in order. Hence why in axi4 wdata has no wid signal as this is taken from awid
i think the "my_addr" is for designs that have arlen > 1.
but not things that break the axi spec like toggling valid from 1 to 0 when ready is/was 0.
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 always @(posedge clk) begin if(reset) o_axi_rvalid <= 0; // AXI specification: A3.3.1 Dependencies between channel handshake signal // the VALID signal of the AXI interface sending information must not be dependent on // the READY signal of the AXI interface receiving that information // this is to prevent deadlock // since AXI slave could wait for i_axi_arvalid to be true before setting o_axi_arready true. // Note: For same interface, VALID cannot depend upon READY, but READY can depends upon VALID // Note: Once VALID is asserted, it MUST be kept asserted until READY is asserted. // VALID signal needs to be set (initially) independent of READY signal, // and then only ever adjusted if !(VALID && !READY) // Note: the slave must not wait for the master to assert RREADY before asserting RVALID // Note: (!(o_axi_rvalid && !i_axi_rready)) == (!rvalid || rready) // == (!rvalid || (rvalid && rready)). // it means "no transaction in progress or transaction accepted" // Note: the slave must wait for both ARVALID and ARREADY to be asserted before // it asserts RVALID to indicate that valid data is available else if(!(o_axi_rvalid && !i_axi_rready)) o_axi_rvalid <= i_axi_arvalid && o_axi_arready; end
Your implementation of an AXI slave may behave this way but this is not part of the AXI specification. You should avoid ambiguities in your comments that mix specification and specific implementation details. Something as simple as AXI-2.3.2.1: <some spec info> and the rest of the comment is better than Note: <some spec info>.// Note: the slave must wait for both ARVALID and ARREADY to be asserted before
// it asserts RVALID to indicate that valid data is available
else if(!(o_axi_rvalid && !i_axi_rready))
...there is nothing in the spec that requires the slave to assert RVALID once that has occurred...
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?