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

Subversion Repositories pdp8

[/] [pdp8/] [trunk/] [pdp8/] [cpu/] [sf.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 Save Flag (SF) Memory Extension Register
7
--!
8
--! \details
9
--!      The Save Flags (SF) Register is a temporary register
10
--!      that is used for saving the Memory Extension Registers
11
--!      context during an interrupt.
12
--!
13
--!      When an interrupt occurs, the contents of the UF, IF,
14
--!      and DF registers are saved into the SF Register.
15
--!
16
--!      The contents of the SF register is saved into the
17
--!      AC register during the RIB instruction.
18
--!
19
--!      The RMF instruction restores the UB, IB, and DF
20
--!      from the SF register; i.e., it restores what the
21
--!      interrupt did.
22
--!
23
--!      When a JMP, JMS, RET1 or RET2 instruction is executed,
24
--!      the IF and UF registers are updated with contents of
25
--!      the IB and UB registers.
26
--!
27
--!      The SF Register is set to zero when the Front Panel
28
--!      CLEAR Switch is asserted.
29
--!
30
--! \file
31
--!      sf.vhd
32
--!
33
--! \author
34
--!      Rob Doyle - doyle (at) cox (dot) net
35
--!
36
--------------------------------------------------------------------
37
--
38
--  Copyright (C) 2009, 2010, 2011 Rob Doyle
39
--
40
-- This source file may be used and distributed without
41
-- restriction provided that this copyright statement is not
42
-- removed from the file and that any derivative work contains
43
-- the original copyright notice and the associated disclaimer.
44
--
45
-- This source file is free software; you can redistribute it
46
-- and/or modify it under the terms of the GNU Lesser General
47
-- Public License as published by the Free Software Foundation;
48
-- version 2.1 of the License.
49
--
50
-- This source is distributed in the hope that it will be
51
-- useful, but WITHOUT ANY WARRANTY; without even the implied
52
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
53
-- PURPOSE. See the GNU Lesser General Public License for more
54
-- details.
55
--
56
-- You should have received a copy of the GNU Lesser General
57
-- Public License along with this source; if not, download it
58
-- from http://www.gnu.org/licenses/lgpl.txt
59
--
60
--------------------------------------------------------------------
61
--
62
-- Comments are formatted for doxygen
63
--
64
 
65
library ieee;                                   --! IEEE Library
66
use ieee.std_logic_1164.all;                    --! IEEE 1164
67
use work.cpu_types.all;                         --! Types
68
 
69
--
70
--! CPU Save Flag (SF) Memory Extension Register Entity
71
--
72
 
73
entity eSF is port (
74
    sys  : in  sys_t;                           --! Clock/Reset
75
    sfOP : in  sfop_t;                          --! SF Operation
76
    DF   : in  field_t;                         --! DF Register
77
    IB   : in  field_t;                         --! IB Register
78
    UB   : in  std_logic;                       --! UF Register
79
    SF   : out sf_t                             --! SF Output
80
);
81
end eSF;
82
 
83
--
84
--! CPU Save Flag (SF) Memory Extension Register RTL
85
--
86
 
87
architecture rtl of eSF is
88
 
89
    signal sfREG : sf_t;                        --! Save Flag
90
    signal sfMUX : sf_t;                        --! Save Flag Multiplexer
91
 
92
begin
93
 
94
    --
95
    -- SF Multiplexer
96
    --
97
 
98
    with sfOP select
99
        sfMUX <= sfREG        when sfopNOP,
100
                 UB & IB & DF when sfopUBIBDF;
101
 
102
    --
103
    --! SF Register
104
    --
105
 
106
    REG_SF : process(sys)
107
    begin
108
        if sys.rst = '1' then
109
            sfREG <= (others => '0');
110
        elsif rising_edge(sys.clk) then
111
            sfREG <= sfMUX;
112
        end if;
113
    end process REG_SF;
114
 
115
    SF <= sfREG;
116
 
117
end rtl;

powered by: WebSVN 2.1.0

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