A
alieeldin
Guest
Dette er programmet for VGA, men at arbejde fortælle mig den logiske fejl
-------------------------------------------------- ---------------------------
modul FF (red_out, clk50, green_out, blue_out, hs_out, vs_out);
input clk50;
output red_out;
output green_out;
output blue_out;
output hs_out;
output vs_out;
reg red_out;
reg green_out;
reg blue_out;
reg hs_out;
reg vs_out;
reg clk25;
reg [9:0] horizontal_counter;
reg [9:0] vertical_counter;
altid @ (posedge clk50)
begynd
if (clk50) begynder
clk25 <= clk25 ^ 1'b1;
ende
endealtid @ (posedge clk25)
begynd
if (clk25) begynder
if (horizontal_counter> = 10'b0010010000
& & Horizontal_counter <10'b1100010000
& & Vertical_counter> = 10'b0000100111
& & Vertical_counter <10'b1000000111)
begynd
red_out <= horizontal_counter [3]
& Vertical_counter [3];
green_out <= horizontal_counter [4]
& Vertical_counter [4];
blue_out <= horizontal_counter [5]
& Vertical_counter [5];
ende
ellers begynder
red_out <= 1'b0;
green_out <= 1'b0;
blue_out <= 1'b0;
ende
if (horizontal_counter> 10'b0000000000
& & Horizontal_counter <10'b0001100001)
hs_out <= 1'b0;
anden
hs_out <= 1'b1;
if (vertical_counter> 10'b0000000000
& & Vertical_counter <10'b0000000011)
vs_out <= 1'b0;
anden
vs_out <= 1'b1;
horizontal_counter <= horizontal_counter 10 b0000000001;
if (horizontal_counter == 10'b1100100000) begynder
vertical_counter <= vertical_counter 10 b0000000001;
horizontal_counter <= 10'b0000000000;
ende
if (vertical_counter == 10'b1000001001)
vertical_counter <= 10'b0000000000;
ende
ende
endmodule
-------------------------------------------------- -----------------------------
-------------------------------------------------- ---------------------------
modul FF (red_out, clk50, green_out, blue_out, hs_out, vs_out);
input clk50;
output red_out;
output green_out;
output blue_out;
output hs_out;
output vs_out;
reg red_out;
reg green_out;
reg blue_out;
reg hs_out;
reg vs_out;
reg clk25;
reg [9:0] horizontal_counter;
reg [9:0] vertical_counter;
altid @ (posedge clk50)
begynd
if (clk50) begynder
clk25 <= clk25 ^ 1'b1;
ende
endealtid @ (posedge clk25)
begynd
if (clk25) begynder
if (horizontal_counter> = 10'b0010010000
& & Horizontal_counter <10'b1100010000
& & Vertical_counter> = 10'b0000100111
& & Vertical_counter <10'b1000000111)
begynd
red_out <= horizontal_counter [3]
& Vertical_counter [3];
green_out <= horizontal_counter [4]
& Vertical_counter [4];
blue_out <= horizontal_counter [5]
& Vertical_counter [5];
ende
ellers begynder
red_out <= 1'b0;
green_out <= 1'b0;
blue_out <= 1'b0;
ende
if (horizontal_counter> 10'b0000000000
& & Horizontal_counter <10'b0001100001)
hs_out <= 1'b0;
anden
hs_out <= 1'b1;
if (vertical_counter> 10'b0000000000
& & Vertical_counter <10'b0000000011)
vs_out <= 1'b0;
anden
vs_out <= 1'b1;
horizontal_counter <= horizontal_counter 10 b0000000001;
if (horizontal_counter == 10'b1100100000) begynder
vertical_counter <= vertical_counter 10 b0000000001;
horizontal_counter <= 10'b0000000000;
ende
if (vertical_counter == 10'b1000001001)
vertical_counter <= 10'b0000000000;
ende
ende
endmodule
-------------------------------------------------- -----------------------------