VHDL

반가산기 설계 (구조적모델링,자료흐름적모델링)

전자자연인 2021. 6. 8. 21:27
반응형

●반가산기
1Bit 짜리 2개 를 덧셈한 (Sum)과 자리올림수(Carry)를 구하는 조합논리회로

반가산기 진리표와 논리식

반가산기 Schematic

 

■구조적 모델링

반가산기 구조적 모델링에 사용할 Gate

library ieee;

use ieee.std_logic_1164.all;

 

entity half_adder_structure is --half_adder_structure의 입력 출력 설정

Port(X:in std_logic;

Y:in std_logic;

S:out std_logic;

C:out std_logic);

end half_adder_structure;

 

architecture Structural of half_adder_structure is --half_adder에 대한 구조적모델링

 

component AND_gate --설계한 AND_gate entity와 이름이 같아야됨

port(A, B:in std_logic; C: out std_logic);

end component;

 

component XOR_Gate --설계한 XOR_gate entity와 이름이 같아야됨

port(A,B:in std_logic; C:out std_logic);

end component;

begin

 

ANDG: AND_gate port map (X,Y,C); -- X,Y,C를 차례대로 설계된 AND_gate의 입출력 순서에 맡게 넣어줌 X,Y AND_gate에 입력으로 C를 출력으로

XORG: XOR_Gate port map (X,Y,S); -- X,Y,S를 차례대로 설계된 XOR_gate의 입출력 순서에 맡게 넣어줌 X,Y XOR_gate의 입력으로 S를 출력으로

end Structural;

■자료흐름적모델링

library ieee;

use ieee.std_logic_1164.all;

 

entity half_adder_dataflow is --half_adder_dataflow 에대한 포트 entity

port ( X : in std_logic;

Y : in std_logic;

S : out std_logic;

C : out std_logic);

end half_adder_dataflow;

 

architecture Dataflow of half_adder_dataflow is

 

begin

S <= X xor Y; --S출력은 X xor Y입력의 연산

C <= X and Y; --C출력은 X and Y입력의 연산

end Dataflow;

반응형