by hamster » Thu Sep 30, 2010 9:02 pm
Hi Jotta,
To get the gist, the easy example is the vsync generator.
The first (9: 0) is the next state which feeds back into the BRAM's address, with (4 :1) also provides the row number for the character ROM - it uses double scan. (9:5) is the "text Y coordinate". (10) is the vsync, and (11) is the vertical blanking signal
So an initialisation table like:
01000000001
01000000010
01000000011
01000000100
01000000101
11000000110
10000000111
10000001000
11000001001
11000001010
01000000000
...has a period of 11 rows, with vertical blanking from rows 6 through 10, and a negative sync pulse for rows 7 & 8. For the first 6 rows the row fed into the character generator is 0,0,1,1,2,2. As (9:5) is all zeros this is all on text row 0.
When you are using 8x10 characters, I skip 6 states to keep everything in step.
It is just a little confusing as the state on the outputs out of sync by one cycle from what you would expect (hence why the blanking is turned off on the final row).
The table controlling hsync has a few more bits (like when to enable the clocking of the vsync generator), but is pretty much the same.
I found that the best way to generate the tables was with a small program...