design of digital clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · ppt...

21
Design of Digital Clock ( 디디디 디디디 디디 ) 디디디디디디 ||| 3디 디디디 디디디 디디디

Upload: phamnga

Post on 13-May-2018

225 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

Design of Digital Clock ( 디지털 시계의 설계 )

정보통신실험 ||| 3 조 황용석 박주남 정진안

Page 2: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

개 요

1. Digital Clock 의 이론 및 구성2. 시계의 VHDL Source Program 3. Timing Simulation4. 동작과정 분석 , 구현

Page 3: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

1. Digital Clock 의 이론 및 구성 1 초 발생기 (Seconder) ; 1MHz 분주기

클럭주기가 1MHz 인 입력을 받아서 1000000번이 경과되면 1 초가 되도록 설계한다 .

컴포넌트 : sep.vhd 초의 2 자리 수를 각 자리수로 분리한다 .

60 진 Second_Count, 0~59….s_clk 60 진 Minute_Count, 0~59….m_clk 24 진 Hour_Count, 0~23…..h_clk

Page 4: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

1. Digital Clock 의 이론 및 구성 Digital_Clock Block Diagram

o

Second_genCL

RST

s_s:SEP

s_m:SEP

s_h:SEP

function dis_seg

s1s10

m1m10

h1h10

SEG1

SEG2

SEG3

SEG4

SEG5

SEG6

one

ten

one

ten

one

ten

SECOND_COUNT

MINUTE_COUNT

HOUR_COUNT

s_clk

m_clk

h_clk

sec

min

hour

시간

분 초

Page 5: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

• 시계의 표시는 총 7 개의 7-SEGMENT 로 구성 되어 있다 .

1.1 표시방법

Page 6: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

2. 시계의 VHDL Source Program

1. sep.vhd: 초의 2 자리 수를 각 자리수로

분리하는데 사용한다 . 2. 1 초 발생기 : Seconder.vhd 3. Digital Clock.vhd

Page 7: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

2. sep.vhd: 초의 2 자리 수를 각 자리수로 분리하는데 사용한다 .

LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY SEP IS PORT(T :IN INTEGER RANGE 0 TO 59; TEN , ONE :OUT INTEGER RANGE 0 TO 9); END SEP; ARCHITECTURE BEHAV OF SEP IS BEGIN PROCESS(T) BEGIN IF T <=9 THEN TEN <=0; ONE <=T; ELSIF T <=19 THEN TEN <=1; ONE <=T-10; ELSIF T <=29 THEN TEN <=2; ONE <=T-20; ELSIF T <=39 THEN TEN <=3; ONE <=T-30; ELSIF T <=49 THEN TEN <=4; ONE <=T-40; ELSIF T <=59 THEN TEN <=5; ONE <=T-50; ELSE TEN <=0; ONE <=0; END IF; END PROCESS; END BEHAV;

Page 8: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

3. Sep.vhd 의 타이밍 시뮬레이션결과

6bit = 0~63

일자리 부분 10 자리부분

Page 9: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

2. 1 초 발생기 : Seconder.vhd LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY SECONDER IS PORT(CL, RST : IN STD_LOGIC; SEG5,SEG6 : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)); END SECONDER; ARCHITECTURE MIXED OF SECONDER IS

FUNCTION DIS_SEG(CNT : INTEGER RANGE 0 TO 15) RETURN STD_LOGIC_VECTOR IS VARIABLE SEG_DEC : STD_LOGIC_VECTOR (7 DOWNTO 0); BEGIN CASE CNT IS when 0 => seg_dec := "11000000"; when 1 => seg_dec := "11111001"; when 2 => seg_dec := "10100100"; when 3 => seg_dec := "10110000"; when 4 => seg_dec := "10011001"; when 5 => seg_dec := "10010010"; when 6 => seg_dec := "10000010"; when 7 => seg_dec := "11011000"; when 8 => seg_dec := "10000000"; when 9 => seg_dec := "10011000"; when others => seg_dec := "11111111"; END CASE;

Page 10: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

RETURN(SEG_DEC); END DIS_SEG;

SIGNAL SEC : INTEGER RANGE 0 TO 59; SIGNAL S10,S1 : INTEGER RANGE 0 TO 9; SIGNAL CNTS : INTEGER RANGE 0 TO 499999; SIGNAL S_CLK : STD_LOGIC;

COMPONENT SEP PORT(T : IN INTEGER RANGE 0 TO 59; TEN,ONE : OUT INTEGER RANGE 0 TO 9); END COMPONENT;

BEGIN

