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

Subversion Repositories raytrac

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

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
        altsyncram_component : altsyncram
50
        generic map (
51
                address_aclr_a => "NONE",
52
                clock_enable_input_a => "BYPASS",
53
                clock_enable_output_a => "BYPASS",
54 103 jguarin200
                init_file => "X:/Tesis/Workspace/hw/rt_lib/arith/src/trunk/fpbranch/sqrt/memsqrt.mif",
55 99 jguarin200
                intended_device_family => "Cyclone III",
56
                lpm_hint => "ENABLE_RUNTIME_MOD=NO",
57
                lpm_type => "altsyncram",
58
                numwords_a => 1024,
59
                operation_mode => "ROM",
60
                outdata_aclr_a => "NONE",
61 103 jguarin200
                outdata_reg_a => "UNREGISTERED",
62 99 jguarin200
                widthad_a => 10,
63
                width_a => 18,
64
                width_byteena_a => 1
65
        )
66
        port map (
67
                clock0 => clk,
68 103 jguarin200
                address_a => rd32(23 downto 14),
69 99 jguarin200
                q_a => s0q
70
        );
71 103 jguarin200
        --! SNAN?
72 99 jguarin200
        process (clk)
73
        begin
74
                if clk'event and clk='1' then
75
 
76
                        --!Carga de Operando.
77 103 jguarin200
                        s0sgn <= rd32(31);
78
                        s0uexp <= rd32(30 downto 23);
79 99 jguarin200
 
80 103 jguarin200
 
81 99 jguarin200
                        --! Etapa 0: Calcular direcci&oacute;n a partir del exponente y el exponente.
82 103 jguarin200
                        sq32(31) <= s0sgn;
83
                        sq32(30 downto 23) <= (s0e129(7)&s0e129(7 downto 1))+127;
84
                        sq32(22 downto 6) <= s0q(16 downto 0);
85 99 jguarin200
 
86
 
87
                end if;
88
        end process;
89
 
90
        --! Combinatorial Gremlin: Etapa 0, calculo del exponente. 
91 103 jguarin200
        s0e129<=s0uexp+("1000000"&s0uexp(0));
92
        sq32(5 downto 0) <= (others => '0');
93 99 jguarin200
 
94
end sqrt32_arch;

powered by: WebSVN 2.1.0

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