OpenCores
URL https://opencores.org/ocsvn/generic_booth_multipler/generic_booth_multipler/trunk

Subversion Repositories generic_booth_multipler

[/] [generic_booth_multipler/] [trunk/] [rtl/] [modules/] [02.BoothMultiplier.vhd] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alimpk
 
2
library IEEE;
3
use IEEE.STD_LOGIC_1164.ALL;
4
 
5
entity BoothMultiplier is
6
  generic(COUNTER_SIZE : positive := 2);
7
        port(
8
                clock : in      std_logic;
9
                clear : in      std_logic;
10
    start : in  std_logic;
11
                X_data: in      std_logic_vector(2**COUNTER_SIZE-1 downto 0);
12
                Y_data: in      std_logic_vector(2**COUNTER_SIZE-1 downto 0);
13
                ready : out std_logic;
14
                Result: out std_logic_vector(2*(2**COUNTER_SIZE)-1 downto 0));
15
end BoothMultiplier;
16
 
17
architecture Behavioral of BoothMultiplier is
18
 
19
  component counter is
20 6 alimpk
    generic(
21
      size: integer := 4
22
    );
23 2 alimpk
    port(       clock : in      std_logic;
24
          reset : in    std_logic;
25
          value : out   std_logic_vector);
26
  end component counter;
27
 
28
  component BoothDatapath is
29 6 alimpk
    generic(
30
      size: integer := 4
31
    );
32
    port(
33 2 alimpk
    clock :in  std_logic;
34
    reset :in std_logic;
35
    load :in std_logic;
36
    shift :in std_logic;
37
    X  :in std_logic_vector;
38
    Y  :in std_logic_vector;
39
    P  :out std_logic_vector);
40
    end component BoothDatapath;
41
 
42
        component BoothController is
43
      Port (
44
        clock : in  std_logic;
45
        reset : in  std_logic;
46
        start : in  std_logic;
47
        interrupt : in std_logic;
48
        load : out std_logic;
49
        shift : out std_logic;
50
        cnt_clear : out std_logic;
51
        reg_clear : out std_logic;
52
        ready : out std_logic);
53
    end component BoothController;
54
 
55
    signal load : std_logic;
56
    signal counter_value : std_logic_vector(COUNTER_SIZE - 1 downto 0);
57
    signal shift : std_logic;
58
    signal counter_interrupt : std_logic;
59
    signal cnt_clear : std_logic;
60
    signal reg_clear : std_logic;
61
 
62
    CONSTANT ONES : std_logic_vector(COUNTER_SIZE - 1 downto 0) := (others => '1');
63
 
64
begin
65
 
66
        datapath:  BoothDatapath
67 6 alimpk
  generic map(2**COUNTER_SIZE)
68 2 alimpk
        port map(
69
           clock => clock,
70
           reset => reg_clear,
71
           load => load,
72
           shift => shift,
73
           X => X_data,
74
           Y => Y_data,
75
           P => Result);
76
 
77
        counter_unit: counter
78 6 alimpk
    generic map(size => COUNTER_SIZE)
79 2 alimpk
    port map(
80
       clock => clock,
81
       reset => cnt_clear,
82
       value => counter_value);
83
 
84
  counter_interrupt <= '1' when (counter_value = ONES) else '0';
85
 
86 6 alimpk
        controller: BoothController
87 2 alimpk
       port map(
88
          clock => clock,
89
          reset => clear,
90
          start => start,
91
          interrupt => counter_interrupt,
92
          load => load,
93
          shift => shift,
94
          cnt_clear => cnt_clear,
95
          reg_clear => reg_clear,
96
          ready => ready);
97
 
98
end Behavioral;
99
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.