Presentation is loading. Please wait.

Presentation is loading. Please wait.

가산기 설계.

Similar presentations


Presentation on theme: "가산기 설계."— Presentation transcript:

1 가산기 설계

2 조합회로 조합회로의 특징 일반적인 조합회로의 종류 값이 저장되지 않음 (저장소자가 아님)
입력 대비 출력값이 모든 경우에 대해 정의됨(정의되지 않는 경우?) 단일 논리게이트 또는 그 조합으로 이루어진 복합회로 일반적인 조합회로의 종류 NAND, NOR, INVERTER(NOT)등의 단일 논리게이트 조합형 가산기, 감산기, 곱셈기, 나눗셈기 등의 산술연산기 다중화기 비교기 여러 종류의 조합형 디코더, 인코더

3 반가산기(Half Adder) 반가산기(Half Adder) 1비트의 2진수를 2개 더하는 논리회로
2개의 입력과 출력으로 구성 입력 : x, y 출력 : s(sum), c(carry) s = x xor y c = x and y HA x y s c x y s c 1 3

4 반가산기(Half Adder) Cont’d
Half Adder Module library IEEE; use ieee.std_logic_1164.all; entity half_adder is port( x, y : in std_logic; s, c : out std_logic ); end entity half_adder; architecture Behavioral of half_adder is begin s <= x xor y; c <= x and y; end architecture Behavioral;

5 반가산기(Half Adder) Cont’d
Half Adder Testbench library IEEE; use ieee.std_logic_1164.all; entity TB_half_adder is end entity TB_half_adder; architecture Behavioral of TB_half_adder is component half_adder port( x, y : in std_logic; s, c : out std_logic ); end component half_adder; -- input signal signal x, y : std_logic; -- output signl signal s, c : std_logic; begin uut : half_adder port map( x, y, s, c ); process begin x <= '0'; y <= '0'; wait for 10 ns; y <= '1'; x <= '1'; end process; end architecture Behavioral;

6 반가산기(Half Adder) Cont’d
Waveform

7 전가산기(Full Adder) 전가산기(Full Adder) 1비트의 2진수를 3개 더하는 논리회로
3개의 입력과 출력으로 구성 입력 : x, y, ci(carry in) 출력 : s(sum), co(carry out) s = x xor y xor ci co = (x and y) or (x and ci) or (y and ci) x y ci s co 1 FA x ci s co y

8 전가산기(Full Adder) Cont’d
Full Adder Module library IEEE; use ieee.std_logic_1164.all; entity full_adder is port( x, y, ci : in std_logic; s, co : out std_logic ); end entity full_adder; architecture Behavioral of full_adder is begin s <= x xor y xor ci; co <= ( x and y ) or ( x and ci ) or ( y and ci ); end architecture Behavioral;

9 전가산기(Full Adder) Cont’d
Full Adder Testbench library IEEE; use ieee.std_logic_1164.all; entity TB_full_adder is end entity; architecture Behavioral of TB_full_adder is component full_adder port( x, y, ci : in std_logic; s, co : out std_logic ); end component full_adder; -- input signal signal x, y, ci : std_logic; -- output signal signal s, co : std_logic; begin uut : full_adder port map( x, y, ci, s, co ); process x <= '0'; y <= '0'; ci <= '0'; wait for 10 ns; x <= '1'; y <= '1'; ci <= '1'; end process; end architecture Behavioral;

10 전가산기(Full Adder) Cont’d
Waveform

11 4비트 전가산기(4-bit Full Adder)
4개의 FA를 직렬연결 s=x+y FA x4 y4 s4 co x3 y3 s3 c3 x2 y2 s2 c2 x1 y1 s1 c1 ci

12 4비트 전가산기(4-bit Full Adder) Cont’d
예제 Waveform x y ci s co 0000 0101 0010 0111 1011 1 1100 0100 1111

13 부호를 가지는 이진수 표현법 Sign-magnitude 1’s complement 2’s complement +3 0011
+2 0010 +1 0001 +0 0000 -0 1000 1111 -1 1001 1110 -2 1010 1101 -3 1011 1100 4비트 표현법의 예 4비트인 경우, 2의 보수 표현법의 범위 : -8 ~ +7

14 4비트 가/감산기(4-bit Full Adder/Subtractor)
모드입력 M에 따라 가산/감산 모드 결정 M : 0 → s = x + y M : 1 → s = x - y FA x4 y4 s4 co x3 y3 s3 c3 x2 y2 s2 c2 x1 y1 s1 c1 ci M

15 4비트 가/감산기(4-bit Full Adder/Subtractor) Cont’d
실습내용 FA 4개를 이용한 4비트 가산기/감산기 2’s complement를 이용한 가/감산기 설계 Mode 입력에 따라 덧셈과 뺄셈의 연산을 결정 설계 FA를 이용하여 4비트 가/감산기 설계 Testbench 설계 결과 예제에 나와 있는 값을 입력( 순서대로 입력 할 것 ) Waveform을 조교에게 검사 받을 것( 예제로 나와 있는 파형과 일치해야 함 ) entity bit4_add_sub is port( x, y : in std_logic_vector( 3 downto 0 ); ci, m : in std_logic; s : out std_logic_vector( 3 downto 0 ); co : out std_logic ); end entity bit4_add_sub;

16 4비트 가/감산기(4-bit Full Adder/Subtractor) Cont’d
예제 Waveform x y ci m s co 0000 0010 0011 0101 1101 1 0001 Over 1100 1111 x y ci m s co 0101 0001 1 0100 1010 0011 Under 1111 1100 1011 Over 0110 1110


Download ppt "가산기 설계."

Similar presentations


Ads by Google