Stream static VGA from with DE2-115 or P123-A7?
Rayman
Posts: 14,762
Just thinking about ways to display a static image from HUB RAM to the VGA connector on my DE2-115 P2 adapter board...
Got 256 kB of RAM, should be enough for a 4 bpp image at 640x480.
Clock is 50 MHz and VGA is 25 MHz, so should be able to do 2 instructions in REP loop, right?
We also have new nibble instructions (I think) that should help.
Think I can use the LUT to expand the 4 bpp image into 24 bpp colors.
Would the streamer help with this?
Seems like it should, but I've got no idea how it works...
Did Baggers already get this working?
Got 256 kB of RAM, should be enough for a 4 bpp image at 640x480.
Clock is 50 MHz and VGA is 25 MHz, so should be able to do 2 instructions in REP loop, right?
We also have new nibble instructions (I think) that should help.
Think I can use the LUT to expand the 4 bpp image into 24 bpp colors.
Would the streamer help with this?
Seems like it should, but I've got no idea how it works...
Did Baggers already get this working?
Comments
Not quite, IIRC streamer has a NCO clock, so you simply set to /2
Good question, this is where Streamer LUT details get interesting.
IIRC it used to be just 8 bits, but there are cases where the streamer could benefit from other simple LUT lookup mappings:
1) Your case of 4b would do 8 reads per LUT line
2) Also useful is 5 reads of 6b, for a 25% memory gain.
2b) or, 6 reads of 5 bits
for 2,2b, Upper 2 bits per Long can be LUT:Page
3) Possible 4 reads of 7b, with choice of 4x128 tables in upper 2 bits.
4) 4 reads of 8 bits, 1 x 256L table
5) 3 reads of 9 bits could index the whole LUT 1 x 512L
Some Equations are:
2^19-800*480*4/8 = 332288
2^19-800*480*5*32/30/8 = 268288 - 4 x 32L tables
2^19-800*480*6*32/30/8 = 217088 - 4 x 64L tables
2^19-800*480*8/8 = 140288 - also covers 7b, 4 pages
2^19-800*600*4/8 = 284288
2^19-800*600*5*32/30/8 = 204288 - 4 x 32L tables
2^19-800*600*6*32/30/8 = 140288 - 4 x 64L tables
2^19-800*600*8/8 = 44288 - also covers 7b, 4 pages
The 6bit LUT gives quite a gain in spare memory
Edit: added 6 reads of 5 bits for completeness
Have a look at the sine/cosine demo, where the sine and cosine values are packed in separate blocks of bits in the LUT. So far we don't have documentation on xcont, so I'm sure there will be other modes, but even the mode we have will be good for video generation
OzPropDev and I were able to get a simple ntsc greyscale scan line out and display it on a monitor, by adding porches and a h sync signal. VGA wouldn't be any more complicated. My concern is the full scale DAC resistor may need to be lower to allow sufficient NTSC signal range
That might make it a lot harder...
Still can go for ModeX at 320x240 and use a full byte per pixel...
Why ? the streamer needs no opcodes, it works like DMA from the Memory image.
You set it once per line.
But I don't think we'll have any timing issues even at 25mips.
Here's the code Tubular and myself were playing with.
Basically modifies Chips sine wave data to include some video sync levels.
Output looks pretty good on the scop and some monitors will display it too.
We just gave it an extra wide front and back porch, and h sync signal, enough to get it on the monitor.
Note the 4k Ifs resistor on the dac may need to change to allow a large enough range for ntsc/pal
Didn't take a screen shot at the time, idiotically... sorry. Soon
Wikipedia says you can do an inverse Goertzel to make a sine wave.
But, this doesn't appear to be what's going on here...
This looks like just outputting from LUT to DACs in a loop...
Even if we only have 256kB on the de2 and not enough room for a full 640x480 at 8 bits, we only need to populate part of the screen to prove that it is working. Remember, the A9 will have a full 1MB in hub!!!:)!!!