12.07.2015 Views

VGA Signal Generation with the XS Board - Xess

VGA Signal Generation with the XS Board - Xess

VGA Signal Generation with the XS Board - Xess

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

058- pblank.ACLR = reset;059- pblank.CLK = clock;060- pblank := blank;061-062- "video RAM control signals063- csb = 0; "enable <strong>the</strong> RAM064- web = 1; "disable writing to <strong>the</strong> RAM065- oeb = blank; "enable <strong>the</strong> RAM outputs when video is not blanked066- "<strong>the</strong> video RAM address is built from <strong>the</strong> lower 9 bits of <strong>the</strong> vertical067- "line counter and bits 7-2 of <strong>the</strong> horizontal column counter.068- "Each byte of <strong>the</strong> RAM contains four 2-bit pixels. As an example,069- "<strong>the</strong> byte at address ^h1234=^b0001,0010,0011,0100 contains <strong>the</strong> pixels070- "at (row,col) of (^h048,^hD0),(^h048,^hD1),(^h048,^hD2),(^h048,^hD3).071- vram_addr = [vcnt8..vcnt0,hcnt7..hcnt2];072-073- pixrg.ACLR = reset; "clear pixel register on reset074- pixrg.CLK = clock; "pixel clock controls changes in pixel register075- "<strong>the</strong> pixel register is loaded <strong>with</strong> <strong>the</strong> byte from <strong>the</strong> video RAM location076- "when <strong>the</strong> lower two bits of <strong>the</strong> horizontal counter are both zero.077- "The active pixel is in <strong>the</strong> lower two bits of <strong>the</strong> pixel register.078- "For <strong>the</strong> next 3 clocks, <strong>the</strong> pixel register is right-shifted by two bits079- "to bring <strong>the</strong> o<strong>the</strong>r pixels in <strong>the</strong> register into <strong>the</strong> active position.080- WHEN ([hcnt1..hcnt0]==^b00)081- THEN pixrg := vram_data "load 4 pixels from RAM082- ELSE pixrg := [0,0,pixrg7..pixrg2]; "right-shift pixel register 2 bits083-084- "color mapper that translates each 2-bit pixel into a 6-bit RGB value.085- "when <strong>the</strong> video signal is blanked, <strong>the</strong> RGB value is forced to 0.086- rgb.ACLR = reset;087- rgb.CLK = clock;088- TRUTH_TABLE ([pblank, pixel] :> rgb)089- [ 0 ,^b00 ] :> ^b110000;090- [ 0 ,^b01 ] :> ^b001100;091- [ 0 ,^b10 ] :> ^b000011;092- [ 0 ,^b11 ] :> ^b111111;093- [ 1 ,^b00 ] :> ^b000000;094- [ 1 ,^b01 ] :> ^b000000;095- [ 1 ,^b10 ] :> ^b000000;096- [ 1 ,^b11 ] :> ^b000000;097-098- END <strong>VGA</strong>COREListing 2: ABEL code for a <strong>VGA</strong> signal generator.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!