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

Subversion Repositories pdp8

[/] [pdp8/] [trunk/] [pdp8/] [cpu/] [sc.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 trurl
------------------------------------------------------------------
2
--!
3
--! PDP-8 Processor
4
--!
5
--! \brief
6
--!      CPU Step Counter (SC) Register
7
--!
8
--! \details
9
--!      The Step Count (SC) Register is used to control the
10
--!      number of shifts to perform on EAE LSR, ASR, and SHL
11
--!      instruction.  It is also used by the NMI instruction.
12
--!
13
--! \file
14
--!      sc.vhd
15
--!
16
--! \author
17
--!      Rob Doyle - doyle (at) cox (dot) net
18
--!
19
--------------------------------------------------------------------
20
--
21
--  Copyright (C) 2009, 2010, 2011 Rob Doyle
22
--
23
-- This source file may be used and distributed without
24
-- restriction provided that this copyright statement is not
25
-- removed from the file and that any derivative work contains
26
-- the original copyright notice and the associated disclaimer.
27
--
28
-- This source file is free software; you can redistribute it
29
-- and/or modify it under the terms of the GNU Lesser General
30
-- Public License as published by the Free Software Foundation;
31
-- version 2.1 of the License.
32
--
33
-- This source is distributed in the hope that it will be
34
-- useful, but WITHOUT ANY WARRANTY; without even the implied
35
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
36
-- PURPOSE. See the GNU Lesser General Public License for more
37
-- details.
38
--
39
-- You should have received a copy of the GNU Lesser General
40
-- Public License along with this source; if not, download it
41
-- from http://www.gnu.org/licenses/lgpl.txt
42
--
43
--------------------------------------------------------------------
44
--
45
-- Comments are formatted for doxygen
46
--
47
 
48
library ieee;                                   --! IEEE Library
49
use ieee.std_logic_1164.all;                    --! IEEE 1164
50
use ieee.numeric_std.all;                       --! IEEE Numeric Standard
51
use work.cpu_types.all;                         --! Types
52
 
53
--
54
--! CPU Step Counter (SC) Register Entity
55
--
56
 
57
entity eeSC is port (
58
    sys  : in  sys_t;                           --! Clock/Reset
59
    scOP : in  scOP_t;                          --! SC Operation
60
    AC   : in  data_t;                          --! AC register
61
    MD   : in  data_t;                          --! MD register
62
    SC   : out sc_t                             --! SC Output
63
);
64
end eeSC;
65
 
66
--
67
--! CPU Step Counter (SC) RegisterC RTL
68
--
69
 
70
architecture rtl of eeSC is
71
 
72
    signal scREG : sc_t;                        --! Step Counter
73
    signal scMUX : sc_t;                        --! Step Counter Multiplexer
74
 
75
begin
76
 
77
    --
78
    -- SC Multiplexer
79
    --
80
 
81
    with scOP select
82
        scMUX <= scREG                                       when scopNOP,
83
                 "00000"                                     when scopCLR,
84
                 "11111"                                     when scopSET,
85
                 "01100"                                     when scop12,
86
                 AC(7 to 11)                                 when scopAC7to11,
87
                 MD(7 to 11)                                 when scopMD7to11,
88
                 not(MD(7 to 11))                            when scopNOTMD7to11,
89
                 std_logic_vector(unsigned(scREG) + 1)       when scopINC,
90
                 std_logic_vector(unsigned(scREG) - 1)       when scopDEC,
91
                 std_logic_vector(unsigned(MD(7 to 11)) + 1) when scopMDP1;
92
 
93
    --
94
    --! SC Register
95
    --
96
 
97
    REG_SC : process(sys)
98
    begin
99
        if sys.rst = '1' then
100
            scREG <= "00000";
101
        elsif rising_edge(sys.clk) then
102
            scREG <= scMUX;
103
        end if;
104
    end process REG_SC;
105
 
106
    SC <= scREG;
107
 
108
end rtl;

powered by: WebSVN 2.1.0

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