[VHDL] 00_Q 간단한 게이트 구성 문제

1 minute read

00 intro를 정리 후 간단하게 vhdl코딩을 해보자.

01 AND-Gate(AND-Gatter)의 vhd파일 생성하고 신호 확인하기

input

1
2
3
4
5
6
7
8
9
10
11
12
library ieee;
use ieee.std_logic_1164.all;

entity and2 is
	port(	a, b: in std_logic;
		y: out std_logic);
end and2;

architecture behavioral of and2 is
begin
	y <= a and b;
end behavioral;

WaveTrace(GHDL+GTKWAVE+VSCode)


02 XOR-Gate(XOR-Gatter)의 vhd파일 생성하고 신호 확인하기

1
2
3
4
5
6
7
8
9
10
11
12
13
library ieee;
use ieee.std_logic_1164.all;

entity xor2 is
	port(	a: in std_logic;
		b: in std_logic;
		y: out std_logic);
end xor2;

architecture behavioral of xor2 is
begin
	y <= a xor b;
end behavioral;

03 XNOR-Gate(XNOR-Gatter)의 vhd파일 생성하고 신호 확인하기

input

1
2
3
4
5
6
7
8
9
10
11
12
13
library ieee;
use ieee.std_logic_1164.all;

entity xnor2 is
	port(	a: in std_logic;
		b: in std_logic;
		y: out std_logic);
end xnor2;

architecture behavioral of xnor2 is
begin
	y <= a xnor b;
end behavioral;

WaveTrace(GHDL+GTKWAVE+VSCode)


04 MUX의 vhd파일 생성하고 신호 확인하기

input

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
library ieee;
use ieee.std_logic_1164.all;

-- Hier den Code einf?gen

entity mux2 is
	port(	a: in std_logic;
		b: in std_logic;
		s: in std_logic;
		y: out std_logic
	);
end mux2;

architecture behavioral of mux2 is
begin
	y <= ((a and (not s)) or (b and s));
end behavioral;

WaveTrace(GHDL+GTKWAVE+VSCode)

s의 입력신호가 0일 시, b의 입력신호와 관계없이 a의 입력신호가 그대로 y로 출력되고, 반대로
s의 입력신호가 1일 시, a의 입력신호와 관계없이 b의 입력신호가 그대로 y로 출력된다.


Quelle: TU-Berlin

Leave a comment