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

Subversion Repositories raytrac

[/] [raytrac/] [trunk/] [fpbranch/] [unrm/] [shftr.vhd] - Blame information for rev 106

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

Line No. Rev Author Line
1 106 jguarin200
library ieee;
2
use ieee.std_logic_1164.all;
3
 
4
 
5
 
6
entity shftr is
7
        port (
8
                dir             : in std_logic;
9
                places  : in std_logic_vector (3 downto 0);
10
                data24  : in std_logic_vector (23 downto 0);
11
                data40  : out std_logic_vector (39 downto 0)
12
        );
13
end shftr;
14
 
15
 
16
architecture shftr_arch of shftr is
17
 
18
        component lpm_mult
19
        generic (
20
                lpm_hint                        : string;
21
                lpm_representation      : string;
22
                lpm_type                        : string;
23
                lpm_widtha                      : natural;
24
                lpm_widthb                      : natural;
25
                lpm_widthp                      : natural
26
        );
27
        port (
28
                dataa   : in std_logic_vector ( lpm_widtha-1 downto 0 );
29
                datab   : in std_logic_vector ( lpm_widthb-1 downto 0 );
30
                result  : out std_logic_vector( lpm_widthp-1 downto 0 )
31
        );
32
        end component;
33
 
34
        signal splaces  : std_logic_vector (8 downto 0);
35
        signal sdata24  : std_logic_vector (26 downto 0);
36
        signal sdata32  : std_logic_vector (31 downto 0);
37
        signal sresult  : std_logic_vector (53 downto 0);
38
 
39
begin
40
 
41
        process (places(2 downto 0))
42
        begin
43
                case places(2 downto 0) is
44
                        when "000" => splaces <= "000000001";
45
                        when "001" => splaces <= "000000010";
46
                        when "010" => splaces <= "000000100";
47
                        when "011" => splaces <= "000001000";
48
                        when "100" => splaces <= "000010000";
49
                        when "101" => splaces <= "000100000";
50
                        when "110" => splaces <= "001000000";
51
                        when others => splaces <="010000000";
52
                end case;
53
        end process;
54
        sdata24(26 downto 24) <= (others => '0');
55
        process (dir,data24,sdata32)
56
                variable offset : integer;
57
        begin
58
 
59
                if places(3) ='1' then
60
                        offset:=8;
61
                else
62
                        offset:=0;
63
                end if;
64
 
65
                data40 <= (others => '0');
66
 
67
                if dir='1' then --! Corrimiento a la derecha
68
                        for i in 23 downto 0 loop
69
                                sdata24(i) <= data24(23-i);
70
                        end loop;
71
                        for i in 31 downto 0 loop
72
                                data40(i+8-offset)  <= sdata32(31-i);
73
                        end loop;
74
                else
75
                        sdata24(23 downto 0)     <= data24;
76
                        for i in 31 downto 0 loop
77
                                data40(i+offset)        <= sdata32(i);
78
                        end loop;
79
                end if;
80
        end process;
81
 
82
        the_shifter:
83
        for i in 2 downto 0 generate
84
                shiftermultiplier: lpm_mult
85
                generic map ("DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9","UNSIGNED","LPM_MULT",9,9,18)
86
                port    map (splaces,sdata24(i*9+8 downto i*9),sresult(i*18+17 downto i*18));
87
        end generate;
88
 
89
        sdata32(31 downto 27) <= sresult(49 downto 45);
90
        sdata32(26 downto 18) <= sresult(44 downto 36) or sresult(35 downto 27);
91
        sdata32(17 downto 09) <= sresult(26 downto 18) or sresult(17 downto 09);
92
        sdata32(08 downto 00) <= sresult(08 downto 00);
93
 
94
 
95
 
96
end shftr_arch;
97
 
98
 
99
 
100
 
101
 
102
 
103
 

powered by: WebSVN 2.1.0

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