Forum Discussion
Altera_Forum
Honored Contributor
21 years ago --- Quote Start --- originally posted by warine@Aug 3 2004, 11:59 AM as described in nios ii software developer's handbook, the use of macro iord(base, regnum) is to "read the value of the register at offset regnum within a device with base address base. registers are assumed to be offset by the address width of the bus." --- Quote End --- They phrase it this way because it's tricky. Basically, the REGNUM is what will show up on the address[] port of the actual peripheral. Explained in C terms, IORD(BASE,REGNUM) = ((long*)BASE) + REGNUM for 32-bit buses, and ((short*)BASE) + REGNUM for 16-bit buses. --- Quote Start --- originally posted by warine@Aug 3 2004, 11:59 AM and the use of macro iord_8direct(base, offset) is to "make an 8-bit read access at the location with address base+offset." does the two macros both return a byte value? are the two macros equivalent? --- Quote End --- Explained in C terms, IORD_8DIRECT(BASE, OFFSET) = (char*)(BASE + OFFSET) for all cases. Only this macro returns a byte value.