Page 3 of 4

Re: Video/sprites for the 65org16 Dev. board

Posted: Fri Jun 08, 2012 5:19 am
by Arlet
ElEctric_EyE wrote:
EDIT: Added a larger pic just now, will take some time to update.
It's still small, but there are some loose signals on the bitmap module (trigger/odd) that need to be connected to the cs4954 module.

Re: Video/sprites for the 65org16 Dev. board

Posted: Fri Jun 08, 2012 12:33 pm
by ElEctric_EyE
Ok, the size issue should be fixed now.

I see I missed those 3 signals. I have more than a few questions on how to properly hook this up, so please bear with me.

1) Is the vid_we signal from the bitmap module routed correctly?
2) The pixel clock (pclk) from the CS4954 module goes to the bitmap module. The system/cpu clock goes to the clk inputs of the CS4954, SDRAM, and SDRAMIF modules?

Re: Video/sprites for the 65org16 Dev. board

Posted: Fri Jun 08, 2012 1:00 pm
by Arlet
ElEctric_EyE wrote:
Ok, the size issue should be fixed now.

1) Is the vid_we signal from the bitmap module routed correctly?
2) The pixel clock (pclk) from the CS4954 module goes to the bitmap module. The system/cpu clock goes to the clk inputs of the CS4954, SDRAM, and SDRAMIF modules?
The vid_we signal should go to the CS4954 module. It controls the vid_addr/vid_data bus.

The bitmap module runs on the system/cpu clock. The same clock goes to the clk input of the CS4954. A 54 MHz clock goes into the clk54 input, and a 27 MHz clock comes out of the pclk signal, which needs to go to the video clock output of the FPGA to the CS4954 chip.

Re: Video/sprites for the 65org16 Dev. board

Posted: Fri Jun 08, 2012 2:05 pm
by ElEctric_EyE
Excellent, thanks!

3) In the code for sdramif.v, there's a comment for the 'ctrl' input saying it's used for window control. It's related to the DI_CTRL[15:0]? How does this output work?

EDIT: N/M, I see 'ctrl' is related to the section you said to comment out for interfacing to an 16-bit cpu. So I don't need to use the DI_CTRL output? What is AB[15:0] used for?

Re: Video/sprites for the 65org16 Dev. board

Posted: Fri Jun 08, 2012 3:43 pm
by Arlet
ElEctric_EyE wrote:
3) In the code for sdramif.v, there's a comment for the 'ctrl' input saying it's used for window control. It's related to the DI_CTRL[15:0]? How does this output work?

EDIT: N/M, I see 'ctrl' is related to the section you said to comment out for interfacing to an 16-bit cpu. So I don't need to use the DI_CTRL output? What is AB[15:0] used for?
An 8 bit CPU, like the 6502, would first perform two byte writes to special control registers. These would be stored in ABH[15:8] and ABH[7:0], and set the SDRAM page. Then the CPU could do a bunch of accesses to page $A0xx, where the lower 8 bits of the address would be concatenated as follows:

Code: Select all

        sdram_addr <= { ABH, AB[7:0] };
With a 32 bit address bus, you could map the SDRAM to $A0xxxxxx instead. Remove ABH, and use:

Code: Select all

        sdram_addr <= AB[23:0] ;

Re: Video/sprites for the 65org16 Dev. board

Posted: Fri Jun 08, 2012 5:16 pm
by ElEctric_EyE
I have enough information to hook it all up now, thanks again for the help.

My project is reaching proportions now, that I can see I am going to have trouble fitting this video portion into my project in schematic form. My next challenge will have to be to learn how to create a top level in Verilog, instead of schematic before I can see any graphics. I can get some clues from ISE's HDL translation of my schematic, and also your main.v file.

Re: Video/sprites for the 65org16 Dev. board

Posted: Wed Jun 20, 2012 11:05 am
by ElEctric_EyE
Sorry, so many things going on in the summer months, with kids off from school I must keep them entertained for part of the day on my days off... Today I should be able to complete adding the 65Org16.b core, ZPRAM, STackRAM and a simple OSROM to your modules and hopefully see some video output. I've abandoned trying to merge my TFT project for now, with it's top level schematic. I think what will happen is I will slowly add parts of it in verilog to this new project...

