URL
https://opencores.org/ocsvn/xucpu/xucpu/trunk
[/] [xucpu/] [trunk/] [VHDL/] [shift/] [shift.vhdl] - Blame information for rev 2
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
2 |
lcdsgmtr |
-- Copyright 2015, Jürgen Defurne
|
2 |
|
|
--
|
3 |
|
|
-- This file is part of the Experimental Unstable CPU System.
|
4 |
|
|
--
|
5 |
|
|
-- The Experimental Unstable CPU System Is free software: you can redistribute
|
6 |
|
|
-- it and/or modify it under the terms of the GNU Lesser General Public License
|
7 |
|
|
-- as published by the Free Software Foundation, either version 3 of the
|
8 |
|
|
-- License, or (at your option) any later version.
|
9 |
|
|
--
|
10 |
|
|
-- The Experimental Unstable CPU System is distributed in the hope that it will
|
11 |
|
|
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
|
13 |
|
|
-- General Public License for more details.
|
14 |
|
|
--
|
15 |
|
|
-- You should have received a copy of the GNU Lesser General Public License
|
16 |
|
|
-- along with Experimental Unstable CPU System. If not, see
|
17 |
|
|
-- http://www.gnu.org/licenses/lgpl.txt.
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
LIBRARY IEEE;
|
21 |
|
|
USE IEEE.STD_LOGIC_1164.ALL;
|
22 |
|
|
|
23 |
|
|
ENTITY shift IS
|
24 |
|
|
GENERIC (
|
25 |
|
|
width : NATURAL := 16);
|
26 |
|
|
PORT (A : IN STD_LOGIC_VECTOR (width - 1 DOWNTO 0);
|
27 |
|
|
B : IN STD_LOGIC_VECTOR (width - 1 DOWNTO 0);
|
28 |
|
|
X : OUT STD_LOGIC_VECTOR (width - 1 DOWNTO 0);
|
29 |
|
|
SEL : IN STD_LOGIC_VECTOR (2 DOWNTO 0));
|
30 |
|
|
END shift;
|
31 |
|
|
|
32 |
|
|
ARCHITECTURE Behavioral OF shift IS
|
33 |
|
|
|
34 |
|
|
BEGIN
|
35 |
|
|
|
36 |
|
|
WITH SEL SELECT
|
37 |
|
|
X <=
|
38 |
|
|
A(0) & A(width - 1 DOWNTO 1) WHEN "000",
|
39 |
|
|
'0' & A(width - 1 DOWNTO 1) WHEN "001",
|
40 |
|
|
A(width - 2 DOWNTO 0) & A(width - 1) WHEN "010",
|
41 |
|
|
A(width - 2 DOWNTO 0) & '0' WHEN "011",
|
42 |
|
|
A(width - 1) & A(width - 1 DOWNTO 1) WHEN "100",
|
43 |
|
|
X"0000" WHEN OTHERS;
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
END Behavioral;
|
47 |
|
|
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.