-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmultiplier4bit_dsd.vhd
95 lines (71 loc) · 1.67 KB
/
multiplier4bit_dsd.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
-- Engineer: Stavros Kalapothas
-- Create Date: 22/12/2019
-- Project Name: ask1_tb
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY Tb_multiplier4bit IS
PORT (
-- //////////// CLOCK //////////
CLOCK_50 : IN STD_LOGIC;
-- //////////// LED //////////
LED : OUT STD_LOGIC_VECTOR(7 downto 0);
-- //////////// KEY //////////
-- KEY : IN STD_LOGIC_VECTOR(1 downto 0);
-- //////////// GPIO Header //////////
GPIO_2 : INOUT STD_LOGIC_VECTOR(4 downto 0)
);
END Tb_multiplier4bit;
ARCHITECTURE behavior OF Tb_multiplier4bit IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT multiplier4bit
port ( Clk: in STD_LOGIC;
Rst: in STD_LOGIC;
A: in STD_LOGIC_VECTOR (3 downto 0);
B: in STD_LOGIC_VECTOR (3 downto 0);
S: out STD_LOGIC_VECTOR (7 downto 0));
END COMPONENT;
--Inputs
signal A : std_logic_vector(3 downto 0) := (others => '0');
signal B : std_logic_vector(3 downto 0) := (others => '0');
--Outputs
signal S : STD_LOGIC_VECTOR (7 downto 0) := (others => '0');
signal clk, rst : STD_LOGIC;
TYPE state_type IS (IDLE,DELAY, LED_ON);
signal state_cur, state_nxt: state_type;
BEGIN
clk <= CLOCK_50;
rst <= GPIO_2(0);
-- Instantiate the Unit Under Test (UUT)
uut: multiplier4bit PORT MAP (
A => A,
B => B,
S => S
);
-- Stimulus process
stim_proc: process
begin
if rst='1' then
S<=(others=>'0');
elsif (clk'event and clk = '1') then
-- hold reset state for 2 ns.
--wait for 2 ns;
A <= "0110";
B <= "1100";
wait for 500 ms;
A <= "1111";
B <= "1101";
wait for 500 ms;
A <= "0100";
B <= "0101";
wait for 500 ms;
A <= "0010";
B <= "1110";
wait for 500 ms;
A <= "1011";
B <= "1011";
wait for 500 ms;
wait;
end if;
end process;
LED<= S;
END;