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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [lib/] [tech/] [snps/] [dw02/] [comp/] [DW02_components.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
 
2
 
3
library IEEE;
4
use IEEE.std_logic_1164.all;
5
use IEEE.std_logic_arith.all;
6
 
7
package DW02_components is
8
 
9
  component DW02_mult_2_stage
10
  generic( A_width: POSITIVE;           -- multiplier wordlength
11
           B_width: POSITIVE);          -- multiplicand wordlength
12
   port(A : in std_logic_vector(A_width-1 downto 0);
13
        B : in std_logic_vector(B_width-1 downto 0);
14
        TC : in std_logic;              -- signed -> '1', unsigned -> '0'
15
        CLK : in std_logic;           -- clock for the stage registers.
16
        PRODUCT : out std_logic_vector(A_width+B_width-1 downto 0));
17
  end component;
18
 
19
 
20
end DW02_components;
21
 
22
-- pragma translate_off
23
 
24
library IEEE;
25
use IEEE.std_logic_1164.all;
26
use IEEE.std_logic_arith.all;
27
library grlib;
28
use grlib.stdlib.all;
29
 
30
entity DW02_mult_2_stage is
31
  generic( A_width: POSITIVE;
32
           B_width: POSITIVE);
33
   port(A : in std_logic_vector(A_width-1 downto 0);
34
        B : in std_logic_vector(B_width-1 downto 0);
35
        TC : in std_logic;
36
        CLK : in std_logic;
37
        PRODUCT : out std_logic_vector(A_width+B_width-1 downto 0));
38
end;
39
 
40
 
41
architecture behav of DW02_mult_2_stage is
42
 
43
  signal P_i : std_logic_vector(A_width+B_width-1 downto 0);
44
 
45
begin
46
 
47
  comb : process(A, B, TC)
48
  begin
49
    if notx(A) and notx(B) then
50
      if TC = '1' then
51
        P_i <= signed(A) * signed(B);
52
      else
53
        P_i <= unsigned(A) * unsigned(B);
54
      end if;
55
    else
56
      P_i <= (others => 'X');
57
    end if;
58
  end process;
59
 
60
  reg : process(CLK)
61
  begin
62
    if rising_edge(CLK) then
63
      PRODUCT <= P_i;
64
    end if;
65
  end process;
66
 
67
end;
68
 
69
-- pragma translate_on
70
 

powered by: WebSVN 2.1.0

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