ElEctric_EyE wrote:
Arlet wrote:
...Then, add the right amount output delay on the signals going to the SRAM so you're not reading too late. In the absence of a good board simulator, this will be a process of trial and error.
If I understand correctly, I need to present the RAM with the address, R/W & CS signal. Then on the port inside the FPGA read the data there with a delay?
Signal timings has always been my weakness in digital design.
After you present the address and control signals, there's a small delay before the signals actually appear on the outside pins of the FPGA. This is because there's a relatively big capacitance of the output pin and drivers compared to the tiny capacitances inside the FPGA. Then the signal needs to propagate over the board to the SRAM, and then there's a delay from the SRAM before it presents valid data (this is the access time specified in the data sheet). Then the data needs to go back to the FPGA, and make it inside. Suppose this all takes 15 ns. Also, assume you have a 10 ns clock. Now, because your output is valid for a whole clock cycle of 10 ns, the data from the SRAM is also going to be valid for about 10 ns (a little less if different signals have different delays). So, if there was a delay of 15 ns, the answer is going to be valid between 15 ns and 25 ns. In this case, if you wait 2 clock cycles, you can grab the signal right in the middle of its valid period.
On the other hand, if the delay is 20 ns, the data is going to be valid from 20 ns to 30 ns. Now, if you grab the data at 20 ns, you'll be picking the front edge, and if you grab it at 30 ns, you'll pick the back edge. Neither is very reliable. So, the solution is to add an additional 5 ns delay in the address/control outputs using the IODELAY options of the output pads. This means the data will be valid between 25ns and 35 ns, and if you grab it at the 30 ns clock edge, you'll be in the middle again.
So, you need to pick the correct edge to read the data, and then you need to apply some additional output delay to make sure you read it in the middle of the valid interval. Lacking sophisticated simulations or high speed oscilloscopes, this can be done with a little bit of trial and error. Once you have established the correct cycle, you can move the IODELAY back and forth to find the edges of stability, and then pick a value in the middle.