하지만... 서브모듈화가 어렵네....;;;;
일단 실행하고 칩에 옮겨 심는것까지는 되었건만.... 후덜덜덜
| DE2_UserManual.pdf (4.02 MB) |
보드메뉴얼 | | Verilog와 DE2보드를 이용한 카운터.ppt (659.0 KB) |
프리젠테이션용 보고서 | | 카운터 최종 제안서.hwp (560.0 KB) |
제안서 |
닫기. Code Type : vhdl
module COUNTER (clk, reset, dis_seg, dis_led);
input clk;
input reset;
output reg [6:0] dis_seg;
output reg [9:0] dis_led;
reg realclock;
reg [28:0] q1;
reg [3:0] realq;
always @(posedge clk or negedge reset) begin
if (!reset)
begin
q1 <= 0;
realclock <= 0;
end
else
begin
if (q1 == 28'h2faf080)
//if (q1 == 28'h0000002)
begin
realclock <= 1;
q1 <= 0;
end
else
begin
realclock <= 0;
q1 <= q1 + 1;
end
end
end
always @(posedge realclock or negedge reset) begin
if (!reset)
begin
realq <= 0;
end
else
begin
if (realq == 10)
begin
realq <= 0;
end
else
begin
realq <= realq + 1;
end
end
end
// DISPSEG DISPSEG (clk, realq,dis_seg);
// DISPLED DISPLED (clk, realq,dis_led);
//
//endmodule
//module DISPSEG (clk,realq,dis_seg);
// input clk;
// input realq;
// output reg [6:0] dis_seg;
always @(posedge clk) begin
case(realq)
//0 : dis_seg <= 7'b1111110;
//1 : dis_seg <= 7'b0110000;
//2 : dis_seg <= 7'b1101101;
//3 : dis_seg <= 7'b1111001;
//4 : dis_seg <= 7'b0110011;
//5 : dis_seg <= 7'b1011011;
//6 : dis_seg <= 7'b1011111;
//7 : dis_seg <= 7'b1110000;
//8 : dis_seg <= 7'b1111111;
//9 : dis_seg <= 7'b1111011;
//default : dis_seg <= 7'b1111110;
0 : dis_seg <= 7'b0000001;
1 : dis_seg <= 7'b1001111;
2 : dis_seg <= 7'b0010010;
3 : dis_seg <= 7'b0000110;
4 : dis_seg <= 7'b1001100;
5 : dis_seg <= 7'b0100100;
6 : dis_seg <= 7'b0100000;
7 : dis_seg <= 7'b0001111;
8 : dis_seg <= 7'b0000000;
9 : dis_seg <= 7'b0000100;
default : dis_seg <= 7'b1111110;
endcase
end
//endmodule
//module DISPLED (clk,realq,dis_led);
// input clk;
// input realq;
// output reg [9:0] dis_led;
always @(posedge clk) begin
case(realq)
0 : dis_led <= 9'b000000000;
1 : dis_led <= 9'b000000001;
2 : dis_led <= 9'b000000011;
3 : dis_led <= 9'b000000111;
4 : dis_led <= 9'b000001111;
5 : dis_led <= 9'b000011111;
6 : dis_led <= 9'b000111111;
7 : dis_led <= 9'b001111111;
8 : dis_led <= 9'b011111111;
9 : dis_led <= 9'b111111111;
default : dis_led <= 9'b000111000;
endcase
end
endmodule
닫기.