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

Subversion Repositories raytrac

[/] [raytrac/] [branches/] [fp/] [invr32.vhd] - Blame information for rev 210

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

Line No. Rev Author Line
1 121 jguarin200
------------------------------------------------
2
--! @file finvr32.vhd
3
--! @brief RayTrac Floating Point Adder  
4
--! @author Julián Andrés Guarín Reyes
5
--------------------------------------------------
6
 
7
 
8
-- RAYTRAC (FP BRANCH)
9
-- Author Julian Andres Guarin
10
-- finvr32.vhd
11
-- This file is part of raytrac.
12
-- 
13
--     raytrac is free software: you can redistribute it and/or modify
14
--     it under the terms of the GNU General Public License as published by
15
--     the Free Software Foundation, either version 3 of the License, or
16
--     (at your option) any later version.
17
-- 
18
--     raytrac is distributed in the hope that it will be useful,
19
--     but WITHOUT ANY WARRANTY; without even the implied warranty of
20
--     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
--     GNU General Public License for more details.
22
-- 
23
--     You should have received a copy of the GNU General Public License
24
--     along with raytrac.  If not, see <http://www.gnu.org/licenses/>
25 99 jguarin200
library ieee;
26
use ieee.std_logic_1164.all;
27
use ieee.std_logic_unsigned.all;
28 158 jguarin200
use work.arithpack.all;
29 151 jguarin200
 
30 104 jguarin200
entity invr32 is
31 99 jguarin200
        port (
32
 
33 150 jguarin200
                clk             : in std_logic;
34 158 jguarin200
                dvd32   : in xfloat32;
35
                qout32  : out xfloat32
36 99 jguarin200
        );
37 153 jguarin200
end entity;
38 104 jguarin200
architecture invr32_arch of invr32 is
39 99 jguarin200
 
40
        component altsyncram
41
        generic (
42
                address_aclr_a          : string;
43
                clock_enable_input_a            : string;
44
                clock_enable_output_a           : string;
45
                init_file               : string;
46
                intended_device_family          : string;
47
                lpm_hint                : string;
48
                lpm_type                : string;
49
                numwords_a              : natural;
50
                operation_mode          : string;
51
                outdata_aclr_a          : string;
52
                outdata_reg_a           : string;
53
                widthad_a               : natural;
54
                width_a         : natural;
55
                width_byteena_a         : natural
56
        );
57
        port (
58
                        clock0  : in std_logic ;
59 137 jguarin200
                        rden_a  : in std_logic;
60 99 jguarin200
                        address_a       : in std_logic_vector (9 downto 0);
61
                        q_a     : out std_logic_vector (17 downto 0)
62
        );
63
        end component;
64
 
65 103 jguarin200
        signal s0sgn                    : std_logic;
66
        signal s0uexp,s0e129    : std_logic_vector(7 downto 0);
67 99 jguarin200
        signal s0q                              : std_logic_vector(17 downto 0);
68 139 jguarin200
        signal sxprop                   : std_logic;
69 99 jguarin200
begin
70
 
71
        altsyncram_component : altsyncram
72
        generic map (
73
                address_aclr_a => "NONE",
74
                clock_enable_input_a => "BYPASS",
75
                clock_enable_output_a => "BYPASS",
76 150 jguarin200
                --init_file => "X:/Tesis/Workspace/hw/rt_lib/arith/src/trunk/fpbranch/invr/meminvr.mif",
77
                init_file => "//IMACJULIAN/imac/Code/Indigo/fp/fp/meminvr.mif",
78 99 jguarin200
                intended_device_family => "Cyclone III",
79
                lpm_hint => "ENABLE_RUNTIME_MOD=NO",
80
                lpm_type => "altsyncram",
81
                numwords_a => 1024,
82
                operation_mode => "ROM",
83
                outdata_aclr_a => "NONE",
84 103 jguarin200
                outdata_reg_a => "UNREGISTERED",
85 99 jguarin200
                widthad_a => 10,
86
                width_a => 18,
87
                width_byteena_a => 1
88
        )
89
        port map (
90
                clock0 => clk,
91 150 jguarin200
                rden_a => '1',
92 104 jguarin200
                address_a => dvd32(22 downto 13),
93 99 jguarin200
                q_a => s0q
94
        );
95 150 jguarin200
 
96 103 jguarin200
        --! SNAN?
97 139 jguarin200
        process (clk)
98 99 jguarin200
        begin
99 139 jguarin200
                if clk'event and clk='1'  then
100 99 jguarin200
                        --!Carga de Operando.
101 104 jguarin200
                        s0sgn <= dvd32(31);
102
                        s0uexp <= dvd32(30 downto 23);
103 99 jguarin200
                end if;
104 137 jguarin200
        end process;
105
        qout32(31) <= s0sgn;
106
        process (s0e129,s0q)
107
        begin
108
                --! Etapa 0: Calcular direcci&oacute;n a partir del exponente, salida y normalizaci&oacute;n de la mantissa.
109
                if s0q(17)='1' then
110
                        qout32(22 downto 7) <= (others => '0');
111
                        qout32(30 downto 23) <= s0e129+255;
112
                else
113
                        qout32(22 downto 7) <= s0q(15 downto 0);
114
                        qout32(30 downto 23) <= s0e129+254;
115
                end if;
116
 
117 99 jguarin200
        end process;
118
 
119
        --! Combinatorial Gremlin: Etapa 0, calculo del exponente. 
120 104 jguarin200
        process(s0uexp)
121
        begin
122
                for i in 7 downto 0 loop
123
                        s0e129(i)<=not(s0uexp(i));
124
                end loop;
125
        end process;
126
        qout32(6 downto 0) <= (others => '0');
127 99 jguarin200
 
128 153 jguarin200
end architecture;

powered by: WebSVN 2.1.0

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