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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [src/] [components/] [ALU/] [shift.vhdl] - Blame information for rev 28

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

Line No. Rev Author Line
1 8 lcdsgmtr
LIBRARY IEEE;
2
USE IEEE.STD_LOGIC_1164.ALL;
3
USE IEEE.NUMERIC_STD.ALL;
4
 
5
ENTITY shift IS
6
 
7
  GENERIC (
8
    w_data : NATURAL RANGE 1 TO 32 := 16);
9
 
10
  PORT (
11
    A  : IN  STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0);
12
    OP : IN  STD_LOGIC_VECTOR(1 DOWNTO 0);
13
    Y  : OUT STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0));
14
 
15
END shift;
16
 
17
ARCHITECTURE Behavioral OF shift IS
18
 
19
  CONSTANT ZERO : STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0)
20
    := (OTHERS => '0');
21
  CONSTANT ONE  : STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0)
22
    := STD_LOGIC_VECTOR(to_unsigned(1, w_data));
23
 
24
BEGIN  -- Behavioral
25
 
26
  SH1: PROCESS (A,OP)
27
  BEGIN  -- PROCESS SH1
28
    CASE OP IS
29
      WHEN "00" =>
30
        Y <= A(14 DOWNTO 0) & '0';
31
      WHEN "01" =>
32
        Y <= '0' & A(15 DOWNTO 1);
33
      WHEN "10" =>
34
        Y <= ZERO;
35
      WHEN "11" =>
36
        Y <= ONE;
37
      WHEN OTHERS =>
38
        NULL;
39
    END CASE;
40
  END PROCESS SH1;
41
 
42
END Behavioral;

powered by: WebSVN 2.1.0

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