module input2vga(OSC_50,VGA_CLK,VGA_HS,VGA_VS,VGA_BLANK,VGA_SYNC,VGA_R,VGA_B,VGA_G,VGG)
input OSC_50;
output VGA_CLK,VGA_HS,VGA_VS,VGA_BLANK,VGA_SYNC;
output [9:0] VGA_R,VGA_B,VGA_G;
parameterH_FRONT = 16;
parameterH_SYNC = 96;
parameterH_BACK = 48;
parameterH_ACT = 640;
parameterH_BLANK = H_FRONT+H_SYNC+H_BACK;
parameterH_TOTAL = H_FRONT+H_SYNC+H_BACK+H_ACT;
parameterV_FRONT = 11;
parameterV_SYNC = 2;
parameterV_BACK = 31;
parameterV_ACT = 480;
parameterV_BLANK = V_FRONT+V_SYNC+V_BACK;
parameterV_TOTAL = V_FRONT+V_SYNC+V_BACK+V_ACT;
reg [10:0] H_Cont;
reg [10:0] V_Cont;
wire [7:0] VGA_R;
wire [7:0] VGA_G;
wire [7:0] VGA_B;
reg VGA_HS;
reg VGA_VS;
reg [10:0] X;
reg [10:0] Y;
reg CLK_25;
always@(posedge OSC_50)
begin CLK_25=~CLK_25;
end
assign VGA_SYNC = 1'b0;
assign VGA_BLANK = ~((H_Cont<H_BLANK)||(V_Cont<V_BLANK));
assign VGA_CLK = ~CLK_to_DAC;
assign CLK_to_DAC = CLK_25;
always@(posedge CLK_to_DAC)
begin
if(H_Cont<H_TOTAL)
H_Cont<=H_Cont+1'b1;
else H_Cont<=0;
if(H_Cont==H_FRONT-1)
VGA_HS<=1'b0;
if(H_Cont==H_FRONT+H_SYNC-1)
VGA_HS<=1'b1;
if(H_Cont>=H_BLANK)
X<=H_Cont-H_BLANK;
else X<=0;
end
always@(posedge VGA_HS)
begin
if(V_Cont<V_TOTAL)
V_Cont<=V_Cont+1'b1;
else V_Cont<=0;
if(V_Cont==V_FRONT-1)
VGA_VS<=1'b0;
if(V_Cont==V_FRONT+V_SYNC-1)
VGA_VS<=1'b1;
if(V_Cont>=V_BLANK)
Y<=V_Cont-V_BLANK;
else Y<=0;
end
reg valid_yr;
always@(posedge CLK_to_DAC)
if(V_Cont == 10'd32)
valid_yr<=1'b1;
else if(V_Cont==10'd512)
valid_yr<=1'b0;
wire valid_y=valid_yr;
reg valid_r;
always@(posedge CLK_to_DAC)
if((H_Cont == 10'd32)&&valid_y)
valid_r<=1'b1;
else if((H_Cont==10'd512)&&valid_y)
valid_r<=1'b0;
wire valid = valid_r;
wire[10:0] x_dis;
wire[10:0] y_dis;
assign x_dis=X;
assign y_dis=Y;
parameter
char_line00=272'h000000000000000000000000000000000000000000000000000000000000 00000000,
char_line01=272'h000000000000000000000000000000000000000000000000000000000000 00000000,
char_line02=272'h00400C0000000000000000000000000000C008000000000000000000000 000000000,
char_line03=272'h00700E0000000180000000000000000000E00C000000000000000080018 0000000C0,
char_line04=272'h00600C00000003C0000000000000000000C01C0000000000000000FFFF 80000001E0,
char_line05=272'h00600C3003FFFC000000000000000080008018000000000000800080018 003FFFE00,
char_line06=272'h1FFFFFF8000180007FFE7FF003C80380008018007C1F03C8038000800 18000000000,
char_line07=272'h00600C0000018000180E18180E3803800104301018040E3803800080018 000000000,
char_line08=272'h00600C00000180001802180C080803800FFE30381804080803800080018 000000000,
char_line09=272'h00600C000001800018031806180802800C0C7FF818041808028000FFFF 8000000000,
char_line0a=272'h007FFC000001800018011806300406C00C0C60300C08300406C0008001 8000000000,
char_line0b=272'h00600C000001800018001806300404C00C0CC0300C08300404C000800 18000000018,
char_line0c=272'h00600C000001801018081806200004C00C0C80300C08200004C0008001 800000003C,
char_line0d=272'h007FFC000001803818081806600004C00C0D00300C08600004C000800 1803FFFFFFE,
char_line0e=272'h00600C003FFFFFFC1818180C60000C600C0D4030061060000C6000FF FF8000018000,
char_line0f=272'h00600C10000180001FF81818600008600C0E20300610600008600080010 000018000,
char_line10=272'h00600C380001800018181FF0600008600C0C1030061060000860000820 0000418000,
char_line11=272'h3FFFFFFC0001800018081800600008600FFC1830073060000860000C38 2000718800,
char_line12=272'h003208000001800018081800603F1FF00C0C18300320603F1FF0080C30 7000E18600,
char_line13=272'h00618C000001800018001800600C10300C0C0C300320600C10300C0C3 07000C18300,
char_line14=272'h00C106000001800018001800600C10300C0C08300320600C1030060C30 C001818180,
char_line15=272'h018101C00001800018001800300C10300C0C003001C0300C1030030C3 0C0038180C0,
char_line16=272'h030104FC0001800018001800300C30300C0C003001C0300C3030038C3 18003018060,
char_line17=272'h0C010E380001800018001800180C20180C0C003001C0180C2018018C3 30006018070,
char_line18=272'h187FF0000001800018001800180C20180C0C003001C0180C2018018C3 6000C018038,
char_line19=272'h6001000000018000180018000C1060180C0C003000800C106018008C38 0018018038,
char_line1a=272'h00010000000180007E007E0003E0F83E0C0C0030008003E0F83E000C3 01010018010,
char_line1b=272'h00010000003F800000000000000000000FFC0C60000000000000000C30 3820738000,
char_line1c=272'h00010060000F800000000000000000000C0C03E00000000000001FFFFF FC001F8000,
char_line1d=272'h1FFFFFF00007000000000000000000000C0801C0000000000000000000 0000070000,
char_line1e=272'h000000000000000000000000000000000000008000000000000000000000 00020000,
char_line1f=272'h000000000000000000000000000000000000000000000000000000000000 00000000;
reg[8:0] char_bit;
always@(posedge CLK_to_DAC)
if(X==10'd144)<=9'd272;
else if(X>10'd144&&X<10'd416)
char_bit<=char_bit-1'b1;
reg[29:0] vga_rgb;
always@(posedge CLK_to_DAC)
if(X>10'd144&&X<10'd416)
begin case(Y)
10'd160:
if(char_line00[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd162:
if(char_line01[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd163:
if(char_line02[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd164:
if(char_line03[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd165:
if(char_line04[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd166:
if(char_line05[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd167:
if(char_line06[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd168:
if(char_line07[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd169:
if(char_line08[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd170:
if(char_line09[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd171:
if(char_line0a[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd172:
if(char_line0b[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd173:
if(char_line0c[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd174:
if(char_line0d[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd175:
if(char_line0e[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd176:
if(char_line0f[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd177:
if(char_line10[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd178:
if(char_line11[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd179:
if(char_line12[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd180:
if(char_line13[char_bit])vga_rgb<=30'b1111111111_0000000000_0000000000;
else vga_rgb<=30'b0000000000_0000000000_0000000000;
10'd181:
i