Could you perchance post me your register settings for the CS4954 to save me some time?

Re: Video/sprites for the 65org16 Dev. board

Posted: Wed Jun 20, 2012 11:21 am
by Arlet
Here's my NTSC init:

Code: Select all

reg $00 = $12
reg $01 = $12
reg $03 = $01
reg $04 = $07
reg $05 = $78
reg $10 = $1C 
reg $11 = $3E
reg $12 = $F8
reg $13 = $E0
reg $14 = $43 

Re: Video/sprites for the 65org16 Dev. board

Posted: Wed Jun 20, 2012 12:56 pm
by ElEctric_EyE
Thanks for the quick response!
Just got done soldering in the SDRAM and .1uF bypass caps. Old TFT project, which was still loaded in FPGA FLASH, still boots up the TFT and color bars for S-Video meaning no power distribution/noise errors on this board. All other signals from FPGA to SDRAM are unused and therefore hi-impedance, except for the SDRAM /CS which I was forcing high. Taking baby steps here...

Re: Video/sprites for the 65org16 Dev. board

Posted: Wed Jun 20, 2012 6:01 pm
by ElEctric_EyE
I see your values are identical to the ones I used for the color bar test pattern. But, I thought the resolution had to be specified in order to set the appropriate HSYNC and VSYNC frequencies?

My design has passed synthesis, except for the timing constraint for the CPU. Looks close though... Running smartXplorer made it pass the 10ns constraint!

I guess this is a good initial observation that with this new design with your modules, the CS4954 is outputting color bar test pattern. So at least I know the address decoding is good, the CPU is running fine with your I2C routine, and the StackRAM and ZeroPageRAM are functioning.

Re: Video/sprites for the 65org16 Dev. board

Posted: Wed Jun 20, 2012 6:11 pm
by Arlet
ElEctric_EyE wrote:
But, I thought the resolution had to be specified in order to set the appropriate HSYNC and VSYNC frequencies?
The resolution from the CS4954 is always the same. I reduce the resolution in my test by adding a border, and/or pixel doubling (sending the same pixel twice).

Re: Video/sprites for the 65org16 Dev. board

Posted: Wed Jun 20, 2012 6:44 pm
by ElEctric_EyE
Ok, I suspected that as I didn't see any obvious registers to program. So anyway, when I disabled colorbar generation I have the beginning of graphics!!!! This is awesome when things come together so quickly. It's not perfect but most definately something to work with. I see the green border. The right half of the screen is black. Most of the left side is purple shades of pixels and on the very top, maybe 16 pixels tall, looks like regular random colored pixels one would expect. Working on getting a pic to post...

EDIT: Here it is. Bottom border is missing...
Image

Re: Video/sprites for the 65org16 Dev. board

Posted: Wed Jun 20, 2012 9:27 pm
by BigEd
This is looking like something! So, is the SDRAM involved at this point?

Re: Video/sprites for the 65org16 Dev. board

Posted: Wed Jun 20, 2012 10:06 pm
by Arlet
I suspect the right half of the screen is black, because the bitmap is only 256 pixels wide. In your schematic you didn't hook up the 'hstretch' input to the cs4954.v module. If you tie that input to '1', the bitmap will be stretch horizontally, and it should fill the entire screen.

As far as the missing bottom, that's probably because NTSC has fewer scanlines than PAL. You should be able to fix that by adjust 'height' in the cs4954.v module. Similarly, you can adjust 'top' and 'left' to adjust the borders, so you can center the active screen on your TV/monitor.

After that, you should try to write to SDRAM from the CPU, and see if you can write on the screen.

Re: Video/sprites for the 65org16 Dev. board

Posted: Wed Jun 20, 2012 10:15 pm
by Arlet
BigEd wrote:
This is looking like something! So, is the SDRAM involved at this point?
It certainly looks like the data is coming from SDRAM. If you compare the image to my first bitmap, it looks quite similar.
6502.org wrote:
Image no longer available: http://ladybug.xs4all.nl/arlet/fpga/sdram.jpg