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

Subversion Repositories fpuvhdl

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

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

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

powered by: WebSVN 2.1.0

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