0
\$\begingroup\$

I'm working with a Zedboard and I'm printing to the screen memory addresses of consecutive 32-bit float numbers.

So the print generates this:

Result 0: 5374.557617
Memory is A000000
Result 1: 5474.651233
Memory is A000004
Result 2: 5574.557129
Memory is A000008
 ....

So memory is incremented 4 each time.I can't understand why a memory with 4 more bits can keep a 32 bit number. The only way this makes sense is is hexadecimal is convertible to bytes and so +4 bytes=+32 bits.

However this isn't the way I learned, everyone says that hexadecimal shall me converted to bits

Surprisingly I haven't found anything on the Internet about this question in particular.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ RAM is very, very, very rarely addressed in such a way as to specify bit addresses. Byte addresses are the norm. \$\endgroup\$ – brhans Apr 20 '15 at 12:23
3
\$\begingroup\$

So memory is incremented 4 each time.

Nope. The address is incremented by 4. RAM Memory is typically addressed byte-wise, that means there is one byte of data at each address.

\$\endgroup\$
3
  • \$\begingroup\$ Ok, thank you for the answer. Just to clarify, when I increment the address like this: 0x40400000 + 0x58 am I incrementing 58 bytes? \$\endgroup\$ – João Pereira Apr 20 '15 at 13:20
  • \$\begingroup\$ Nope, you are incrementing by 88 Bytes. Remember that 0x is hex prefix. \$\endgroup\$ – Turbo J Apr 20 '15 at 17:29
  • \$\begingroup\$ Oh ok. So if i do 0x40400000 + 58 i'll be incrementing 58 bytes but if I do 0x40400000 + 0x58 i'll be incrementing (58)_16=(88)_10 bytes. Correct? \$\endgroup\$ – João Pereira Apr 20 '15 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.