- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hello everyone! I have a 32bits /2k onchip memory. This means i have 64 adresses
When i use IOWR32DIRECT(1) at the adress 0x00, the adresses 0x01 0x02 and 0x03 recieve the value 1 also. I understand that hexadecimal system is represented by 4 bits, therefore i need 8 hexadecilmal chars to represent the 32bits of memory. What if i write in the adress 0x01 instead of 0x00, will the 0x02 0x03 and 0x04 adress become 1? Is this the way it's supposed to be? is 0x00000001 adress different from 0x01? I am kinda confused링크가 복사됨
3 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
It sounds like the function you are using is using byte addressing, but only really supports word addressing:
IE If you write 0x33221100 to address 0x00 but read back address 0x01 the data still looks like: 0x33221100 Because the lower to bits of the address do not matter as far as the system is concerned, and it's up to you to pick the correct byte out of the 32 bit word. Pete- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
So you are telling me that the real adresses are
0 10 100 1000 10000 etc? And that the lower bits doesnt matter?- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
What anakha mean is that Nios/Avalon system is based on byte addressing; then a 32bit word at address A is actually the same as 4 bytes at addresses A+0, A+1, A+2, A+3.
During 32bit memory accesses, the lower two bits of address are discarded and the 32bit word is aligned on multiple of 4 addresses. So you get distinct data for addresses 0, 4, 8, 12, 16 etc. While if you read back at 1, 2, 3 you get the same as address 0, like in your case. On the other hand, if you use the IORD and IOWR macros, the native width of the bus is considered: for a 32bit memory device IORD_32DIRECT at address A is equivalent to IORD at address A/4. For more comprehensive information refer to the Nios software developer handbook, ch. 9.