avl_axi._utils module

avl_axi._utils.get_burst_addresses(base, length, size, burst)[source]

Calculate addresses for an AXI transaction.

Parameters:
  • base (int) – Starting address (ARADDR/AWADDR)

  • length (int) – ARLEN/AWLEN - number of transfers minus 1 (0-255)

  • size (int) – ARSIZE/AWSIZE - size of each transfer as power of 2 0=1 byte, 1=2 bytes, 2=4 bytes, 3=8 bytes, etc.

  • burst (int) – ARBURST/AWBURST - burst type 0=FIXED, 1=INCR, 2=WRAP

Returns:

List of addresses for all transfers in the transaction

Return type:

list

avl_axi._utils.get_beat_byte_offset(base, beat, length, size, burst, strb_width)[source]

Byte-lane offset of a single beat within the data channel for an AXI burst.

Implements the narrow-transfer placement defined by AMBA AXI A3.2.3 and the address structure in A3.4.1: each beat’s 1 << size payload bytes live on byte lanes [offset .. offset + (1 << size) - 1] of the data bus, where offset = beat_address mod data_bus_bytes. For INCR the first beat may be unaligned; subsequent beats are aligned to 1 << size. For WRAP the address wraps at (1 << size) * (length + 1). For FIXED every beat reuses the Start_Address lanes.

Parameters:
  • base (int) – Start_Address (AWADDR/ARADDR).

  • beat (int) – 0-indexed beat number within the burst.

  • length (int) – AWLEN/ARLEN (number of beats - 1).

  • size (int) – AWSIZE/ARSIZE (log2 of bytes per beat).

  • burst (int) – 0=FIXED, 1=INCR, 2=WRAP.

  • strb_width (int) – Data-bus width in bytes.

Returns:

Byte-lane offset for beat within the data bus.

Return type:

int

avl_axi._utils.get_burst_byte_count(strb, length, size, burst)[source]

Calculate total bytes transferred for an AXI burst.

Parameters:
  • strb (int) – Byte strobe width (number of valid bytes in a beat)

  • length (int) – Burst length (ARLEN/AWLEN) = number of beats - 1

  • size (int) – log2(bytes per beat)

  • burst (str) – “FIXED”, “INCR”, or “WRAP”

Returns:

Total number of bytes transferred

Return type:

int