Thursday, August 28, 2025

Protocol ARM numericals

 

The start and end address of a 4 KB memory in Hex

 

we must represent addresses in the hexadecimal format.

Now, 1 kilobyte = 1024 bytes = 2^10 bytes

So 4 KB will have 2^10 * 2^2 = 2^12 bytes.

 

2^12 bytes of memory means 2^12 locations can be accessed in the memory.

For this, we require 12 bits to access all the locations.

In hexadecimal, each digit represents 4 binary bits. So 3 hex digits will cover 12 bits.

Memory addresses in hex: 000 to FFF for a 4kB memory.

Start address = 0x000

End address = 0xFFF

 

 

Divide a 4 GB memory space equally for 8 slave devices. What is the address range for each device

 

4 GB = 2^32 = 32 bits to represent the memory space

In hex, 0000 0000 to FFFF FFFF represents 4 GB space.

Divide by 8, we get 512 MB = 2^29 = 1FFF FFFF increment each time for 8 slaves.

 

Address spacing for each slave:

0000 0000 to 1FFF FFFF

2000 0000 to 3FFF FFFF

4000 0000 to 5FFF FFFF

6000 0000 to 7FFF FFFF

8000 0000 to 9FFF FFFF

A000 0000 to BFFF FFFF

C000 0000 to DFFF FFFF

E000 0000 to FFFF FFFF

 

 

Now let us consider Wrap operation.

 

Concept:

A wrap operation performs read/write starting from a start address, increments by size and reaches upto the wrap boundary.

After this, we move back to the lower wrap address. 

A wrap transfer is defined by wrap length and wrap size.

Note the following:

1. Start address of a wrap burst must be aligned to the size of the transfer.

2. The length of the burst must be 2,4,8 or 16.

 

Example:

Consider a 4-beat burst of 4-byte transfers.

(meaning length = 4 and size = 4 bytes)

Total size = 4*4 = 16 bytes. 

So address must wrap at every 16 byte boundary.

16 = 2^4. 

So wrap address starts and ends with 0000. (Four bits zeroes at the end)  

Note: 4-byte size transfers must be aligned to 4-byte boundaries (two bits zeroes at the end).

 

Eg. 0x20, 0x24, 0x28, 0x2c is a valid sequence of addresses for 4-beat burst of 4-byte transfers. After reaching 0x2c, we wrap back to 0x20.