Presentation is loading. Please wait.

Presentation is loading. Please wait.

VHDL의 기본 Lecture #6.

Similar presentations


Presentation on theme: "VHDL의 기본 Lecture #6."— Presentation transcript:

1 VHDL의 기본 Lecture #6

2 3. VHDL 모델링

3 VHDL 모델링 방법 추상적 동작 표현(Behavioral Descriptions)
알고리즘방법으로 표현 데이터 흐름 표현(Dataflow Descriptions) 부울대수를 이용해서 표현 구조적 표현(Structural Descriptions) 단순한 선의 연결로 표현 혼합적 표현(Mixed Descriptions) 위의 3가지방법을 혼합 VHDL의 기본

4 Behavioral Descriptions
동작적 표현 방식 논리회로의 동작에 대한 기능적 또는 알고리즘적 표현 논리회로에 대한 최상위 추상화 레벨 논리회로의 내부 구조에 대한 지식을 요구하지 않음 고급언어를 사용한 프로그램 작성방법과 유사 자료보관과 관리가 편리 process() 문을 주로 사용하여 표현 Process 문장 자체는 병행 문장  process 문장간에는 병행 수행 Process 문장 내에서는 순차 실행 VHDL의 기본

5 Behavioral Description - Signal Assignment, Conditional
2 x 1 Multiplexer : library ieee; use ieee.std_logic_1164.all; entity mux21_when is port( a,b : in std_logic; s : in std_logic; y : out std_logic); end mux21_when; architecture a of mux21_when is begin y <= a when (s='0') else b; end a; 2x1 Mux a b s y 동작 명세: if s = 0 then y = a else y = b 마지막 조건은 else 로 처리해야 함 VHDL의 기본

6 Behavioral Description - Signal Assignment, Conditional
VHDL의 기본

7 Behavioral Description - Signal Assignment, Selected
library ieee; use ieee.std_logic_1164.all; entity mux21_with is port( a, b: in std_logic; s : in std_logic; y : out std_logic); end mux21_with; architecture a of mux21_with is BEGIN WITH s SELECT y <= a WHEN ‘0’, b WHEN others; END a; 마지막 조건은 else 로 처리해야 함 VHDL의 기본

8 Behavioral Description – Sequential Statement (IF)
library ieee; use ieee.std_logic_1164.all; entity mux21_if_proc is port( a,b : in std_logic; s : in std_logic; y : out std_logic); end mux21_if_proc; architecture proc of mux21_if_proc is begin process(a,b,s) if( s='0') then y<=a; else y<=b; end if; end process; end proc; a, b,s 에 변화생길 때 실행 마지막 조건은 else로 처리해야 함. VHDL의 기본

9 Behavioral Description – Process Statement (case)
library ieee; use ieee.std_logic_1164.all; entity mux21_case_proc is port( a,b : in std_logic; s : in std_logic; y : out std_logic); end mux21_case_proc; architecture proc of mux21_case_proc is begin process(a,b,s) case s is when '0' => y<= a; when others => y<= b; end case; end process; end proc; 마지막 조건은 others로 처리해야 함. VHDL의 기본

10 Behavioral Description – Signal vs. Variable
library ieee; use ieee.std_logic_1164.all; entity andor_2 is port( a, b, c : in std_logic; y : out std_logic); end andor_2; architecture a of andor_2 is begin process(a,b,c) variablel t : std_logic; t :=a and b; y<=t or c; end process; end a; library ieee; use ieee.std_logic_1164.all; entity andor_2 is port( a, b, c : in std_logic; y : out std_logic); end andor_2; architecture a of andor_2 is signal t : std_logic; begin process(a,b,c,t) t<=a and b; y<=t or c; end process; end a; 선언되는 위치차이 Sensitivity List차이 2 1 1 Signal t는 Process문이 끝나는 순간에 일괄적으로 값이 할당. 2 3 Variable은 대입 즉시 값 할당. VHDL의 기본

11 Dataflow Descriptions
데이터 흐름 표현 입력과 출력과의 관계를 기술한 부울 대수식을 이용한 설계 방식 논로회로를 구성하는 구성 요소의 입출력 그리고 구성 요소간의 신호 흐름을 묘사하는 방식으로 논리회로를 설계 논리회로에 대한 중간 수준의 추상화 레벨 문장의 순서는 무관하다 병행처리문(Concurrent Statement)를 주로 사용 VHDL의 기본

