URL
https://opencores.org/ocsvn/raytrac/raytrac/trunk
[/] [raytrac/] [trunk/] [sqrtdiv/] [RLshifter.vhd] - Diff between revs 73 and 74
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 73 |
Rev 74 |
Line 35... |
Line 35... |
|
|
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
|
iwidth : integer := 32;
|
|
owidth : integer := 16
|
|
|
);
|
);
|
port (
|
port (
|
exp : in std_logic_vector (integer(ceil(log(real(width),2.0)))-1 downto 0);
|
exp : in std_logic_vector (integer(ceil(log(real(iwidth),2.0)))-1 downto 0);
|
mantis : in std_logic_vector (mantissa_width-1 downto 0);
|
mantis : in std_logic_vector (mantissa_width-1 downto 0);
|
result : out std_logic_vector (width-1 downto 0)
|
result : out std_logic_vector (owidth-1 downto 0)
|
);
|
);
|
end RLshifter;
|
end RLshifter;
|
|
|
|
|
architecture RLshifter_arch of RLshifter is
|
architecture RLshifter_arch of RLshifter is
|
Line 53... |
Line 54... |
|
|
inverse:
|
inverse:
|
process (mantis,exp)
|
process (mantis,exp)
|
variable expi : integer ;
|
variable expi : integer ;
|
begin
|
begin
|
|
if shiftFunction="INVERSION" then
|
expi:= conv_integer(exp);
|
expi:= conv_integer(exp);
|
|
else
|
|
expi:= conv_integer(exp(exp'high downto 1));
|
|
end if;
|
|
|
for i in width-1 downto 0 loop
|
for i in owidth-1 downto 0 loop
|
|
|
result(i)<='0';
|
result(i)<='0';
|
|
|
if shiftFunction="INVERSION" then
|
if shiftFunction="INVERSION" then
|
if i<=width-1-expi and i>=width-expi-mantissa_width then
|
if i<=owidth-1-expi and i>=owidth-expi-mantissa_width then
|
result(i)<=mantis(mantissa_width-width+expi+i);
|
result(i)<=mantis(mantissa_width-owidth+expi+i);
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if shiftFunction="SQUARE_ROOT" then
|
if shiftFunction="SQUARE_ROOT" then
|
if i<=expi then
|
if i<=expi then
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.