-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtb_Mux.vhd
More file actions
67 lines (52 loc) · 1.23 KB
/
tb_Mux.vhd
File metadata and controls
67 lines (52 loc) · 1.23 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;
entity tb_Mux is
end tb_Mux;
architecture behaviour of tb_Mux is
--define clock period
constant clk_period: time := 20 ns; -- 50 MHz
--declare components
component MUX2TO1 is
Port (
A : in std_logic_vector(11 downto 0);
B : in std_logic_vector(11 downto 0);
S : in std_logic;
F : out std_logic_vector(11 downto 0)
);
end component;
--declare signals
signal A : STD_LOGIC_VECTOR (11 downto 0) := "100011000000";
signal B : STD_LOGIC_VECTOR (11 downto 0) := "000110100100";
signal S : STD_LOGIC;
signal F : STD_LOGIC_VECTOR (11 downto 0);
signal clk : STD_LOGIC;
--instantiate
begin
UUT: MUX2TO1
PORT MAP(
A => A,
B => B,
S => S,
F => F
);
--clock process
clk_process: process
begin
clk <= '0';
wait for clk_period/2;
clk <= '1';
wait for clk_period/2;
end process;
--stimulus process
stim_process: process
begin
-- hold reset state for 100 ns.
wait for 100 ns;
--stimulus
S <= '0';
wait for 50*clk_period;
S <= '1';
wait for 50*clk_period;
end process;
end behaviour;