Forum Discussion
Altera_Forum
Honored Contributor
15 years agoAny slave port connected to the Nios II instruction or data master will appear in the system.h file generated in your system library or BSP. The base address defined will be based on the name that you instantiated the component as in SOPC Builder. So if you called your component in your system "my_fifo" then you could expect to fine something like this in the system.h file:
# define MY_FIFO_BASE <some base address> If you component is only a FIFO then you really only need a single address location to read from. If you have multiple values besides the data inside the FIFO to read back then you build up address decoding (optionally) and typically include a multiplexer driven by the address line. For example if I created a FIFO that I can read data from and also read the 'used' signal I would do something like this: assign pop_fifo = (slave_read == 1) & (fifo_empty == 0); // should only read from FIFO when it's not empty assign waitrequest = (fifo_empty == 1); // read request should not complete until there is data in the FIFO assign slave_readdata = (address == 1'b0)? fifo_readdata : fifo_used; // reading from address 0 pops the fifo, otherwise read the used signal.