I have a couple of questions about the 2 ports RAM, the Intel documentation is confusing for a noob like me.
1. I understand that the rising edge of wrclk latches the data and address in and the falling edge writes it to the RAM, is that correct? So my video sampling clock should be basically the rising edge of wrclk?
2. Can I avoid using the wren and rden and just tie them to Vcc? I could point to an address out of the visible space when the counter is out of the visible area.
Edit: In the screen shots, CH1 is clock, CH3 is one pixel. I've added one more screen shot that shows the two digital signals (PIX and INT) that make the analog video (VID).
Edit1: I corrected a mistake in question #1, wrclk instead of wren.
Use the dual port ram in dual clock mode. Don't worry about when the write takes place, just that the data will be in the ram by the time your next clock rises. In other words, if the maximum theoretical clock for the Cyclone ram is 200MHz and you are running at 200 MHz, the byte will be written by the next clock. If you are running the ram at 1 MHz, just rest assures that the data will be in the ram with 5ns after the rising clock. (This doesn't have anything to do with the IO pins input setup and hold times... I expect you are D-latching those and using the 'fast input registers' assignment for the best performance.)
Just make note that if you are reading the same address at the same time you are writing to the same address, this is when you will need to worry about timing and memory contents.
Instead, make your design so that the video output is at least 1 line of video behind the source video coming in and you will never have to worry about a write to read collision since you will never be reading the same address which you may be writing to. In other words, completely avoid the problem all together.
Now, if you want to do linear filtering on the vertical stretching of the source video, this means you need access to adjacent lines of video to variably blend/mix together with the appropriate proportions, this is how I would do it:
a) Make 2 line buffer banks with enough storage for multiple lines of video in each. (8 lines of video in each buffer should work, where you keep on filling the lines in circles in the buffer as the picture continues to come in. 8 lines is good if you have a clean ratio of input lines to output line on on the LCD display timing. You may need to increase this buffer is the beginning and ending input and output times from source to LCD stretches out to an odd fraction of time.)
b) On the source video sampling side, incrementally write to 1 bank only the even source video lines and use the other line buffer bank for the odd line of source video.
c) On the video output side, read the appropriate odd and even line buffers in parallel simultaneously, proportionally selecting the right blending mix in real time rendering a smooth filtered Y transition as you draw multiple output lines for the 768 lines of the LCD module for every pair of source sampled video input data.
Hard wiring the read enable is valid.
To help visualize how a typical dual port ram may look, see here:
(This memory has the clocked/latched address inputs and latched data outputs feature on. It is the fastest and cleanest configuration of memory for FPGA offering the fastest clock performance)
However, in your design, you will configure 2 of these, each with 1 write port and 1 read port so that 1 of the 2 will store exclusively all of the source even lines of video and the other will store only the odd lines of video. (Only if you want to do a linear/cubic Y filtering feature, otherwise, you only need one of these ram buffers which will store both the even an odd video lines from the source video)
For the write side, it's clock, address, data & write enables will operate exclusively on your source video's sampling clock.
For the read side, it's clock & address generator will operate exclusively on your VGA 1024x768 55Mhz output clock.
When rendering the VGA output, remember to start the picture output only after the first 2-3 lines of video have already been captured. This means to vertically center your output picture on the LCD, you may need to artificially shift the V-sync output depending on the LCD interface specifications. If you have a really odd fraction of timing between the 2 display between the beginning and ending a frame, you will need to further offset this number of video lines of lag between the source video and output video.