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

Subversion Repositories mipsr2000

[/] [mipsr2000/] [trunk/] [Shift.vhd] - Blame information for rev 65

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

Line No. Rev Author Line
1 61 jimi39
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer:       Lazaridis Dimitris
4
-- 
5
-- Create Date:    00:18:51 04/23/2012 
6
-- Design Name: 
7
-- Module Name:    Shift - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
use IEEE.numeric_std.all;
23
use IEEE.STD_LOGIC_UNSIGNED.ALL;
24
--use IEEE.Std_logic_arith.all;
25
 
26
 
27
 
28
-- Uncomment the following library declaration if using
29
-- arithmetic functions with Signed or Unsigned values
30
--use IEEE.NUMERIC_STD.ALL;
31
 
32
-- Uncomment the following library declaration if instantiating
33
-- any Xilinx primitives in this code.
34
--library UNISIM;
35
--use UNISIM.VComponents.all;
36
 
37
entity Shift is
38
Port
39
(
40
           rst : in  STD_LOGIC;
41
                          B : in  STD_LOGIC_VECTOR (31 downto 0);
42
           ALUop : in  STD_LOGIC_VECTOR (1 downto 0);
43
           Shamt_in : in  STD_LOGIC_VECTOR (4 downto 0);
44
           S : out  STD_LOGIC_VECTOR (31 downto 0)
45
);
46
end Shift;
47
 
48
architecture Behavioral of Shift is
49
 
50
 
51
begin
52
 
53
 
54
sht:process(rst,ALUop,B,Shamt_in)
55
variable to_int: integer;
56
variable shift_temp : STD_LOGIC_VECTOR (31 downto 0);
57
begin
58
 
59
 
60
          if rst = '0' then
61
             S <= x"00000000";
62
          else
63
     to_int := CONV_INTEGER(Shamt_in);
64
          case ALUop is
65
                                    when "00" => shift_temp := std_logic_vector(unsigned(B) sll to_int); --shift_B sll 
66
                                         when "01" => shift_temp := B;
67
                                         when "10" => shift_temp := std_logic_vector(unsigned(B) srl to_int); --srl to_int; 
68
                                         when "11" => shift_temp := to_stdlogicvector(to_bitvector(B) sra to_int);--sra to_int;  
69
                                         when others => S <=(others=>'0');
70
          end case;
71
          end if;
72
 S <= shift_temp;
73
end process sht;
74
end Behavioral;
75
 

powered by: WebSVN 2.1.0

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