Forum Discussion
Altera_Forum
Honored Contributor
14 years agoHi Kimberly,
--- Quote Start --- Just to let you know I completed the the quartus_stp -s session as well. It works fine (on a monkey see, monkey do) basis. ;-) --- Quote End --- Excellent :) --- Quote Start --- One thing I noticed is that reading the ram on an not-times-4 address gives a different result then in System Console. The read value 'shifts around'. Why? --- Quote End --- I'm not sure what the 'exact' sequence going on in this particular case is, you could probe with SignalTap and see the transactions, but if you look carefully at the data, you'll see the value is not shifting randomly, its shifting relative to the LSB address bits, so for your write of 0x12345678 to address zero, the 32-bit little endian bytes in memory are:
byte byte
address data
-------- -----
0 0x78
1 0x56
2 0x34
3 0x12
If you read from address 0, the little-endian 32-bit word you read is 0x12345678, whereas if you read from 1, 0x56 will be in the LSB position, so you should read 0x78123456, which you do. Similarly, the read address 2 should be 0x56781234, and from 3 0x34567812, and again, these are the values you read. Note how for each read, the 4 bytes at the modulo-4-byte address (address 0 or address 4) get packed into a 32-bit word little-endian style, where the LSB byte is the byte at the address you actually read from. As you work with computers, you will find this sort of modulo operation occurs with memory caches, DDR memory bursts, and other devices. By the way - nice work on "just trying stuff" - and then asking questions when things do not appear to make sense. Cheers, Dave