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

Subversion Repositories fpuvhdl

[/] [fpuvhdl/] [trunk/] [fpuvhdl/] [adder/] [fpadd_normalize_struct.vhd] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 gmarcus
-- VHDL Entity HAVOC.FPadd_normalize.symbol
2
--
3
-- Created by
4
-- Guillermo Marcus, gmarcus@ieee.org
5
-- using Mentor Graphics FPGA Advantage tools.
6
--
7
-- Visit "http://fpga.mty.itesm.mx" for more info.
8
--
9
-- 2003-2004. V1.0
10
--
11
 
12
LIBRARY ieee;
13
USE ieee.std_logic_1164.all;
14
USE ieee.std_logic_arith.all;
15
 
16
ENTITY FPadd_normalize IS
17
   PORT(
18
      EXP_in  : IN     std_logic_vector (7 DOWNTO 0);
19
      SIG_in  : IN     std_logic_vector (27 DOWNTO 0);
20
      EXP_out : OUT    std_logic_vector (7 DOWNTO 0);
21
      SIG_out : OUT    std_logic_vector (27 DOWNTO 0);
22
      zero    : OUT    std_logic
23
   );
24
 
25
-- Declarations
26
 
27
END FPadd_normalize ;
28
 
29
--
30
-- VHDL Architecture HAVOC.FPadd_normalize.struct
31
--
32
-- Created by
33
-- Guillermo Marcus, gmarcus@ieee.org
34
-- using Mentor Graphics FPGA Advantage tools.
35
--
36
-- Visit "http://fpga.mty.itesm.mx" for more info.
37
--
38
-- Copyright 2003-2004. V1.0
39
--
40
 
41
 
42
LIBRARY ieee;
43
USE ieee.std_logic_1164.all;
44
USE ieee.std_logic_arith.all;
45
USE ieee.std_logic_unsigned.all;
46
 
47
LIBRARY HAVOC;
48
 
49
ARCHITECTURE struct OF FPadd_normalize IS
50
 
51
   -- Architecture declarations
52
 
53
   -- Internal signal declarations
54
   SIGNAL EXP_lshift : std_logic_vector(7 DOWNTO 0);
55
   SIGNAL EXP_rshift : std_logic_vector(7 DOWNTO 0);
56
   SIGNAL SIG_lshift : std_logic_vector(27 DOWNTO 0);
57
   SIGNAL SIG_rshift : std_logic_vector(27 DOWNTO 0);
58
   SIGNAL add_in     : std_logic_vector(7 DOWNTO 0);
59
   SIGNAL cin        : std_logic;
60
   SIGNAL count      : std_logic_vector(4 DOWNTO 0);
61
   SIGNAL isDN       : std_logic;
62
   SIGNAL shift_RL   : std_logic;
63
   SIGNAL word       : std_logic_vector(26 DOWNTO 0);
64
   SIGNAL zero_int   : std_logic;
65
 
66
 
67
   -- Component Declarations
68
   COMPONENT FPlzc
69
   PORT (
70
      word  : IN     std_logic_vector (26 DOWNTO 0);
71
      zero  : OUT    std_logic ;
72
      count : OUT    std_logic_vector (4 DOWNTO 0)
73
   );
74
   END COMPONENT;
75
 
76
   -- Optional embedded configurations
77
   -- pragma synthesis_off
78
   FOR ALL : FPlzc USE ENTITY HAVOC.FPlzc;
79
   -- pragma synthesis_on
80
 
81
 
82
BEGIN
83
   -- Architecture concurrent statements
84
   -- HDL Embedded Text Block 1 eb1
85
   -- eb1 1                                        
86
   SIG_rshift <= '0' & SIG_in(27 DOWNTO 2) & (SIG_in(1) AND SIG_in(0));
87
 
88
   -- HDL Embedded Text Block 2 eb2
89
   -- eb2 2                    
90
   add_in <= "000" & count;
91
 
92
   -- HDL Embedded Text Block 3 eb3
93
   -- eb3 3
94
   PROCESS( isDN, shift_RL, EXP_lshift, EXP_rshift, EXP_in, SIG_lshift, SIG_rshift, SIG_in)
95
   BEGIN
96
   IF (isDN='1') THEN
97
      EXP_out <= X"00";
98
      SIG_out <= SIG_in;
99
   ELSE
100
      IF (shift_RL='1') THEN
101
         -- Shift Right
102
         IF (SIG_in(27)='1') THEN
103
            EXP_out <= EXP_rshift;
104
            SIG_out <= SIG_rshift;
105
         ELSE
106
            EXP_out <= EXP_in;
107
            SIG_out <= SIG_in;
108
         END IF;
109
      ELSE
110
         -- Shift Left
