DE0-nano에 LemonLite RGB 보드 사용

모니터 마다 해상도 출력이 좀 다른데 머가 문제일까..

일단 눈을 띄우는데는 성공했으니 뭐가 문제인지는 좀 찾아 봐야 할 듯..



vga640x480 vga(

CLOCK_50,

KEY[0],

LED,

GP0[6],

GP0[5],

{GP0[16],GP0[19],GP0[18],GP0[21]},

{GP0[12],GP0[15],GP0[14],GP0[17]},

{GP0[8],GP0[9],GP0[10],GP0[13]}

); 


module vga640x480(

input clk,

input rst,

output [7:0] LED,

output reg hsync,

output reg vsync,

output [3:0] r,

output [3:0] g,

output [3:0] b

);


reg clk25;

reg [9:0] horizontal_counter;

reg [9:0] vertical_counter;


reg [9:0] X;

reg [9:0] Y;


wire [7:0] red;

wire [7:0] green;

wire [7:0] blue;


assign r[3:0] = ((horizontal_counter >= 144) 

&& (horizontal_counter < 784) 

&& (vertical_counter >=39)

&& (vertical_counter < 519)) ? red : 4'b000; 

assign g[3:0] = ((horizontal_counter >= 144) 

&& (horizontal_counter < 784) 

&& (vertical_counter >=39)

&& (vertical_counter < 519)) ? green : 4'b000; 

assign b[3:0] = ((horizontal_counter >= 144) 

&& (horizontal_counter < 784) 

&& (vertical_counter >=39)

&& (vertical_counter < 519)) ? blue : 4'b000; 

assign red =   ((horizontal_counter >= 144)&&(horizontal_counter < 344) ) ? 4'b1111 : 4'b0000;

assign green = ((horizontal_counter >= 344)&&(horizontal_counter < 544) ) ? 4'b1111 : 4'b0000;

assign blue =  ((horizontal_counter >= 544)&&(horizontal_counter < 784) ) ? 4'b1111 : 4'b0000;


always @(posedge clk)

begin


if (clk25 == 0)

begin

   clk25 <= 1;

end   

else

begin

clk25 <= 0;

   end

end



always @(posedge clk25)

begin

if ((horizontal_counter > 0) && (horizontal_counter < 97))// -- 96+1

begin

hsync <= 0;

end

else

begin

hsync <= 1;

end 

if ((vertical_counter > 0 ) && (vertical_counter < 3 )) //-- 2+1

begin

vsync <= 0;

end

else

begin

vsync <= 1;

end

horizontal_counter <= horizontal_counter+1;

    

if (horizontal_counter == 800) 

begin

vertical_counter <= vertical_counter+1;

horizontal_counter <= 0;

end

    

if (vertical_counter == 521)

begin

vertical_counter <= 0;

end

end



endmodule  

[링크 : https://github.com/pmezydlo/DE0-Nano-SOC-VGA/blob/master/vgaram.v]

Posted by 구차니