Page 410 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 410
input screen; // screen==0 - 알람 x, 현재 시간
// screen==1 - pos로 알람 맞추기, 현재 시간 맞추기 등.
input pos; // screen==1일 때 여러가지 동작
input off_alarm; //알람이 울릴 때 끄는 기능
output sw_off;
output reg [7:0] hour,min,sec; // 현재 시,분,초
output reg [7:0] hour_a=1; // 알람 시,분
output reg [7:0] min_a;
output reg apm, a_apm; // apm == 0 - 오전 , apm == 1 - 오후
output reg [3:0] vpos;
output reg a_flag; // a_flag==1이면 알람이 울림
output reg music_sel=0;
reg [25:0] cnt_delay_1sec; // 알람 초세는것
wire plus_b, pos_b, off_b; // sw_m_b-분 sw_h_b-시 (스위치 디버깅 변수)
reg sw_off=0;
integer delay_60sec; // 시스템적 1초가 세어졌을 때 나타내는 것
integer del;
parameter SEC = 5399999;
// pos 0 : 알람 시간
// pos 1 : 알람 분
// pos 2 : 노래 선정
// pos 3 : 현재 시간
// pos 4 : 현재 분
// pos 5 : 동작
sw_test u0(clk, rst, plus, plus_b);
sw_test u1(clk, rst, pos, pos_b);
sw_test u2(clk, rst, off_alarm, off_b);
always @ (posedge clk, negedge rst) //pos 스위치 눌렀을 때
begin
if(!rst) vpos<=0;
else
begin
if(pos_b==1)
begin
if(vpos==5) vpos<=0;
else vpos<=vpos+1;
end
- 403 -