111
         EXP_out <= EXP_lshift;
112
         SIG_out <= SIG_lshift;
113
      END IF;
114
   END IF;
115
   END PROCESS;
116
 
117
   -- HDL Embedded Text Block 4 eb4
118
   -- eb4 4
119
   zero <= zero_int AND NOT SIG_in(27);
120
 
121
   -- HDL Embedded Text Block 5 eb5
122
   -- eb5 5
123
   word <= SIG_in(26 DOWNTO 0);
124
 
125
   -- HDL Embedded Text Block 6 eb6
126
   -- eb6 6
127
   PROCESS(SIG_in,EXP_in)
128
   BEGIN
129
      IF (SIG_in(27)='0' AND SIG_in(26)='0' AND (EXP_in=X"01")) THEN
130
         isDN <= '1';
131
         shift_RL <= '0';
132
      ELSIF (SIG_in(27)='0' AND SIG_in(26)='0' AND (EXP_in/=X"00")) THEN
133
         isDN <= '0';
134
         shift_RL <= '0';
135
      ELSE
136
         isDN <= '0';
137
         shift_RL <= '1';
138
      END IF;
139
   END PROCESS;
140
 
141
 
142
   -- ModuleWare code(v1.1) for instance 'I3' of 'gnd'
143
   cin <= '0';
144
 
145
   -- ModuleWare code(v1.1) for instance 'I4' of 'inc'
146
   I4combo: PROCESS (EXP_in)
147
   VARIABLE t0 : std_logic_vector(8 DOWNTO 0);
148
   VARIABLE sum : signed(8 DOWNTO 0);
149
   VARIABLE din_l : std_logic_vector(7 DOWNTO 0);
150
   BEGIN
151
      din_l := EXP_in;
152
      t0 := din_l(7) & din_l;
153
      sum := (signed(t0) + '1');
154
      EXP_rshift <= conv_std_logic_vector(sum(7 DOWNTO 0),8);
155
   END PROCESS I4combo;
156
 
157
   -- ModuleWare code(v1.1) for instance 'I1' of 'lshift'
158
   I1combo : PROCESS (SIG_in, count)
159
   VARIABLE stemp : std_logic_vector (4 DOWNTO 0);
160
   VARIABLE dtemp : std_logic_vector (27 DOWNTO 0);
161
   VARIABLE temp : std_logic_vector (27 DOWNTO 0);
162
   BEGIN
163
      temp := (OTHERS=> 'X');
164
      stemp := count;
165
      temp := SIG_in;
166
      FOR i IN 4 DOWNTO 0 LOOP
167
         IF (i < 5) THEN
168
            IF (stemp(i) = '1' OR stemp(i) = 'H') THEN
169
               dtemp := (OTHERS => '0');
170
               dtemp(27 DOWNTO 2**i) := temp(27 - 2**i DOWNTO 0);
171
            ELSIF (stemp(i) = '0' OR stemp(i) = 'L') THEN
172
               dtemp := temp;
173
            ELSE
174
               dtemp := (OTHERS => 'X');
175
            END IF;
176
         ELSE
177
            IF (stemp(i) = '1' OR stemp(i) = 'H') THEN
178
               dtemp := (OTHERS => '0');
179
            ELSIF (stemp(i) = '0' OR stemp(i) = 'L') THEN
180
               dtemp := temp;
181
            ELSE
182
               dtemp := (OTHERS => 'X');
183
            END IF;
184
         END IF;
185
         temp := dtemp;
186
      END LOOP;
187
      SIG_lshift <= dtemp;
188
   END PROCESS I1combo;
189
 
190
   -- ModuleWare code(v1.1) for instance 'I2' of 'sub'
191
   I2combo: PROCESS (EXP_in, add_in, cin)
192
   VARIABLE mw_I2t0 : std_logic_vector(8 DOWNTO 0);
193
   VARIABLE mw_I2t1 : std_logic_vector(8 DOWNTO 0);
194
   VARIABLE diff : signed(8 DOWNTO 0);
195
   VARIABLE borrow : std_logic;
196
   BEGIN
197
      mw_I2t0 := EXP_in(7) & EXP_in;
198
      mw_I2t1 := add_in(7) & add_in;
199
      borrow := cin;
200
      diff := signed(mw_I2t0) - signed(mw_I2t1) - borrow;
201
      EXP_lshift <= conv_std_logic_vector(diff(7 DOWNTO 0),8);
202
   END PROCESS I2combo;
203
 
204
   -- Instance port mappings.
205
   I0 : FPlzc
206
      PORT MAP (
207
         word  => word,
208
         zero  => zero_int,
209
         count => count
210
      );
211
 
212
END struct;

powered by: WebSVN 2.1.0

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