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

Subversion Repositories raytrac

[/] [raytrac/] [branches/] [fp/] [invr32.vhd] - Diff between revs 153 and 158

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 153 Rev 158
------------------------------------------------
------------------------------------------------
--! @file finvr32.vhd
--! @file finvr32.vhd
--! @brief RayTrac Floating Point Adder  
--! @brief RayTrac Floating Point Adder  
--! @author Julián Andrés Guarín Reyes
--! @author Julián Andrés Guarín Reyes
--------------------------------------------------
--------------------------------------------------
 
 
 
 
-- RAYTRAC (FP BRANCH)
-- RAYTRAC (FP BRANCH)
-- Author Julian Andres Guarin
-- Author Julian Andres Guarin
-- finvr32.vhd
-- finvr32.vhd
-- This file is part of raytrac.
-- This file is part of raytrac.
-- 
-- 
--     raytrac is free software: you can redistribute it and/or modify
--     raytrac is free software: you can redistribute it and/or modify
--     it under the terms of the GNU General Public License as published by
--     it under the terms of the GNU General Public License as published by
--     the Free Software Foundation, either version 3 of the License, or
--     the Free Software Foundation, either version 3 of the License, or
--     (at your option) any later version.
--     (at your option) any later version.
-- 
-- 
--     raytrac is distributed in the hope that it will be useful,
--     raytrac is distributed in the hope that it will be useful,
--     but WITHOUT ANY WARRANTY; without even the implied warranty of
--     but WITHOUT ANY WARRANTY; without even the implied warranty of
--     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--     GNU General Public License for more details.
--     GNU General Public License for more details.
-- 
-- 
--     You should have received a copy of the GNU General Public License
--     You should have received a copy of the GNU General Public License
--     along with raytrac.  If not, see <http://www.gnu.org/licenses/>
--     along with raytrac.  If not, see <http://www.gnu.org/licenses/>
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_unsigned.all;
 
use work.arithpack.all;
 
 
entity invr32 is
entity invr32 is
        port (
        port (
 
 
                clk             : in std_logic;
                clk             : in std_logic;
                dvd32   : in std_logic_vector(31 downto 0);
                dvd32   : in xfloat32;
                qout32  : out std_logic_vector(31 downto 0)
                qout32  : out xfloat32
        );
        );
end entity;
end entity;
architecture invr32_arch of invr32 is
architecture invr32_arch of invr32 is
 
 
        component altsyncram
        component altsyncram
        generic (
        generic (
                address_aclr_a          : string;
                address_aclr_a          : string;
                clock_enable_input_a            : string;
                clock_enable_input_a            : string;
                clock_enable_output_a           : string;
                clock_enable_output_a           : string;
                init_file               : string;
                init_file               : string;
                intended_device_family          : string;
                intended_device_family          : string;
                lpm_hint                : string;
                lpm_hint                : string;
                lpm_type                : string;
                lpm_type                : string;
                numwords_a              : natural;
                numwords_a              : natural;
                operation_mode          : string;
                operation_mode          : string;
                outdata_aclr_a          : string;
                outdata_aclr_a          : string;
                outdata_reg_a           : string;
                outdata_reg_a           : string;
                widthad_a               : natural;
                widthad_a               : natural;
                width_a         : natural;
                width_a         : natural;
                width_byteena_a         : natural
                width_byteena_a         : natural
        );
        );
        port (
        port (
                        clock0  : in std_logic ;
                        clock0  : in std_logic ;
                        rden_a  : in std_logic;
                        rden_a  : in std_logic;
                        address_a       : in std_logic_vector (9 downto 0);
                        address_a       : in std_logic_vector (9 downto 0);
                        q_a     : out std_logic_vector (17 downto 0)
                        q_a     : out std_logic_vector (17 downto 0)
        );
        );
        end component;
        end component;
 
 
        signal s0sgn                    : std_logic;
        signal s0sgn                    : std_logic;
        signal s0uexp,s0e129    : std_logic_vector(7 downto 0);
        signal s0uexp,s0e129    : std_logic_vector(7 downto 0);
        signal s0q                              : std_logic_vector(17 downto 0);
        signal s0q                              : std_logic_vector(17 downto 0);
        signal sxprop                   : std_logic;
        signal sxprop                   : std_logic;
