Forum Discussion
Altera_Forum
Honored Contributor
17 years agoI'm not even going to bother reading the other replies. How wide is your data bus? This may actually matter. Also, what version of the tools are you using?
You need to make your data bus 32-bits wide regardless of whether you are using all 32-bits or not. This will make your life easier as the NIOS has a 32-bit data bus. If you've got a 9-bit address bus you should end up with 11 bits of address space in SOPC builder. The reason for this is that address is space in SOPC builder is byte addressed. So for each 32-bit word of address in your component you have 4 byte addresses. You don't need to think about this when writing your C code. Altera provides the IOWR and IORD macros. So to write or read to/from your component: IOWR(MY_IP_BASE, <some register address>, <new_data>); and IORD(MY_IP_BASE, <some register address>) The IOWR and IORD macros will convert your desired register address to a byte address and perform the transaction. I have written hundreds of SOPC custom components so I have a fairly firm grasp on how things work. Now as to why you have 12-bits of address space instead of 11. I've only seen this in one case. There used to be a setting for custom user components that specified the addressing scheme (DYNAMIC or NATIVE). I won't go into what that means. Anyway, that setting was deprecated in 7.1 of the tools. With the newer tools (like 8.0 and newer), if the component was somehow set to use the deprecated NATIVE addressing scheme, it would give two extra bits of address space to the component. I'm not sure if this is what is happening to you but if it is then I would guess your data bus is 16-bits wide and you somehow have the deprecated NATIVE parameter assigned to your avalon slave interface. Jake