반응형
전가산기의 진리표 및 논리식
Temp1,temp2,temp3는 구조적 모델링에 사용할 신호 signal
■구조적모델링 소스코드
library ieee;
use ieee.std_logic_1164.all;
entity full_adder_structure is --full_adder_structure에대한 entity
Port (X : in std_logic;
Y : in std_logic;
Ci : in std_logic;
S : out std_logic;
Co : out std_logic);
end full_adder_structure;
architecture Structural of full_adder_structure is --신호 temp1,temp2,temp3 정의
signal temp1: std_logic;
signal temp2: std_logic;
signal temp3: std_logic;
component half_adder_dataflow is --설계된 half_adder를 사용
port (X, Y : in std_logic; S,C:out std_logic);
end component;
component OR_gate is --설계된 OR게이트를 사용
port (A,B: in std_logic; C:out std_logic);
end component;
begin
HALF1: half_adder_dataflow port map(X,Y,temp1,temp2); --half를 사용하여 X,Y,를 입력으로 하여 설계된 half에서 S에 temp1을 출력 C에 temp2를 출력
HALF2: half_adder_dataflow port map(temp1,Ci,s,temp3); --half를 사용하여 temp1,Ci을 입력으로 설계된 S에 entity문에서 out으로 설정한S를 출력 C에 temp3를 출력
ORG: OR_gate port map(temp3,temp2,Co); --설계된or게이트에서 temp3,temp2를 입력으로 Co를 출력
end structural;
■자료흐름적 모델링 소스코드
library ieee;
use ieee.std_logic.1164.all;
entity full_adder is
port(A,B,Cin : in std_logic;
Sum,Cout : out std_logic);
end full_adder;
architecture Dataflow of full_adder is
begin
Sum <= ((A xor B) xor Cin);
Cout <= (Cin and (A xor B )) or (X and Y);
end Dataflow;
반응형
'VHDL' 카테고리의 다른 글
4비트 가산기, (0) | 2021.06.08 |
---|---|
반감산기 전감산기(schematic,소스코드) (0) | 2021.06.08 |
반가산기 설계 (구조적모델링,자료흐름적모델링) (0) | 2021.06.08 |
VHDL 의 표현방법 (0) | 2021.06.08 |
VHDL 구문(state ment) (0) | 2021.06.08 |