53
1 2006. 3. 이이이 ([email protected]) Digital System Design

Digital System Design

  • Upload
    wren

  • View
    79

  • Download
    0

Embed Size (px)

DESCRIPTION

Digital System Design. 2006. 3. 이숙윤 ([email protected]). 60 ~ 70 년대. 80 년대. 90 년대 - 현재. 설계 방법. Transistor Level Bottom Up. Gate Level (Top Down + Bottom Up). Algorithm, Function Level Top Down. 설계 도구. Layout Editor. Schematic Editor. HDL Synthesizer. 설계 범위. 1K Gate 이하 - PowerPoint PPT Presentation

Citation preview

Page 1: Digital System Design

1

2006. 3.

이숙윤 ([email protected])

Digital System Design

Page 2: Digital System Design

2

VHDL(Very High Speed IC Hardware Description Language)

설계환경의 변화

60 ~ 70 년대60 ~ 70 년대 80 년대80 년대 90 년대 - 현재90 년대 - 현재

설계 방법설계 방법 Transistor LevelBottom Up

Transistor LevelBottom Up

Gate Level(Top Down + Bottom Up)

Gate Level(Top Down + Bottom Up)

Algorithm,Function Level

Top Down

Algorithm,Function Level

Top Down

설계 도구설계 도구 Layout EditorLayout Editor Schematic EditorSchematic Editor HDL SynthesizerHDL Synthesizer

설계 범위설계 범위1K Gate 이하

Gate, Counter,MUX

1K Gate 이하Gate, Counter,

MUX10K ~ 100Kuprocessor

10K ~ 100Kuprocessor

100K 이상고성능 프로세서100K 이상

고성능 프로세서

Page 3: Digital System Design

3

VHDL(Very High Speed IC Hardware Description Language)

VHDL 설계 Flow

CK

QD

CD

IF (CD = ‘1’) THEN Q <= ‘0’;ELSE IF (CLK ’event and CLK = ‘1’) THEN Q <= D;END IF ;

IF (CD = ‘1’) THEN Q <= ‘0’;ELSE IF (CLK ’event and CLK = ‘1’) THEN Q <= D;END IF ;

Placement&

Routing

Placement&

Routing

SynthesisSynthesis

HDL 설계HDL 설계

Structural Description

Structural Description

Page 4: Digital System Design

4

VHDL(Very High Speed IC Hardware Description Language)

VHDL 의 등장배경

Gate Count 및 디자인의의 복잡성 증가

설계자 간의 정보 공유를 위한 표준화된 언어의 필요성 대두

Top-down 설계의 필요성 대두

설계의 유지보존을 위한 문서화 필요

표준화된 HDL 의 요구

Page 5: Digital System Design

5

VHDL(Very High Speed IC Hardware Description Language)

VHDL 의 표현방법 동작적 모델링 (Behavioral Modeling)

Functional or Algorithm Description High Level Language Program 과 유사 문서화를 위해서 우수 입력상태에 대한 출력결과만을 고려한 기술방법 . 시스템이 내부적으로 어떠한 하드웨어적인 구조를 가지는지에 상관없고 , 오로

지 진리표 등으로 표현된 것을 기능적 또는 수학적인 알고리즘을 사용하여 시스템을 동작하는 기술 .

데이터플로우 모델링 (Dataflow Modeling) Behavioral Description 보다 한 단계 낮은 Level Boolean Function, RTL, 또는 연산자 (AND, OR) 표현

구조적 모델링 (Structural Modeling) 가장 하드웨어적 표현에 가까움 구성요소 및 연결까지 표현

Page 6: Digital System Design

6

VHDL 개요

VHDL 의 구성

Package Entity

설계의 입출력 반드시 entity 이름이 file 이름이 된다 .

Architecture 설계의 실제 내용 한 설계에는 다수의 package 와 entity, architecture 가 존재

Configuration 다수의 architecture 를 갖는 entity 가 있을 경우 그 연결관계 를 설정 . 실제로 configuration 의 사용은 VHDL 의 합성 후 post-simulation

혹은 gate-simulation 과정에서 많이 이용된다 .

Page 7: Digital System Design

7

VHDL 개요

Entity 선언