SECOND_GEN : PROCESS(CL,RST) BEGIN IF (RST ='1')THEN CNTS <=0; S_CLK <='0'; ELSIF (CL = '1' AND CL'EVENT) THEN IF (CNTS>=499999) THEN CNTS <=0; S_CLK <= NOT (S_CLK); ELSE CNTS <=CNTS +1; END IF; END IF; END PROCESS SECOND_GEN;

2. 1 초 발생기 : Seconder.vhd

Page 11: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

2. 1 초 발생기 : Seconder.vhd

SECOND_COUNT : PROCESS(S_CLK, RST) BEGIN IF (RST ='1')THEN SEC <= 0; ELSIF (S_CLK ='1' AND S_CLK'EVENT)THEN IF (SEC >= 59)THEN SEC <= 0; ELSE SEC <=SEC+1; END IF; END IF; END PROCESS SECOND_COUNT;

S_S :SEP PORT MAP (SEC,S10,S1); SEG5 <= DIS_SEG(S10); SEG6 <= DIS_SEG(S1); END MIXED;

Page 12: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

3. Seconder 의 타이밍 시뮬레이션결과

LED 9

10 자리 분 LED 1

자리수 분리를 보여준다 .

Page 13: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

3. Digital Clock library ieee; use ieee.std_logic_1164.all; entity digi_clock is port(cl, rst : in std_logic; seg1, seg2, seg3, seg4, seg5, seg6 : out std_logic_vector(7 downto 0)); end digi_clock; architecture mixed of digi_clock is function dis_seg(cnt : integer range 0 to 15) return std_logic_vector is variable seg_dec : std_logic_vector(7 downto 0); begin case cnt is when 0 => seg_dec := "11000000"; when 1 => seg_dec := "11111001"; when 2 => seg_dec := "10100100"; when 3 => seg_dec := "10110000"; when 4 => seg_dec := "10011001"; when 5 => seg_dec := "10010010"; when 6 => seg_dec := "10000010"; when 7 => seg_dec := "11011000"; when 8 => seg_dec := "10000000"; when 9 => seg_dec := "10011000"; when others => seg_dec := "1111111

1"; end case;

Page 14: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

3. Digital Clock return(seg_dec); end dis_seg; signal hour, min, sec : integer range 0 to 59; signal h10,h1, m10, m1, s10, s1 : integer range 0 to 9; signal cnts : integer range 0 to 499999; signal s_clk, m_clk, h_clk : std_logic; component sep port(t : in integer range 0 to 59; ten, one : out integer range 0 to 9); end component;

begin second_gen : process(cl, rst) begin if (rst = '1') then cnts <= 0; s_clk <= '0'; elsif (cl = '1' and cl'event)then if (cnts >= 499999) then cnts <= 0; s_clk <= not(s_clk);

else cnts <= cnts + 1; end if; end if; end process second_gen; end process second_gen;

Page 15: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

3. Digital Clock second_count : process(s_clk, rst) begin if (rst = '1') then sec <= 0; elsif (s_clk = '1' and s_clk'event)then if (sec = 59) then m_clk <= '1'; sec <= 0; else sec <= sec+1; m_clk <= '0'; end if; end if; end process second_count;

minute_count : process(m_clk, rst) begin if (rst = '1') then min <= 0; elsif (m_clk = '1' and m_clk'event)then if (min >= 59) then h_clk <='1'; min <= 0; else min <= min + 1; h_clk

<= '0'; end if; end if; end process minute_count;

Page 16: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

3. Digital Clock hour_count : process(h_clk, rst) begin if (rst = '1') then hour <=0; elsif (h_clk = '1' and h_clk'event) then if (hour >= 23) then hour <=0; else

hour <= hour + 1; end if; end if; end process hour_count; s_s : sep port map(sec, s10, s1); s_m : sep port map(min, m10, m1); s_h : sep port map(hour, h10, h1); seg1 <= dis_seg(h10); seg2 <= dis_seg(h1); seg3 <= dis_seg(m10); seg4 <= dis_seg(m1); seg5 <= dis_seg(s10); seg6 <= dis_seg(s1); end mixed;

Page 17: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

3. Digital Clock 타이밍 시뮬레이션 결과

59 초가 되자 1 분이된다 .

Page 18: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

3. Digital Clock 타이밍 시뮬레이션 결과

S_CLK 60 카운터에서 분증가

Page 19: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

4. 디지털 시계의 FPGA 구현VHDL SOURCE , PROGRAMING

Assign =>Pin/Location/chip..

Page 20: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

4. 디지털 시계의 FPGA 구현

입력 출력 핀번호

91

RST

CL

41

핀번호

SEG50~SEG57

SEG60~SEG67

Page 21: Design of Digital Clock (디지털 시계의 )cfs5.tistory.com/upload_control/download.… · PPT file · Web view · 2015-01-22Design of Digital Clock (디지털 시계의 설계)

4. 디지털 시계의 FPGA 구현 SEG5 : SEG610 자리초 : 1 자리초

클럭에 따른 60 진SECOND_COUNT보여준다 .