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

Subversion Repositories pdp1

[/] [pdp1/] [trunk/] [rtl/] [vhdl/] [pdp1rotshift.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 yannv
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    15:39:56 08/10/2009 
6
-- Design Name: 
7
-- Module Name:    pdp1rotshift - 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
 
24
entity pdp1rotshift is
25
    Port ( ac : in  STD_LOGIC_VECTOR (0 to 17);
26
           io : in  STD_LOGIC_VECTOR (0 to 17);
27
           right : in  STD_LOGIC;                               -- '0' for left, '1' for right
28
           shift : in  STD_LOGIC;                       -- '1' for shift, '0' for rotate
29
           words : in  STD_LOGIC_VECTOR (0 to 1);
30
           acout : out  STD_LOGIC_VECTOR (0 to 17);
31
           ioout : out  STD_LOGIC_VECTOR (0 to 17));
32
end pdp1rotshift;
33
 
34
architecture Behavioral of pdp1rotshift is
35
        signal input, output: std_logic_vector(0 to 35);
36
        signal word: std_logic_vector(0 to 17);
37
        constant use_readable_code: boolean := true;
38
begin
39
        cond_gen: if use_readable_code generate
40
                with words select
41
                        input <= AC&AC when "01",
42
                                                IO&IO when "10",
43
                                                AC&IO when "11",
44
                                                (others=>'-') when others;
45
 
46
                output <= std_logic_vector(unsigned(input) rol 1) when right='0' and shift='0' else
47
                                         std_logic_vector(unsigned(input) sll 1) when right='0' and shift='1' else
48
                                         std_logic_vector(unsigned(input) ror 1) when right='1' and shift='0' else
49
                                         std_logic_vector(unsigned(input) srl 1) when right='1' and shift='1' else
50
                                         (others=>'-');
51
 
52
                word <= output(0 to 17) when right='1' else output(18 to 35);
53
 
54
                with words select
55
                        acout <= word when "01",
56
                                                output(0 to 17) when "11",
57
                                                ac when others;
58
 
59
                with words select
60
                        ioout <= word when "10",
61
                                                output(18 to 35) when "11",
62
                                                io when others;
63
        end generate;
64
 
65
        cond_explicit_rtl: if not use_readable_code generate
66
                acout(0) <= ac(0) when words(1)='0' else           -- not working on AC
67
                                                                        ac(1) when right='0' else                                        -- shift/rot left
68
                                                                        '0' when shift='1' else                                          -- shift right
69
                                                                        ac(17) when words(0)='0' else             -- rotate ac right
70
                                                                        io(17) when words(0)='1' else            -- rotate ac&io right
71
                                                                        '-';
72
                acout(1 to 16) <= ac(1 to 16) when words(1)='0' else     -- not working on AC
73
                                                                                                ac(2 to 17) when right='0' else                          -- left
74
                                                                                                ac(0 to 15) when right='1' else                          -- right
75
                                                                                                (others=>'-');
76
                acout(17) <= ac(17) when words(1)='0' else               -- not working on ac
77
                                                                        ac(16) when right='1' else                                      -- shift/rot right
78
                                                                        io(0) when words(0)='1' else                      -- shift/rot left ac&io
79
                                                                        '0' when shift='1' else                                                  -- shift ac left
80
                                                                        ac(0) when shift='0' else                                 -- rotate ac left
81
                                                                        '-';
82
 
83
                ioout(0) <= io(0) when words(0)='0' else                            -- not working on IO
84
                                                                io(1) when right='0' else                                                        -- left
85
                                                                ac(17) when words(1)='1' else                   -- ac&io right
86
                                                                '0' when shift='1' else                                                          -- shift io right
87
                                                                io(17) when shift='0' else                                               -- rotate io right
88
                                                                '-';
89
                ioout(1 to 16) <= io(1 to 16) when words(0)='0' else
90
                                                                                        io(2 to 17) when right='0' else
91
                                                                                        io(0 to 15) when right='1' else
92
                                                                                        (others=>'-');
93
                ioout(17) <= io(17) when words(0)='0' else
94
                                                                        io(16) when right='1' else
95
                                                                        '0' when shift='1' else
96
                                                                        ac(0) when words(1)='1' else
97
                                                                        io(0) when words(1)='0' else
98
                                                                        '-';
99
        end generate;
100
end Behavioral;
101
 

powered by: WebSVN 2.1.0

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