entity mux isBeginport ( x, y, sel : in std_logic; mout : out std_logic); end mux;

Architecture body 선언 : 회로의 동작상태와 내부의 선 연결상태를 기술

architecture name of entity_name issignal selb, t1, t2: std_logic;Begin

selb <= not sel;t1 <= x and sel;t2 <= y and selb;mout <= t1 or t2;

end ex1;

x

ymout

sel

mux

xsel

mout

y

t1

t2

selb

Page 8: Digital System Design

8

VHDL 개요

Signal mode : signal 의 입출력상태를 표시 in : 입력 out : 출력 inout: 입출력 가능 buffer: 한 회로의 출력이면서 다른 회로의 입력으로 작용할 때

Signal Type

1bit signal : std_logic 2bit 이상의 signal: std_logic_vector

std_logic_vector(1 downto 0) std_logic_vector(0 to 3)

buffer

outinput

inout

Page 9: Digital System Design

9

VHDL 개요

객체 (Object)

값을 가질 수 있는 어떤 변수 ( 객체 ) 를 선언하는 방법

signal, variable, constant 3 가지

Signal : 선으로 구현될 수 있는 외적변수 signal set, clear, D: std_logic; set <= ‘1’; clear < = ‘0’; D <= set; 병렬구문에서 사용 (concurrent Statement)

variable: 중간 매개 변수 , 선으로 구현되지 않는 내적변수 variable val: integer; val := ‘1’; 순차구문 (Sequential Statement)

constant: 변경가능성이 많은 상수를 저장할 때 사용되는 변수 constant delay : time := 10ns

Page 10: Digital System Design

10

VHDL 개요

연산자 (Operator)

Logical 연산자 and, or, nand, not, xor, nxor

Shift 연산자 sll(shift left logic), srl(shift right logic) sla(shift left arithmetic), sra(shift right arithmetic) rol(rotate left logic), ror(rotate left logic)

관계 연산자 =, /=, <, <=, >, >=

Page 11: Digital System Design

11

VHDL 개요

병렬구문 (Concurrent Statement) & 순차구문 (Sequential Statement)

Page 12: Digital System Design

12

VHDL 개요

병렬구문 (Concurrent Statement)

어떤 회로에 대한 동시적인 회로상태의 변화 .

표현문장의 순서에 상관없이 똑같이 우선순위 .

Simulation 을 하면 첫 번째 줄의 쓰여진 동작 표현이나 마지막 줄에 쓰여진 동작표현이나 같은 시간에 simulation 될 수 있다 .

순차구문 (Sequential Statement)

일반적인 로직의 순차적 상태를 기술할 수 있는 문장 .

반듯이 앞의 문장이 진행되어야 뒤에 문장이 진행된다 .

Concurrent 문의 Subprogram 과 process 문장에서 사용된다 .

Page 13: Digital System Design

13

VHDL 개요

병렬구문 (Concurrent Statement) & 순차구문 (Sequential Statement)

Architecture ex of entiry issignal my_signal : std_logic_vector(3 DOWNTO 0);

beginPROCESS(...)BEGIN

My_signal <= "0000";My_signal(3) <= '1';My_signal(1) <= '1';

END PROCESS;End ex;

Architecture ex of entity is signal my_signal : std_logic_vector(3 DOWNTO 0);

BeginMy_signal <= "0000";My_signal(3) <= '1';My_signal(1) <= '1';

End ex;

Page 14: Digital System Design

14

VHDL 개요

Behavioral Representation 설계하려는 하드웨어의 구조와 관계없이 시스템의 동작을 알고리즘 레 벨에서 표헌 . Process 나 subprogram 내에서 사용된다 . 차례대로 수행되는 문장 . Wait, signal 할당문 , assert 문 , exit 문 , if 문 , loop 문 , next 문 등…

architecture ex5 of mux isbegin process (sel, x, y) begin if sel = '1' then mout <= x; else mout <= y; end if; end process;end ex5;

entity mux is port (x, y, sel: in BIT; mout: out BIT);end mux;

x

ymout

sel

mux

Page 15: Digital System Design

15

VHDL 개요

Behavioral Representation : Decoder

begin process (s, enable) if (enable=‘1’) then if (s=“00”) then z <= “0001”; elsif (s=“01”') then z <= “0010”; elsif (s=“10”') then z <= “0100”; else z<=“1000”; end if; else z<=“0000”; end if;end process;

s0z0

enable

1-out-of-4decoder

z1

z2

z3s1

Page 16: Digital System Design

16

VHDL 개요

Behavioral Representation : D FF

D-FF

DOUT

clk

DIN

rstnn

entity D_FF is port(DIN, clk, rstnn: in BIT; DOUT: out BIT);end D_FF;architecture behavior of D_FF isbegin process (rstnn, clk) begin if (rstnn=‘0’) then DOUT <= ‘0’; elsif clk=‘1’ and clk’event then DOUT <= DIN; end if; end process;end behavior;

Page 17: Digital System Design

17

VHDL 개요

Behavioral Representation : Process 문

하드웨어 시스템 모듈은 서로간에 병행적으로 수행되므로 시스템의 동작으로 표현하기 위해서는 Concurrent 문을 사용 .

모듈의 내부는 순차적으로 이루어지므로 Sequential 문을 사용 .

Process 문 자체는 Concurrent 문이므로 여러 개의 Process 문이 있으면 이들은 서로병행적으로 수행 .

하나의 Process 문 내부는 하나씩 수행되는 Sequential 문으로 표현 .

Process [(Sensitivity_list)]{ 선언문 }

Begin{Sequential 문 }

End process [process_Lable]

Page 18: Digital System Design

18

VHDL 개요

Behavioral Representation : Process 문 – Sensitivity List

보통 모든 input signal 들을 sensitivity list 에 포함 Sensitivity list 내의 signal 중에서 적어도 하나의 값이 변화해야 process 문 이 시작한다 . D-FF 형태의 process 인 경우 reset 과 clock 만 input signal 에 포함 Output signal 이 sensitivity list 에 포함되는 경우에는 infinite loop 이

발생 할 수가 있다 .

begin process (a) a<= not a;end process;

Page 19: Digital System Design

19

VHDL 개요

Behavioral Representation : IF Statement

• If_statement

if boolean_expression then

sequential_statements

[ elsif boolean_expression then

sequential_statements ]

[ else

sequential_statements ]

end if;

• Example:

entity OR2 is port (a,b : in std_logic; y : out std_logic);end OR2;architecture EX1 of OR2 isbegin process (a,b) begin if a=‘1’ or b=‘1’ then y<=‘1’; else y<=‘0’; end if; end process;end EX1;

Page 20: Digital System Design

20

VHDL 개요

Behavioral Representation : IF Statement

architecture EX2 of OR2 isbegin process (a,b) begin if a=‘1’ then y<=‘1’; elsif b=‘1’ then y<=‘1’; else y<=‘0’; end if; end process;end EX2;

architecture EX3 of OR2 isbegin process (a,b) begin y <=‘0’; if a=‘1’ or b=‘1’ then y<=‘1’; end if; end process;end EX3;

Page 21: Digital System Design

21

VHDL 개요

Behavioral Representation : CASE Statement

case expression is when choices => sequential_statements [ when choices => sequential_statements ] [ when others => sequential_statements ]end case;

type OP_CODE is (ADD, SUB, MULT, DIV);variable instruction : OP_CODE;case instruction is when ADD => y <=a+b; when SUM => y<=a-b; when MULT => y<=a*b; when DIV => y<=a/b; when others => y<=(others => ‘0’);end case;

Page 22: Digital System Design

22

VHDL 개요

Dataflow Representation Behavioral 과 Structure 표현의 중간단계로서 데이터흐름을 나타내듯이 시스템의 기능을 나타낸다 .

주로 연산자 , 함수 등으로 표현한다 .

VHDL 구문 중에서 주로 concurrent signal 할당문으로 기술한다 .

architecture sample of Or2 isbegin process (x, y) begin O1 <= I1 or I2 after 5 ns; end process;end ex5;

architecture sample of Or2 isbegin O1 <= I1 or I2 after 5 ns;end ex5;

Page 23: Digital System Design

23

VHDL 개요

Dataflow Representation – Conditional Concurrent Signal 여러 불 조건을 검사하여 참이면 해당하는 파형을 할당하는 문장 . 조건을 예측할 수 없는 경우에 사용한다 .(if)

architecture sample of Or2 isbegin

Signal 이름 <= 파형 1 when 조건 1 else 파형 2 when 조건 2 else .

파형 n;End sample;

Dataflow Representation – Selected Concurrent Signal 수식의 최종값과 선택의 값이 일치하는 경우 해당하는 파형을 지정 . (case)

architecture sample of Or2 isbegin

With 수식 selectSignal 이름 <= 파형 1 when 선택 1,

파형 2 when 선택 2, .

파형 n when 선택 n;End sample;

Page 24: Digital System Design

24

VHDL 개요

Dataflow Representation – conditional assignment and selected assignment

* 4*1 MUX 의 modeling

library ieee; use ieee.std_logic_1164.all;

entity mux4_1 is port (in0, in1, in2, in3 : in std_logic ; sel : in std_logic_vector(1 downto 0); y : out std_logic); end mux4_1;

entity 문은 conditional , selected 동일

Page 25: Digital System Design

25

VHDL 개요

Structural modeling

Definition Pure structural modeling describes entity in terms of its sub-components

and how these are connected.

It is, in effect, a hierarchical arrangement of interconnected components

structural modeling stepscomponent declaration

component identifier_name [ generic (local_generic_list) ;] [ port (local_port_list)] ;

end component ;

component instantiation label: component_declaration_name

[ generic map (association_list) ;] [ port map (association_list) ;]

Page 26: Digital System Design

26

VHDL 개요

Structural modeling - Example

entity half_add is port (x, y: in std_logic;

co, so: out std_logic); end half_add;

architecture behav of half_add iscomponent and_2 port (a, b: in std_logic; c: out std_logic); end component;

component xor_2 port (a, b: in std_logic; c: out std_logic);

end component;

Begin u1: xor_2 port map ( a=>x, b=>y, c=>so); -- named association

u2: and_2 port map ( x, y, co); -- positional association

end behav ;

2 InputAND gate

2 Inputxor

gate

X

y

so

coa

b

b

a

c

c

Half_Add

Page 27: Digital System Design

27

디지털 시스템

전가산기 (Full Adder) 설계 : Behavioral Modeling

반가산기 (Half Adder) 1 비트의 2 개 2 진수를 더하는 논리회로 . 2 개의 입력과 출력으로 구성 . 2 개 입력은 피연산수 x 와 연산수 y 이고 , 출력은 두 수를 합한 결과인 합 S(sum) 과 올림수 C(carry) 를 발생하는 회로 .

Page 28: Digital System Design

28

디지털 시스템

전가산기 (Full Adder) 설계 : Behavioral Modeling

전가산기 (Full Adder) 하위비트에서 발생한 올림수를 포함하여 3 개의 입력 비트들의 합을 구하는 조 합논리회로 . 3 개의 입력과 2 개의 출력으로 구성됨 . 3 개 입력은 피연산수 x 와 연산수 y, 그리고 하위 비트에서 발생한 올림수 Ci

가 되고 , 출력변수는 출력의 합 S(sum) 과 올림수 C(carry) 를 발생하는 회로 .

Page 29: Digital System Design

29

디지털 시스템

전가산기 (Full Adder) 설계 : Structural Modeling

full_adder

U0:half_adder

U1 :half_adder

x

y

c_in

xy

c_in

U2

temp_carry_1

temp_sum

temp_carry_2

s_out

c_out

s_out

c_out

Page 30: Digital System Design

30

디지털 시스템

조합회로 : 4 Bit 리플 캐리 가산기 (4 Bit Ripple Carry Adder)

4 비트 이진수를 입력 받아 4 비트 덧셈결과를 출력 .

Ex) Xilinx ISE 와 Modelsim 를 이용하여 합성하고 , 검증하시오 . (Structure Modeling)

FA FA FA FA C_outC_in

sum0 sum2 sum2 sum3

y2 y3y1y0 x2 x3x1x0

Page 31: Digital System Design

31

디지털 시스템

조합회로 : 8 Bit 가산기 (8 Bit Full Adder)

M 비트 이진수를 입력 받아 M 비트 덧셈결과를 출력 . Overflow 고려 설계 ( 111(7) + 110(6) = 1101(13))

