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

Subversion Repositories raytrac

[/] [raytrac/] [trunk/] [fpbranch/] [sqrt/] [sqrt32.vhd] - Blame information for rev 107

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

Line No. Rev Author Line
1 99 jguarin200
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.std_logic_unsigned.all;
4
 
5
 
6
 
7
 
8
entity sqrt32 is
9
        port (
10
 
11
                clk : in std_logic;
12 103 jguarin200
                rd32: in std_logic_vector(31 downto 0);
13 99 jguarin200
                sq32: out std_logic_vector(31 downto 0)
14
        );
15
end sqrt32;
16
 
17
architecture sqrt32_arch of sqrt32 is
18
 
19
        component altsyncram
20
        generic (
21
                address_aclr_a          : string;
22
                clock_enable_input_a            : string;
23
                clock_enable_output_a           : string;
24
                init_file               : string;
25
                intended_device_family          : string;
26
                lpm_hint                : string;
27
                lpm_type                : string;
28
                numwords_a              : natural;
29
                operation_mode          : string;
30
                outdata_aclr_a          : string;
31
                outdata_reg_a           : string;
32
                widthad_a               : natural;
33
                width_a         : natural;
34
                width_byteena_a         : natural
35
        );
36
        port (
37
                        clock0  : in std_logic ;
38
                        address_a       : in std_logic_vector (9 downto 0);
39
                        q_a     : out std_logic_vector (17 downto 0)
40
        );
41
        end component;
42
 
43 103 jguarin200
        signal s0sgn                    : std_logic;
44
        signal s0uexp,s0e129    : std_logic_vector(7 downto 0);
45 99 jguarin200
        signal s0q                              : std_logic_vector(17 downto 0);
46 103 jguarin200
 
47 99 jguarin200
begin
48
 
49 103 jguarin200
        --! SNAN?
50 99 jguarin200
        process (clk)
51
        begin
52
                if clk'event and clk='1' then
53
 
54
                        --!Carga de Operando.
55 103 jguarin200
                        s0sgn <= rd32(31);
56
                        s0uexp <= rd32(30 downto 23);
57 99 jguarin200
 
58 103 jguarin200
 
59 99 jguarin200
                        --! Etapa 0: Calcular direcci&oacute;n a partir del exponente y el exponente.
60 103 jguarin200
                        sq32(31) <= s0sgn;
61
                        sq32(30 downto 23) <= (s0e129(7)&s0e129(7 downto 1))+127;
62
                        sq32(22 downto 6) <= s0q(16 downto 0);
63 99 jguarin200
 
64
 
65
                end if;
66
        end process;
67
 
68
        --! Combinatorial Gremlin: Etapa 0, calculo del exponente. 
69 103 jguarin200
        s0e129<=s0uexp+("1000000"&s0uexp(0));
70
        sq32(5 downto 0) <= (others => '0');
71 104 jguarin200
        --! Combinatorial Gremlin, Etapa 0, calcula la ra&iacute;z cuadrada de la mantissa
72
        --! Recuerde que aunque rd32(23) no pertenece a la mantissa indica si el exponente es par o impar, 1 (par) y 0 (impar)
73
        altsyncram_component : altsyncram
74
        generic map (
75
                address_aclr_a => "NONE",
76
                clock_enable_input_a => "BYPASS",
77
                clock_enable_output_a => "BYPASS",
78
                init_file => "X:/Tesis/Workspace/hw/rt_lib/arith/src/trunk/fpbranch/sqrt/memsqrt.mif",
79
                intended_device_family => "Cyclone III",
80
                lpm_hint => "ENABLE_RUNTIME_MOD=NO",
81
                lpm_type => "altsyncram",
82
                numwords_a => 1024,
83
                operation_mode => "ROM",
84
                outdata_aclr_a => "NONE",
85
                outdata_reg_a => "UNREGISTERED",
86
                widthad_a => 10,
87
                width_a => 18,
88
                width_byteena_a => 1
89
        )
90
        port map (clock0 => clk,address_a => rd32(23 downto 14),q_a => s0q);
91 99 jguarin200
 
92
end sqrt32_arch;

powered by: WebSVN 2.1.0

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