Altera_Forum
Honored Contributor
16 years agoSOPC read latency question
Hi, I have a novice question about the SOPC builder.
I made a simple component in the Component Editor which is a just a RAM. The RAM's VHDL was created with the Mega-Wizard Plug-in manager. It has 32-bit wide data, 8-bit address, registered read and write, and both read and write enables. I connected it up as an Avalon Slave choosing write latency of 0 and read latency of 1. I saw the cute little timing diagrams that the Component Editor displays and they looked as I expected. The component is connected directly to the data master of a Nios II/s with no bridge. It uses the same clock as the processor. I find that I can read and write to the memory locations corresponding to my component, using IORD and IOWR in a C program. Good news! However, there is something strange. If I write four different numbers to four different locations, and then read them back out, I get the same four numbers out but in a **different order**. Is there a pipeline so that when I read or write I am really reading or writing a previous number? Is the pipeline on both read and write or only one of them? Does this have to do with the latency setting I chose when I made the component, or is it a feature of the processor? Or of the Avalon fabric? Where can I read about this and what is the safe way to handle it in software? Thanks!