Ex) Xilinx ISE 와 Modelsim 를 이용하여 합성하고 , 검증하시오 . (Structure Modeling)

8Bit Adder

A[7:0]

B[7:0] S[7:0]

C_out

C_in

Page 32: Digital System Design

32

디지털 시스템

조합회로 : 1Bit 비교기 (1 Bit Comparator)

두 입력이 서로 같은지 또는 다른지를 비교하여 알려주는 회로 . 1 비트 비교기는 두 입력이 같으면 ‘ 1’ 을 출력하고 , 다르면 ‘ 0’ 을 출력하는

회로 . Ex) ISE 와 Modelsim 을 이용하여 설계하고 검증하시오 .(Behavioral Modeling)

1Bit Comparator

A

B

EQ

A B EQ

0 0 1

0 1 0

1 0 0

1 1 1

Page 33: Digital System Design

33

디지털 시스템

조합회로 : 4Bit 비교기 (4 Bit Comparator)

두 입력이 같으면 EQ=‘1’, AGB=‘0’, ALB=‘0’ 을 출력 . A 값이 B 값보다 크면 AGB=‘1’, EQ=ALB=‘0’ 을 출력 . A 값이 B 값보다 작으면 ALB=‘1’, EQ=AGB=‘1’ 을 출력 . Ex) ISE 와 Modelsim 을 이용하여 설계하고 검증하시오 .(Behavioral Modeling)

4Bit Comparator

A[3:0]

B[3:0]

EQ

AGB

ALB

EQ AGB ALB

A=B 1 0 0

A>B 0 1 0

A<B 0 0 1

Page 34: Digital System Design

34

디지털 시스템

조합회로 : 3X8 Decoder

부호화된 정보를 복호화하는 데 사용 N bit 2 진 code => 2n 개 서로 다른 정보 입력이 3 개인 신호에 따라서 0,1,2,3,4,5,6,7 이라는 8 개의 출력이 있으며 , 1 개만 활성화가 된다 .

D5x y z D0

0 0 0 1 00 0 1 0 10 1 0 0 00 1 1 0 01 0 0 0 01 0 1 0 01 1 0 0 01 1 1 0 0

0 0 0 0 00 0 0 0 01 0 0 0 00 1 0 0 00 0 1 0 00 0 0 1 00 0 0 0 10 0 0 0 0

00000001

D1 D2 D3 D4 D6 D7

Page 35: Digital System Design

35

디지털 시스템

조합회로 : 3X8 Decoder

ISE 와 Modelsim 을 이용하여 설계하고 검증하시오 . 1. 1. 아래의 회로도를 보고 Dataflow 형태로 설계하시오 .2. 2. Behavioral Modeling 을 이용하여 설계하시오 . (case 문을 사용하고 , Enable 로 제어하는 부분 추가 )

z

y

x

Do

D1

D2

D3

D4

D5

D6

D7

Page 36: Digital System Design

36

디지털 시스템

조합회로 : Encoder

Decoder 의 역 (inverse) 산술을 수행 . 2n 개 이하의 입력선과 n 개의 출력선 . 입력신호를 특정한 코드로 변환하는 회로 .

D5 x y zD0

0 0 01 00 0 10 10 1 00 00 1 10 01 0 00 01 0 10 01 1 00 01 1 10 0

0 0 0 0 00 0 0 0 01 0 0 0 00 1 0 0 00 0 1 0 00 0 0 1 00 0 0 0 10 0 0 0 0

00000001

D1 D2 D3 D4 D6 D7

Page 37: Digital System Design

37

디지털 시스템

조합회로 : Encoder

ISE 와 Modelsim 을 이용하여 설계하고 검증하시오 . 1. 1. 아래의 회로도를 보고 Dataflow 형태로 설계하시오 .2. 2. Behavioral Modeling 을 이용하여 설계하시오 . (case 문을 사용하고 , Enable 로 제어하는 부분 추가 )

D0D1D2D3D4

D6

D5

D7

x

y

z

Page 38: Digital System Design

38

디지털 시스템

순차회로 : 현재 출력은 현재의 입력과 기억소자에 기억된 과거 출력들과

의 조합에 의해 결정 . 이전출력의 현재 입력이라는 시간적인