12 Dataflow Description - 2-입력 AND Gate
Library ieee; Use ieee.std_logic_1164.all; Entity and_2 is port( a, b : in std_logic; y : out std_logic ); end and_2; Architecture dataflow of and_2 is begin y <= a and b; end dataflow; Dataflow방식은 부울대수를 그대로 표현 VHDL의 기본

13 Dataflow Description - 2입력 OR Gate
Library ieee; Use ieee.std_logic_1164.all; Entity or_2 is port( a, b : in std_logic; y : out std_logic ); end or_2; Architecture dataflow of or_2 is begin y <= a or b; end dataflow; VHDL의 기본

14 Dataflow Description - Andor_2 Circuit
library ieee; use ieee.std_logic_1164.all; entity andor_2 is port( a, b, c : in std_logic; y : out std_logic); end andor_2; architecture a of andor_2 is signal t : std_logic; begin t<=a and b; y<=t or c; end a; VHDL의 기본

15 Dataflow Description – 4 bits OR gate
Bus의사용 library ieee; use ieee.std_logic_1164.all; entity or_4bits is port( a, b : in std_logic_vector(3 downto 0); y : out std_logic_vector(3 downto 0) ); end or_4bits; architecture xxx of or_4bits is begin y <= a or b; end xxx; VHDL의 기본

16 Dataflow Description - Half Adder
library ieee; Use ieee.std_logic_1164.all; Entity half_add is port( a,b : in std_logic; sum, c_out : out std_logic ); end half_add; Architecture dataflow of half_add is begin sum <= A xor B; c_out <= A and B; end dataflow; 문장의 순서는 무관 VHDL의 기본

17 Dataflow Description - Full Adder
library ieee; use ieee.std_logic_1164.all; entity fulladd is port( a, b, cin : in std_logic; s, cout : out std_logic); end fulladd; architecture a of fulladd is signal t1, t2, t3 : std_logic; begin t1 <= a xor b; t2 <= a and b; t3 <= t1 and cin; s <= t1 xor cin; cout <= t2 or t3; end a; t1 t2 t3 문장의 순서는 무관 VHDL의 기본

18 Dataflow Description - Decoder3_8
library ieee; use ieee.std_logic_1164.all; entity decoder38_data is port( d2, d1, d0 : in std_logic; y0,y1,y2,y3,y4,y5,y6,y7 : out std_logic); end decoder38_data; architecture xxx of decoder38_data is signal nd2, nd1, nd0 : std_logic; Begin nd2 <= not d2; nd1 <= not d1; nd0 <= not d0; y0<= nd2 and nd1 and nd0; y1<= nd2 and nd1 and d0; y2<= nd2 and d1 and nd0; y3<= nd2 and d1 and d0; y4<= d2 and nd1 and nd0; y5<= d2 and nd1 and d0; y6<= d2 and d1 and nd0; y7<= d2 and d1 and d0; end xxx; VHDL의 기본

19 Structural Descriptions
구조적 표현 논리회로의 구성 요소 및 구성 요소간의 연결까지 표현 가장 하드웨어적 표현에 가까움 Graphic Editor를 이용한 고전적인 설계방식과 동일 Component( ) 문을 이용하여 구성 요소 종류를 선언 Component Instantiation을 통해 구성 요소 객체와 객체간을 연결 정의 Port map( ) 문을 이용하여 핀들을 서로 연결. 위치결합(positional association) Port문 내의 Signal의 위치순서대로 나열 이름결합(named association) Port문 내의 Signal의 위치순서와는 상관없이 (port문 내의 형식이름=>실제 이름)의 방식으로 결합 VHDL의 기본

20 Structural Description - Andor_2
library ieee; use ieee.std_logic_1164.all; entity andor_2 is port( a, b, c : in std_logic; y : out std_logic); end andor_2; architecture a of andor_2 is component and_2 port( a, b : in std_logic; y : out std_logic ); end component; component or_2 signal t : std_logic; begin U1 : and_2 port map ( a, b, t ); U2 : or_2 port map( a=> t, b=>c , y=>y); end a; and_2.vhd, or_2.vhd는 미리 작성된 상태임. And_2선언 Or_2선언 Component Instantiation VHDL의 기본

