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

Subversion Repositories raytrac

[/] [raytrac/] [trunk/] [sqrtdiv/] [RLshifter.vhd] - Diff between revs 69 and 70

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 69 Rev 70
Line 24... Line 24...
--     along with raytrac.  If not, see <http://www.gnu.org/licenses/>
--     along with raytrac.  If not, see <http://www.gnu.org/licenses/>
 
 
 
 
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
 
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_unsigned.all;
use work.arithpack.all;
use ieee.math_real.all;
 
--use work.arithpack.all;
 
 
 
 
 
 
entity RLshifter is
entity RLshifter is
        generic (
        generic (
                shiftFunction   : string  := "SQUARE_ROOT"
                shiftFunction   : string  := "SQUARE_ROOT";
                mantissa_width  : integer := 18;
                mantissa_width  : integer := 18;
                width                   : integer := 32
                width                   : integer := 32
 
 
        );
        );
        port (
        port (
Line 49... Line 51...
architecture RLshifter_arch of RLshifter is
architecture RLshifter_arch of RLshifter is
begin
begin
 
 
        leftShift:
        leftShift:
        if shiftFunction="SQUARE_ROOT" generate
        if shiftFunction="SQUARE_ROOT" generate
 
 
                sqroot:
                sqroot:
                process (mantis, exp)
                process (mantis, exp)
                        variable expi : integer := conv_integer(exp);
                        variable expi : integer;
                begin
                begin
                        result(width-1 downto expi+1)   <= (others=>'0');
                        expi := conv_integer(exp);
                        result(expi     downto 0)                        <= mantissa(mantissa_width-1 downto mantissa_width-1-exp);
                        lupe:
                end sqroot;
                        for i in width-1 downto 0 loop
 
                                if i>expi then
 
                                        result(i)<='0';
 
                                else
 
                                        result(i)<=mantis(mantissa_width-1-expi+i);
 
                                end if;
 
                        end loop lupe;
 
                end process sqroot;
        end generate leftShift;
        end generate leftShift;
 
 
        rightShift:
        rightShift:
        if shiftFunction="INVERSION" generate
        if shiftFunction="INVERSION" generate
 
 
                inverse:
                inverse:
                process (mantis,exp)
                process (mantis,exp)
                        variable expi : integer := conv_integer(exp);
                        variable expi : integer ;
                begin
                begin
                        if expi>0 then
                        expi:= conv_integer(exp);
                                result (width-1 downto width-expi) <= (others => '0');
 
                        end if;
                        for i in width-1 downto 0 loop
                        if mantissa_width+expi<width then
                                if i<=width-1-expi and i>=width-expi-mantissa_width then
                                result (width-1-expi downto width-mantissa_width) <= mantisa(mantissa_width-1 downto 0);
                                        result(i)
                                result (width-mantissa_width-1 downto 0) <= (others => '0');
                                        <=mantis(mantissa_width-width+expi+i);
                        else
                        else
                                result (width-1-expi downto 0) <= mantisa(mantisa_width-1 downto mantissa_width-width+expi);
                                        result(i)<='0';
                        end if;
                        end if;
 
                        end loop;
                end inverse;
                end process inverse;
 
        end generate rightShift;
end RLshifter_arch;
end RLshifter_arch;
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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