개념이 도입 .

순차 논리는 조합논리와 클럭에 의해 구동되는 메모리 소자 ( 주로 flip/flop)

로 구성

플립플롭은 정보의 저장 또는 기억회로 , 계수회로 , 및 데이터 정보 전송 회로에 많이 사용되며 , 동작특성에 따라 RS, D, JK, T 플립플롭으로 나누어 진다 .

Á¶ÇÕ³í¸®¸Þ¸ð¸®¼ÒÀÚ

input output

clk

Page 39: Digital System Design

39

디지털 시스템

플립플롭의 동작은 신호의 level 에서 동작하느냐 Edge 에서 동작하느냐에 따라 비동기형 플립플롭 (Latch) 와 동기형 플립플롭으로 나눈다 . 우리가 이 야기하는 플립플롭은 동기형 플립플롭을 말한다 .

Clock 구문의 VHDL 정의

Clock 동기회로 설계를 위한 구문 .

Process 문 내부에서 if-then –else 구문과 함께 사용 .

Rising, Falling Edge 를 선택 .

동일 Process 내에서는 단일 Clock, 단일 Edge 만 사용 .

(signal’event and signal=‘1’) rising edge.

(signal’event and signal=‘0’) rising edge.

Page 40: Digital System Design

40

디지털 시스템

순차회로 : D FF 클럭의 상승 모서리 또는 하강 모서리에서 동작한다 . D라는 한 개의 데이터 입력을 가지며 , D 입력에 가해진 데이터는 클럭신호에

의하여 출력으로 그대로 전달된다 . D FF 는 데이터를 잠깐 간직하는 Register 등과 빠른 속도의 용량이 작은 메모

리등에 많이 이용된다 .

D CLK Q(t+1)

0 ↑ 0

1 ↑ 1

D

Q

CLK

Page 41: Digital System Design

41

디지털 시스템

순차회로 : 8Bit Register 래치와 플립플롭은 1 비트의 정보를 저장 .. 래지스터는 2 비트 이상의 정보를 제어신호에 의하여 기억하는 소자 . 이러한 레지스터로서 널리 사용되는 것이 D 플립플롭이다 . D 플립플롭은

데이터를 저장했다가 , 데이터의 변화없이 출력하기 때문 .

RST CLK D Q(t+1)

0 X X 0

1 ↑ D D

Register8

D Q

CLKRST

Page 42: Digital System Design

42

디지털 시스템

Serial toParallel

Serial_in Q

CLKRST

계수기 (Counter)

일정한 출력순서를 반복적으로 발생시키는 회로 .

과거의 값을 저장하는 레지스터와 과거의 값을 증가하는 덧셈기로 구성 .

일반적은 계수기는 1 씩 증가하는 계수기를 말한다 .

계수기의 입력펄스와 출력값을 적절히 이용하면 사용자가 원하는 주파수를갖는 디지털 주파수 발생기를 설계할 수 있다 .

Page 43: Digital System Design

43

디지털 시스템

Serial toParallel

Serial_in Q

CLKRST

레지스터를 이용한 비동기 리셋 카운터 설계 클럭의 상승 에지에서 Reg8 회로의 논리값이 발생하고 , 발생된 논리값은 피

드백이 된다 . 피드백 논리 값은 +1 이 증가되어 Reg8 의 입력 값으로 입력되어 클럭의 상승

에지를 기다리는 대기상태가 된다 .

Register8

8Q

CLKRST

+18

Page 44: Digital System Design

44

디지털 시스템

Serial toParallel

Serial_in Q

CLKRST

Up-Down Counter Logic 설계 제어신호에 의하여 클럭 입력에 맞추어 카운터가 증가하거나 또는 감소하는카운터를 업다운 카운터라고 한다 .

아래의 블록도에서 보면 , MUX 에 의해 Register8 에서 출력되는 논리값의 피드백 값이 +1 이 증가된 값과 -1 이 감소된 값 중에서 하나를 선택하도록 되어있다 .

Register8

Q

CLKRST

+1 81

0-1

8

UpDn

Page 45: Digital System Design

45

디지털 시스템

Serial toParallel

Serial_in Q

CLKRST