21 Structural Description - Andor_2
library ieee; use ieee.std_logic_1164.all; entity andor_2 is port( a, b, c : in std_logic; y : out std_logic); end andor_2; architecture a of andor_2 is component and_2 port( a, b : in std_logic; y : out std_logic ); end component; component or_2 signal t : std_logic; begin U1 : and_2 port map ( a, b, t ); U2 : or_2 port map( a=> t, b=>c , y=>y); end a; And_2 :위치결합방식 Or_2 : 이름결합방식 형식이름 VHDL의 기본 실제이름

22 Structural description – 4 bits adder
tcout1 library ieee; use ieee.std_logic_1164.all; entity add_4bits is port( a, b : in std_logic_vector(3 downto 0); cin : in std_logic; sum : out std_logic_vector(3 downto 0); cout : out std_logic ); end add_4bits; architecture a of add_4bits is component fulladd port( a, b, cin : in std_logic; s, cout : out std_logic); end component; signal tcout1, tcout2, tcout3 : std_logic; begin U1 : fulladd port map( a(0), b(0), cin, sum(0), tcout1); U2 : fulladd port map( a(1), b(1), tcout1, sum(1), tcout2); U3 : fulladd port map( a(2), b(2), tcout2, sum(2), tcout3); U4 : fulladd port map( a(3), b(3), tcout3, sum(3), cout); end a; tcout2 tcout3 Fulladd.vhd는 미리 작성된 상태임 VHDL의 기본

23 Structural Description - Mux 8X1
Library ieee; Use ieee.std_logic_1164.all; entity mux8_1 is port( a, b, c, d, e, f, g, h : in std_logic; s2, s1, s : in std_logic; y : out std_logic); end mux8_1; architecture xxx of mux8_1 is component decoder3_8 port( a, b, c : in std_logic; d0,d1,d2,d3,d4,d5,d6,d7 : out std_logic); end component; signal t : std_logic_vector(7 downto 0); signal d0,d1,d2,d3,d4,d5,d6,d7 : std_logic; begin U1: decoder3_8 port map( s2,s1,s0,d0,d1,d2,d3,d4,d5,d6,d7); t(0) <= a and d0; t(1) <= b and d1; t(2) <= c and d2; t(3) <= d and d3; t(4) <= e and d4; t(5) <= f and d5; t(6) <= g and d6; t(7) <= h and d7; y <= t(0) or t(1) or t(2) or t(3) or t(4) or t(5) or t(6) or t(7); end xxx; t(0) t(1) t(2) t(3) t(4) t(5) t(6) t(7) Decoder3_8.vhd는 미리 작성된 상태임 Mixed Modelling : structure + dataflow VHDL의 기본

24 Structural Description – 4bits Mux 8X1
Library ieee; Use ieee.std_logic_1164.all; Entity mux81_4bits is port( a, b, c, d, e, f, g, h : in std_logic_vector(3 downto 0); s2, s1, s0 : in std_logic; y : out std_logic_vector(3 downto 0)); end mux81_4bits; Architecture a of mux81_4bits is component mux8_1 port( a, b, c, d, e, f, g, h : in std_logic; s2, s1, s0 : in std_logic; y : out std_logic); end component; begin U0: mux8_1 port map (a(0),b(0),c(0),d(0),e(0),f(0),g(0),h(0),s2,s1,s0,y(0)); U1: mux8_1 port map (a(1),b(1),c(1),d(1),e(1),f(1),g(1),h(1),s2,s1,s0,y(1)); U2: mux8_1 port map (a(2),b(2),c(2),d(2),e(2),f(2),g(2),h(2),s2,s1,s0,y(2)); U3: mux8_1 port map (a(3),b(3),c(3),d(3),e(3),f(3),g(3),h(3),s2,s1,s0,y(3)); end a; VHDL의 기본


Download ppt "VHDL의 기본 Lecture #6."

Similar presentations


Ads by Google