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

Subversion Repositories special_functions_unit

[/] [special_functions_unit/] [Open_source_SFU/] [cordic_vhdl/] [parts/] [cordic_ieee.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 divadnauj
-- Log2 IEEE754 case detect
2
library ieee;
3
        use ieee.std_logic_1164.all;
4
        use ieee.numeric_std.all;
5
 
6
entity cordic_ieee is
7
        port      (     i_reset                                 : in std_logic;
8
                                i_clk                                   : in std_logic;
9
                                i_data                                  : in std_logic_vector(31 downto 0);
10
                                i_en                                    : in std_logic;
11
                                i_sel                                   : in std_logic;
12
                                o_case_cos                              : out std_logic_vector(31 downto 0);
13
                                o_case_sin                              : out std_logic_vector(31 downto 0);
14
                                o_case_en                               : out std_logic);
15
end entity;
16
 
17
architecture rtl of cordic_ieee is
18
 
19
        signal s_sgn    : std_logic;
20
        signal s_exp    : std_logic_vector(7 downto 0);
21
        signal s_mantis: std_logic_vector(22 downto 0);
22
 
23
begin
24
        s_sgn   <= i_data(i_data'left);
25
        s_exp   <= i_data(i_data'left-1 downto 23);
26
        s_mantis<= i_data(22 downto 0);
27
 
28
 
29
        process(s_sgn, s_exp, s_mantis,i_en, i_clk, i_reset)
30
        begin
31
 
32
                if i_reset = '0' then
33
 
34
                        o_case_sin      <= (others=>'0');
35
                        o_case_cos      <= (others=>'0');
36
                        o_case_en       <= '0';
37
 
38
                elsif rising_edge(i_clk) then
39
 
40
                        if i_en = '1' then
41
 
42
                                if i_sel = '1' then
43
 
44
                                        if s_exp = X"00" then --subnormal y 0
45
 
46
                                                o_case_en       <= '1';
47
 
48
                                                if s_sgn = '0' then
49
                                                        o_case_cos <= X"3F800000";
50
                                                        o_case_sin <= X"00000000";
51
                                                else
52
                                                        o_case_cos <= X"3F800000";
53
                                                        o_case_sin <= X"80000000";
54
                                                end if;
55
 
56
                                        elsif  s_exp = X"FF" then -- +/- inf NaN
57
 
58
                                                o_case_en <= '1';
59
 
60
                                                o_case_cos <= X"FFFFFFFF";
61
                                                o_case_sin <= X"FFFFFFFF";
62
 
63
                                        else
64
 
65
                                                o_case_en <= '0';
66
 
67
                                                o_case_cos <= X"00000000";      -- (dont care)
68
                                                o_case_sin <= X"00000000";
69
 
70
                                        end if;
71
 
72
                                else
73
 
74
                                        o_case_sin      <= (others=>'0');
75
                                        o_case_cos      <= (others=>'0');
76
                                        o_case_en       <= '0';
77
 
78
                                end if;
79
 
80
                        end if;
81
 
82
                end if;
83
 
84
        end process;
85
 
86
end rtl;
87
 

powered by: WebSVN 2.1.0

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