Counter with Enable Logic 설계 클럭신호의 상승 에지에서 EN 신호의 논리값이 ‘ 1’ 일때는 카운터로

동작하며 ,‘0’ 일때는 현재의 값을 그대로 유지하는 동작을 수행 .

Register8

Q

CLKRST

+1 81

0

8

EN

Page 46: Digital System Design

46

디지털 시스템

Serial toParallel

Serial_in Q

CLKRST

비동기 계수기 (Asynchronous Counter) 아래의 그림에서와 같이 비동기 계수기는 각 계수기 Cnt#에 입력되는 클럭신호가 다르다 . 이런 비동기 계수기는 대체적으로 회로가 간단하지만 , 속도는 늦다 .

최초 CLK0 은 1MHz를 입력시켜 10분주된 100KHz(CLK1) 을 발생시키고 ,CLK1 을 입력받아 다시 10분주된 10KHz(CLK2) 를 발생시킨다 .

Cnt0

out0

CLK0

RST

4

Cnt1

out1

CLK1

4

Cnt2

out2

CLK2

4

Cnt3

out3

CLK3

4

Page 47: Digital System Design

47

디지털 시스템

Serial toParallel

Serial_in Q

CLKRST

동기 계수기 (synchronous Counter) 아래의 그림에서와 같이 동기 계수기는 각 계수기 Cnt#에 입력되는 클럭신호가 모두 동일하다 . 이런 비동기 계수기는 대체적으로 회로가 복잡하지만 ,속도는 빠르다 .

각각 입력되는 클럭을 이용하여 10분주 100분주 , 1000분주되는 신호를 생성할 수 있다 .

Cnt0

out0

CLK0

RST

4

Cnt1

out1

4

Cnt2

out2

4

Cnt3

out3

4

Page 48: Digital System Design

48

디지털 시스템

ALU

8 8

8

3

op1 op2

Alu_out

sel

Á¶ÇÕ³í¸®¸Þ¸ð¸®¼ÒÀÚ

input output

clk

ROM(Read Only Memory) 설계 상수형태로 저장된 데이터를 주소값을 변화시켜 단지 읽을 수만 있는 메모리 ROM Size = 주소개수 * 데이터 비트수 CE : ROM 의 칩 선택 여부를 나타내고 active-low 동작 OE : 읽은 데이터를 외부로 출력하는 여부를 지정하고 active-low 동작 . ROM VHDL 표현 : 2 차원 array type 선언 . 8 * 5 의 2 차원 array VHDL 표현

Subtype ROM_Word is std_logic_vector(4 downto 0);: 한 개의 주소에 저장되는 데이터의 크기

Type ROM_Table is array(0 to 7) of ROM_Word;: 8 개의 ROM_word 로 구성되는 array 구조

ROM 에 기억되는 데이터는 상수형태 : 미리선언 . Constant ROM_DATA : ROM_Table := ROM_Table’( “10101”, “10111”, “00101”, “10111”,

“00001”, “10001”, “01001”, “10111”); ROM 의 주소는 Std_logic_vector 의 데이터 타입을 사용하지만 2 차원 array 선언은 integer 로 선언되어야 하므로 형변환이 필요 . : conv_integer(Address) 함수 사용 .

ROM

Address

3 3

data

OE

CE

Page 49: Digital System Design

49

디지털 시스템

ALU

8 8

8

3

op1 op2

Alu_out

sel

Á¶ÇÕ³í¸®¸Þ¸ð¸®¼ÒÀÚ

input output

clk

RAM(Random Access Memory) 설계 주소지정으로 기억되어 있는 데이터를 읽어내는 기능과 외부에서 입력되는 데 이터를 저장하는 메모리 . RAM Size = 주소개수 * 데이터 비트수 CE : RAM 의 칩 선택 여부를 나타내고 active-low 동작 RD : 읽기 동작을 요구하고 active-low 동작 . WR : 쓰기 동작을 요구하고 active-low 동작 . Read operation : CE=‘0’, RD=‘0’, WR=‘1’ Write operation : CE=‘0’, RD=‘1’, WR=‘0’ Synchronous RAM?

RAM

Address

8

8

Out_data

RD

CE

WR

8

In_data

Page 50: Digital System Design

50

디지털 시스템

