-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtb_multiplier.vhd
58 lines (38 loc) · 1.23 KB
/
tb_multiplier.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
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use WORK.constants.all;
entity MULTIPLIER_tb is
end MULTIPLIER_tb;
architecture TEST of MULTIPLIER_tb is
constant numBit : integer := NumBit; -- :=8 -- :=16 -- :=32
-- input
signal A_mp_i : std_logic_vector(numBit-1 downto 0) := (others => '0');
signal B_mp_i : std_logic_vector(numBit-1 downto 0) := (others => '0');
-- output
signal Y_mp_i : std_logic_vector(2*numBit-1 downto 0);
-- MUL component declaration
component BOOTHMUL
generic (NBIT: integer := NumBit);
port (a: in std_logic_vector(NBIT-1 downto 0); -- multiplicand
b: in std_logic_vector(NBIT-1 downto 0); -- multiplier
p: out std_logic_vector(2*NBIT-1 downto 0)); -- result
end component;
begin
-- MUL instantiation
MUL: BOOTHMUL port map(A_mp_i, B_mp_i,Y_mp_i);
-- PROCESS FOR TESTING TEST - COMLETE CYCLE ---------
test: process
begin
-- cycle for operand A
NumROW : for i in 0 to 2**(NumBit)-1 loop
-- cycle for operand B
NumCOL : for i in 0 to 2**(NumBit)-1 loop
wait for 10 ns;
B_mp_i <= B_mp_i + '1';
end loop NumCOL ;
A_mp_i <= A_mp_i + '1';
end loop NumROW ;
wait;
end process test;
end TEST;