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

Subversion Repositories special_functions_unit

[/] [special_functions_unit/] [Open_source_SFU/] [sfu.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 divadnauj
-- Proyecto                             : SFU IEEE754
2
-- Nombre de archivo    : SFU.vhd
3
-- Titulo                               : Special Function Unit  
4
-----------------------------------------------------------------------------   
5
-- Descripcion                  : This unit performs the floating point operations
6
--                                                sin(x), cos(x), rsqrt(x), log2(x) and exp2(x) using
7
--                                              IEE754 standard and operational compliant with GPU G80
8
--                                              architecture
9
--
10
-----------------------------------------------------------------------------   
11
-- Universidad Pedagogica y Tecnologica de Colombia.
12
-- Facultad de ingenieria.
13
-- Escuela de ingenieria Electronica - extension Tunja.
14
-- 
15
-- Autor: Cristhian Fernando Moreno Manrique
16
-- Abril 2020
17
-----------------------------------------------------------------------------   
18
 
19
 
20
library ieee;
21
use ieee.std_logic_1164.all;
22
use ieee.numeric_std.all;
23
 
24
 
25
entity sfu is
26
port(clk_i        :in std_logic;        --input clock
27
         rst_n    :in std_logic;        --reset active low
28
         start_i  :in std_logic;        --start operation
29
         src1_i   :in std_logic_vector(31 downto 0); --IEE754 input data
30
         selop_i  :in std_logic_vector(2 downto 0); --operation selection
31
         Result_o :out std_logic_vector(31 downto 0); --IEE754 result data output
32
         stall_o  :out std_logic --stall signal 
33
);
34
end entity sfu;
35
 
36
 
37
architecture structure of sfu is
38
signal sin_res, cos_res, rsqrt_res,log2_res,exp2_res :std_logic_vector(31 downto 0);
39
signal start_cordic,ready_cordic, cordic_sel,ff_ready_cordic :std_logic;
40
 
41
begin
42
--oparators intance
43
Cordic_inst: entity work.cordic
44
        port map(iClk     => clk_i,
45
                         iReset   => rst_n,
46
                 istart   => start_cordic,
47
                 iEntrada => src1_i,
48
                 oSalida1 => cos_res,
49
                 oSalida2 => sin_res,
50
                 oready   => ready_cordic);
51
 
52
 
53
rsqrt_ints: entity work.rsqrt
54
        port map(i_x     => src1_i,
55
                 o_rsqrt => rsqrt_res);
56
 
57
 log2_inst: entity work.log2_fp
58
        port map(i_x    => src1_i,
59
                 o_log2 => log2_res);
60
 
61
 exp2_inst: entity work.exp2_fp
62
        port map(i_x    => src1_i,
63
                 o_exp2 => exp2_res);
64
--stall control
65
cordic_sel <= selop_i(2) nor selop_i(1);
66
start_cordic <= cordic_sel and start_i;
67
 
68
ff_d: process(clk_i,rst_n)
69
        begin
70
                if(rst_n='0') then
71
                        ff_ready_cordic <= '0';
72
                elsif rising_edge(clk_i) then
73
                        ff_ready_cordic <= ready_cordic;
74
                end if;
75
        end process;
76
 
77
stall_o <= cordic_sel and ((not ready_cordic) or ff_ready_cordic);
78
 
79
 
80
--output multiplexer
81
 
82
with selop_i select
83
        Result_o <= sin_res     when "000",
84
                                cos_res         when "001",
85
                                rsqrt_res       when "010",
86
                                log2_res        when "011",
87
                                exp2_res        when "100",
88
                                src1_i          when others;
89
end structure;

powered by: WebSVN 2.1.0

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