-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMux_2to1.vhd
43 lines (41 loc) · 1.14 KB
/
Mux_2to1.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY mux_2to1 IS
PORT (
reset : IN STD_LOGIC;
delay : IN STD_LOGIC; -- delay
clock : IN STD_LOGIC; -- clock
sel : IN STD_LOGIC; -- select input
a : IN STD_LOGIC; -- input
b : IN STD_LOGIC; -- input
x : OUT STD_LOGIC -- output
);
END mux_2to1;
ARCHITECTURE Behavioral OF mux_2to1 IS
BEGIN
PROCESS(clock)
VARIABLE delay1 : TIME;
VARIABLE delay2 : TIME;
BEGIN
IF rising_edge(clock) THEN
IF reset ='1' THEN
x <= '0';
ELSE
IF delay = '0' THEN
delay1 := 50 ns;
delay2 := 500 ns;
ELSE
delay1 := 500 ns;
delay2 := 50 ns;
END IF;
IF sel = '0' THEN
x <= TRANSPORT a AFTER delay1;
ELSIF sel ='1' THEN
x <= TRANSPORT b AFTER delay2;
ELSE
x <= '0';
END IF;
END IF;
END IF;
END PROCESS;
END Behavioral;