ALU

8 8

8

3

op1 op2

Alu_out

sel

Á¶ÇÕ³í¸®¸Þ¸ð¸®¼ÒÀÚ

input output

clk

RAM

Address

8

8

Out_data

RD

CE

WR

8

In_data

FSM(Finite State Machine) 설계 디지털 회로의 상태 변화를 나타내는 방법 . Example) Coffee Vending Machine

전원이 인가되면 “ 00”상태로 존재 . “00” 상태에서 동전이 들어오면 (Coin_in=‘1’) “01” 상태로 천이 , 그렇지 않으면 (coin_In=‘0’) “00” 상태에 계속 존재 . “01” 상태에서 coffee 가 선택이 되면 (coffee_sel=‘1’) “10” 상태로 천이 , 그렇지

않으면 (coffee_sel=‘0’) “01” 상태로 계속 존재 .

“10” 상태에서 coffee 를 제공했으면 (coffee_serve=‘1’) “00”상태로 천이 , 그렇지 않으며 (coffee_serve=‘0’) “10”상태로 계속 존재 .

Reset 이 인가될 때 상태천이 ? Power_On

“00”

“01” “10”

Coin_In=’0'

Coin_In=’1'

coffee_sel = ’1'

coffee_serve = ’1'

coffee_serve = ’0'

FSM

clk

Reset

Coin_in

Coffee_sel

Coffee_Serve

State_out2

Page 51: Digital System Design

51

디지털 시스템

ALU

8 8

8

3

op1 op2

Alu_out

sel

Á¶ÇÕ³í¸®¸Þ¸ð¸®¼ÒÀÚ

input output

clk

RAM

Address

8

8

Out_data

RD

CE

WR

8

In_data

교통신호제어기 설계 인적이 뜸한 시골의 간선도로와 농로의 교차로에 설치되어 있는 신호제어기 . 차량통행이 드문 농로에 차량이 있을 때 농로의 차량에 우선통행을 보장하는교통신호 제어기 .

농로 양편의 차량감지가 차량을 감지기가 차량을 감지하면 간선도로 신호등은 녹색에서 노랑색으로 변한다 .

간선도로 신호등이 노랑색으로 변한다음 일정시간 (count=10) 이 지나고 나면 자동으로 빨간색으로 바뀌며 , 동시에 농로 쪽의 신호등은 녹색으로 바뀐다 .

농로 쪽의 신호등이 녹색일 경우 일정시간 (count=60) 이 지나거나 농로 쪽에 차량이없을 때는 농로의 신호등은 노랑색으로 변한다 .

농로의 신호등이 노랑색으로 변한다음 일정시간이 지나고 나면 자동으로 빨강색으로 바뀌며 , 동시에 간선도로의 신호등은 녹색으로 바’뀐다 .

간선도로의 신호등이 녹색으로 바뀐 뒤 , 적어도 일정시간 동안 녹색을 유지한다 .

Page 52: Digital System Design

52

디지털 시스템

ALU

8 8

8

3

op1 op2

Alu_out

sel

Á¶ÇÕ³í¸®¸Þ¸ð¸®¼ÒÀÚ

input output

clk

RAM

Address

8

8

Out_data

RD

CE

WR

8

In_data

교통신호제어기 설계

State(00)

GL, RL

State=11

RL, YL

State=01

YL, RL

State=10

RL, GL

else

else else

else

Car_

on=’1

'

Yl_time=’1'

gl_

tim

e=’1

' o

r C

ar_

on=’0

'

Yl_time=’1'

GL : Green LampY L : Y ellow LampRL : Red LampY L_Time : Y ellow Lamp Timegl_Time : Green Lamp Time

TLC_CTL

TIMER

Car_on reset clk

Gl_

tim

e

Yl_

tim

e

sta

rt

Page 53: Digital System Design

53

Stop Watch 설계 1KHz(0.001s) 를 입력받아 0.01s, 0.1s, 1s, 1m 을 표시하는 stop watch . Start_Stop신호를 한번씩 누를때 마다 Start 와 Stop 을 반복하도록 설계 . ‘2’ 를 7segment 에 표시 하고자 하면 LED g 에서 a 까지 구동단자에” 101101

1”

디지털 시스템