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

Subversion Repositories fp_log

[/] [fp_log/] [trunk/] [LAU/] [Virtex 4/] [DP-LAU/] [Construct_sp_fp_mult_factor.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 NikosAl
----------------------------------------------------------------------------------
2
-- Company: TUM - Technischen Universität München
3
-- Engineer: N.Alachiotiss
4
-- 
5
-- Create Date:    11:57:33 06/24/2009 
6
-- Design Name: 
7
-- Module Name:    Construct_sp_fp_mult_factor - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
use IEEE.STD_LOGIC_ARITH.ALL;
23
use IEEE.STD_LOGIC_UNSIGNED.ALL;
24
 
25
---- Uncomment the following library declaration if instantiating
26
---- any Xilinx primitives in this code.
27
--library UNISIM;
28
--use UNISIM.VComponents.all;
29
 
30
entity Construct_sp_fp_mult_factor is
31
    Port ( rst : in  STD_LOGIC;
32
           clk : in  STD_LOGIC;
33
                          input_exponent : in  STD_LOGIC_VECTOR (10 downto 0);
34
           sp_fp_mult_fact : out  STD_LOGIC_VECTOR (31 downto 0));
35
end Construct_sp_fp_mult_factor;
36
 
37
architecture Behavioral of Construct_sp_fp_mult_factor is
38
 
39
 
40
component get_exp_LUT_index is
41
    Port ( input_val : in  STD_LOGIC_VECTOR (10 downto 0);
42
           output_val : out  STD_LOGIC_VECTOR (9 downto 0);
43
                          get_negative_val : out std_logic);
44
end component;
45
 
46
component exp_lut_MEM is
47
  port (
48
    clka : in STD_LOGIC := 'X';
49
    addra : in STD_LOGIC_VECTOR ( 9 downto 0 );
50
    douta : out STD_LOGIC_VECTOR ( 12 downto 0 )
51
  );
52
end component;
53
 
54
component comp_eq_111111111 is
55
  port (
56
    sclr : in STD_LOGIC := 'X';
57
    qa_eq_b : out STD_LOGIC;
58
    clk : in STD_LOGIC := 'X';
59
    a : in STD_LOGIC_VECTOR ( 8 downto 0 )
60
  );
61
end component;
62
 
63
component reg_1b_1c is
64
  port (
65
    sclr : in STD_LOGIC := 'X';
66
    clk : in STD_LOGIC := 'X';
67
    d : in STD_LOGIC_VECTOR ( 0 downto 0 );
68
    q : out STD_LOGIC_VECTOR ( 0 downto 0 )
69
  );
70
end component;
71
 
72
component reg_32b_1c is
73
  port (
74
    sclr : in STD_LOGIC := 'X';
75
    clk : in STD_LOGIC := 'X';
76
    d : in STD_LOGIC_VECTOR ( 31 downto 0 );
77
    q : out STD_LOGIC_VECTOR ( 31 downto 0 )
78
  );
79
end component;
80
 
81
signal case_0 , case_1, case_greater_1: std_logic;
82
signal case_0_vec , case_1_vec, case_greater_1_vec : std_logic_vector(3 downto 0);
83
 
84
signal sp_fp_val_fact : std_logic_Vector(31 downto 0);
85
 
86
signal exp_lut_index_LSB_in , exp_lut_index_LSB_out : std_logic_vector(0 downto 0);
87
 
88
signal eq_11111111 : std_logic;
89
 
90
signal exp_lut_dout : std_logic_vector(12 downto 0);  -- 4 LSBs from exponent and 9 MSBs from mantissa
91
 
92
signal exp_LUT_index : std_logic_vector(9 downto 0);
93
signal get_negative_val_out : std_logic;
94
signal get_negative_val_vec_in , get_negative_val_vec_out: std_logic_vector(0 downto 0);
95
 
96
 
97
 
98
 
99
 
100
begin
101
 
102
 
103
-- Get Exp Lut Index
104
get_exp_LUT_index_port_map: get_exp_LUT_index port map (input_exponent,exp_LUT_index,get_negative_val_out);
105
 
106
-- Exp Lut
107
exp_lut_MEM_port_map : exp_lut_MEM port map(clk,exp_LUT_index,exp_lut_dout);
108
 
109
-- Register for sign 
110
get_negative_val_vec_in(0)<=get_negative_val_out;
111
reg_for_sign_indicator_port_map: reg_1b_1c port map (rst,clk,get_negative_val_vec_in,get_negative_val_vec_out); -- merge with next reg
112
 
113
--Compararor with constant b port 111111111
114
comp_eq_111111111_port_map : comp_eq_111111111 port map (rst,eq_11111111,clk,exp_LUT_index(9 downto 1));
115
 
116
-- Register for exp_LUT_index_LSB 
117
exp_lut_index_LSB_in(0)<=exp_LUT_index(0);
118
reg_for_exp_LUT_index_LSB_port_map: reg_1b_1c port map (rst,clk,exp_lut_index_LSB_in,exp_lut_index_LSB_out);
119
 
120
 
121
 
122
 
123
case_0<= eq_11111111 and exp_lut_index_LSB_out(0);
124
case_1<= eq_11111111 and (not exp_lut_index_LSB_out(0));
125
case_greater_1 <= not eq_11111111;
126
 
127
case_0_vec<=(others=>case_0);
128
case_1_vec<=(others=>case_1);
129
case_greater_1_vec<=(others=>case_greater_1);
130
 
131
 
132
 
133
-- Constract sp_fp_mult_factor
134
 
135
sp_fp_val_fact(31) <= not get_negative_val_vec_out(0);
136
sp_fp_val_fact(30 downto 27)<=("0000" and case_0_vec)or ("0111" and case_1_vec) or ("1000" and case_greater_1_vec);
137
sp_fp_val_fact(26 downto 23)<=exp_lut_dout(12 downto 9);
138
sp_fp_val_fact(22 downto 14)<=exp_lut_dout(8 downto 0);
139
sp_fp_val_fact(13 downto 0)<=(others=>'0');
140
 
141
--Final output register
142
 
143
reg_32b_1c_port_map : reg_32b_1c port map(
144
rst,
145
clk,
146
sp_fp_val_fact,
147
sp_fp_mult_fact
148
);
149
 
150
end Behavioral;
151
 

powered by: WebSVN 2.1.0

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