1 package axi_addr_generator;
2 /*=== Project imports ===*/
3 import defined_types::*;
4 `include "instance_defines.bsv"
5 /*=======================*/
7 // This function is used by the slaves on the AXI4 bus to generate the sequential addresses in burst mode.
8 // the different modes supported are :
9 // FIXED: the same address is sent in all transactions. Typically used in polling modes.
10 // INCR: The address is simply incremented arlen number of times from the starting address.
11 // WRAP: This mode supports only 4 valid lengths: 2, 4 8 and 16 bursts. the increments happen in a wrap arouind fashion.
12 function Bit#(`PADDR) burst_address_generator(Bit#(8) arlen, Bit#(3) arsize, Bit#(2) arburst, Bit#(`PADDR) address);
14 // this variable will decide the index above which part of the address should
15 // not change in WRAP mode. Bits below this index value be incremented according
16 // to the value of arlen and arsize;
25 Bit#(`PADDR) new_address=address+(('b1)<<arsize); // this is address will directly be used for INCR mode.
27 mask=('1)<<(arsize+wrap_size); // create a mask for bits which will remain constant in wrap mode.
28 Bit#(`PADDR) temp1=address& mask; // capture the constant part of the address in WRAP mode.
29 Bit#(`PADDR) temp2=new_address& (~mask); // capture the incremental part of the address in WRAP mode.
31 if(arburst==0) // FIXED
33 else if(arburst==1)begin // INCR
37 return temp1|temp2; // create the new address in the wrap mode by ORing the masked values.