Skip to content

Instantly share code, notes, and snippets.

@dekuNukem
Created March 9, 2016 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dekuNukem/1a45434203097ecfd0c9 to your computer and use it in GitHub Desktop.
Save dekuNukem/1a45434203097ecfd0c9 to your computer and use it in GitHub Desktop.
FAP attribute snippet
always @(posedge clk50)
begin
// inside active region
if ((vc >= vbp && vc < vfp) && (hc >= hbp && hc < hfp))
begin
front_vram_rd_low = 0;
hpos = hc - hbp;
vpos = vc - vbp;
hdot = hpos[2:0];
vdot = vpos[3:0];
hchar = hpos[9:3];
vchar = vpos[9:4];
if (fetch_attribute) begin
front_vram_addr = 80 * vchar + hchar;
attribute_data = front_vram_data;
end
else begin
front_vram_addr = 80 * vchar + hchar + 2400;
char_data = front_vram_data;
end
fetch_attribute = ~fetch_attribute;
red = font_pixel ? attribute_data[5:4] : 0;
green = font_pixel ? attribute_data[3:2] : 0;
blue = font_pixel ? attribute_data[1:0] : 0;
end
// outside active region
else
begin
fetch_attribute = 1;
front_vram_rd_low = 1;
front_vram_addr = 13'bzzzzzzzzzzzz;
red = 0;
green = 0;
blue = 0;
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment