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

Subversion Repositories raytrac

[/] [raytrac/] [trunk/] [sqrtdiv/] [shifter2xstage.vhd] - Blame information for rev 148

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

Line No. Rev Author Line
1 60 jguarin200
------------------------------------------------
2
--! @file shifter2xstage.vhd
3
--! @brief RayTrac Arithmetic Shifter 
4
--! @author Julián Andrés Guarín Reyes
5
--------------------------------------------------
6
 
7
 
8
-- RAYTRAC
9
-- Author Julian Andres Guarin
10
-- shifter2xstage.vhd
11
-- This file is part of raytrac.
12
-- 
13
--     raytrac is free software: you can redistribute it and/or modify
14
--     it under the terms of the GNU General Public License as published by
15
--     the Free Software Foundation, either version 3 of the License, or
16
--     (at your option) any later version.
17
-- 
18
--     raytrac is distributed in the hope that it will be useful,
19
--     but WITHOUT ANY WARRANTY; without even the implied warranty of
20
--     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
--     GNU General Public License for more details.
22
-- 
23
--     You should have received a copy of the GNU General Public License
24
--     along with raytrac.  If not, see <http://www.gnu.org/licenses/>
25
 
26
library ieee;
27
use ieee.std_logic_1164.all;
28
use ieee.math_real.all;
29
use work.arithpack.all;
30
 
31
entity shifter2xstage is
32
        generic (
33
                address_width   : integer := 9;
34 73 jguarin200
                width                   : integer := 32
35 60 jguarin200
        );
36
        port (
37
                data    : in std_logic_vector (width-1 downto 0);
38
                exp             : out std_logic_vector (2*integer(ceil(log(real(width),2.0)))-1 downto 0);
39
                add             : out std_logic_vector (2*address_width-1 downto 0);
40 67 jguarin200
                zero    : out std_logic
41 60 jguarin200
        );
42
end shifter2xstage;
43
 
44
architecture shifter2xstage_arch of shifter2xstage is
45
 
46
        signal exp0     : std_logic_vector (integer(ceil(log(real(width),2.0)))-1 downto 0);
47
        signal exp1     : std_logic_vector (integer(ceil(log(real(width),2.0)))-1 downto 0);
48
        signal add0     : std_logic_vector (address_width-1 downto 0);
49
        signal add1     : std_logic_vector (address_width-1 downto 0);
50 67 jguarin200
        signal szero: std_logic_vector (1 downto 0);
51 73 jguarin200
 
52 74 jguarin200
        function exp0StringParam return string is
53 73 jguarin200
        begin
54
                if width rem 2 = 0 then
55
                        return "NO";
56
                else
57
                        return "YES";
58
                end if;
59
        end exp0StringParam;
60 74 jguarin200
        function exp1StringParam return string is
61 73 jguarin200
        begin
62
                if width rem 2 = 0 then
63
                        return "YES";
64
                else
65
                        return "NO";
66
                end if;
67
        end exp1StringParam;
68
 
69
 
70 60 jguarin200
 
71
begin
72 67 jguarin200
        zero <= szero(1) and szero(0);
73 60 jguarin200
        evenS:shifter
74 74 jguarin200
        generic map (address_width,width,exp0StringParam)
75 67 jguarin200
        port map (data,exp0,add0,szero(0));
76 60 jguarin200
        oddS:shifter
77 74 jguarin200
        generic map (address_width,width,exp1StringParam)
78 67 jguarin200
        port map (data,exp1,add1,szero(1));
79 60 jguarin200
        exp(integer(ceil(log(real(width),2.0)))-1 downto 0)<=exp0;
80
        exp(2*integer(ceil(log(real(width),2.0)))-1 downto integer(ceil(log(real(width),2.0))))<=exp1;
81
        add(address_width-1 downto 0)<=add0;
82
        add(2*address_width-1 downto address_width)<=add1;
83
end shifter2xstage_arch;
84
 

powered by: WebSVN 2.1.0

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