begin
begin
 
 
        altsyncram_component : altsyncram
        altsyncram_component : altsyncram
        generic map (
        generic map (
                address_aclr_a => "NONE",
                address_aclr_a => "NONE",
                clock_enable_input_a => "BYPASS",
                clock_enable_input_a => "BYPASS",
                clock_enable_output_a => "BYPASS",
                clock_enable_output_a => "BYPASS",
                --init_file => "X:/Tesis/Workspace/hw/rt_lib/arith/src/trunk/fpbranch/invr/meminvr.mif",
                --init_file => "X:/Tesis/Workspace/hw/rt_lib/arith/src/trunk/fpbranch/invr/meminvr.mif",
                init_file => "//IMACJULIAN/imac/Code/Indigo/fp/fp/meminvr.mif",
                init_file => "//IMACJULIAN/imac/Code/Indigo/fp/fp/meminvr.mif",
                intended_device_family => "Cyclone III",
                intended_device_family => "Cyclone III",
                lpm_hint => "ENABLE_RUNTIME_MOD=NO",
                lpm_hint => "ENABLE_RUNTIME_MOD=NO",
                lpm_type => "altsyncram",
                lpm_type => "altsyncram",
                numwords_a => 1024,
                numwords_a => 1024,
                operation_mode => "ROM",
                operation_mode => "ROM",
                outdata_aclr_a => "NONE",
                outdata_aclr_a => "NONE",
                outdata_reg_a => "UNREGISTERED",
                outdata_reg_a => "UNREGISTERED",
                widthad_a => 10,
                widthad_a => 10,
                width_a => 18,
                width_a => 18,
                width_byteena_a => 1
                width_byteena_a => 1
        )
        )
        port map (
        port map (
                clock0 => clk,
                clock0 => clk,
                rden_a => '1',
                rden_a => '1',
                address_a => dvd32(22 downto 13),
                address_a => dvd32(22 downto 13),
                q_a => s0q
                q_a => s0q
        );
        );
 
 
        --! SNAN?
        --! SNAN?
        process (clk)
        process (clk)
        begin
        begin
                if clk'event and clk='1'  then
                if clk'event and clk='1'  then
                        --!Carga de Operando.
                        --!Carga de Operando.
                        s0sgn <= dvd32(31);
                        s0sgn <= dvd32(31);
                        s0uexp <= dvd32(30 downto 23);
                        s0uexp <= dvd32(30 downto 23);
                end if;
                end if;
        end process;
        end process;
        qout32(31) <= s0sgn;
        qout32(31) <= s0sgn;
        process (s0e129,s0q)
        process (s0e129,s0q)
        begin
        begin
                --! Etapa 0: Calcular direcci&oacute;n a partir del exponente, salida y normalizaci&oacute;n de la mantissa.
                --! Etapa 0: Calcular direcci&oacute;n a partir del exponente, salida y normalizaci&oacute;n de la mantissa.
                if s0q(17)='1' then
                if s0q(17)='1' then
                        qout32(22 downto 7) <= (others => '0');
                        qout32(22 downto 7) <= (others => '0');
                        qout32(30 downto 23) <= s0e129+255;
                        qout32(30 downto 23) <= s0e129+255;
                else
                else
                        qout32(22 downto 7) <= s0q(15 downto 0);
                        qout32(22 downto 7) <= s0q(15 downto 0);
                        qout32(30 downto 23) <= s0e129+254;
                        qout32(30 downto 23) <= s0e129+254;
                end if;
                end if;
 
 
        end process;
        end process;
 
 
        --! Combinatorial Gremlin: Etapa 0, calculo del exponente. 
        --! Combinatorial Gremlin: Etapa 0, calculo del exponente. 
        process(s0uexp)
        process(s0uexp)
        begin
        begin
                for i in 7 downto 0 loop
                for i in 7 downto 0 loop
                        s0e129(i)<=not(s0uexp(i));
                        s0e129(i)<=not(s0uexp(i));
                end loop;
                end loop;
        end process;
        end process;
        qout32(6 downto 0) <= (others => '0');
        qout32(6 downto 0) <= (others => '0');
 
 
 
 

powered by: WebSVN 2.1.0

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