1 |
2 |
trurl |
------------------------------------------------------------------
|
2 |
|
|
--!
|
3 |
|
|
--! PDP-8 Processor
|
4 |
|
|
--!
|
5 |
|
|
--! \brief
|
6 |
|
|
--! CPU Instruction Field (IF/INF) Memory Extension Register
|
7 |
|
|
--!
|
8 |
|
|
--! \details
|
9 |
|
|
--! The Instruction Field (IF) Register is a Memory Extension
|
10 |
|
|
--! Register that is used to supply the Extended Memory
|
11 |
|
|
--! Address (EMA/XMA) during Instruction Fetches and non-
|
12 |
|
|
--! indirect data operations.
|
13 |
|
|
--!
|
14 |
|
|
--! The IF register is modified under the following
|
15 |
|
|
--! conditions:
|
16 |
|
|
--! -# the IF Register is set to 0 (Memory Field 0) on
|
17 |
|
|
--! entry to an interrupt, and
|
18 |
|
|
--! -# the IF Register is set to 0 (Memory Field 0) when
|
19 |
|
|
--! the CLEAR switch on the Front Panel is asserted, and
|
20 |
|
|
--! -# the IF Register set to the contents of the Front
|
21 |
|
|
--! Panel Data Switch Register, SR(6:10), when the
|
22 |
|
|
--! EXTD switch is asserted, and
|
23 |
|
|
--! -# the IF Register is set to the contents of the
|
24 |
|
|
--! Instruction Buffer Register (IB) after any indirect
|
25 |
|
|
--! data operations when executing an Jump to Subroutine
|
26 |
|
|
--! (JMS) instruction.
|
27 |
|
|
--! -# the IF Register is set to the contents of the
|
28 |
|
|
--! Instruction Buffer Register (IB) after any indirect
|
29 |
|
|
--! data operations when executing an Jump (JMP)
|
30 |
|
|
--! instruction.
|
31 |
|
|
--! -# the IF Register is set to the contents of the
|
32 |
|
|
--! Instruction Buffer Register (IB) when executing a
|
33 |
|
|
--! Return (RTN1 or RTN2) instruction.
|
34 |
|
|
--!
|
35 |
|
|
--! \file
|
36 |
|
|
--! if.vhd
|
37 |
|
|
--!
|
38 |
|
|
--! \author
|
39 |
|
|
--! Rob Doyle - doyle (at) cox (dot) net
|
40 |
|
|
--!
|
41 |
|
|
--------------------------------------------------------------------
|
42 |
|
|
--
|
43 |
|
|
-- Copyright (C) 2009, 2010, 2011 Rob Doyle
|
44 |
|
|
--
|
45 |
|
|
-- This source file may be used and distributed without
|
46 |
|
|
-- restriction provided that this copyright statement is not
|
47 |
|
|
-- removed from the file and that any derivative work contains
|
48 |
|
|
-- the original copyright notice and the associated disclaimer.
|
49 |
|
|
--
|
50 |
|
|
-- This source file is free software; you can redistribute it
|
51 |
|
|
-- and/or modify it under the terms of the GNU Lesser General
|
52 |
|
|
-- Public License as published by the Free Software Foundation;
|
53 |
|
|
-- version 2.1 of the License.
|
54 |
|
|
--
|
55 |
|
|
-- This source is distributed in the hope that it will be
|
56 |
|
|
-- useful, but WITHOUT ANY WARRANTY; without even the implied
|
57 |
|
|
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
58 |
|
|
-- PURPOSE. See the GNU Lesser General Public License for more
|
59 |
|
|
-- details.
|
60 |
|
|
--
|
61 |
|
|
-- You should have received a copy of the GNU Lesser General
|
62 |
|
|
-- Public License along with this source; if not, download it
|
63 |
|
|
-- from http://www.gnu.org/licenses/lgpl.txt
|
64 |
|
|
--
|
65 |
|
|
--------------------------------------------------------------------
|
66 |
|
|
--
|
67 |
|
|
-- Comments are formatted for doxygen
|
68 |
|
|
--
|
69 |
|
|
|
70 |
|
|
library ieee; --! IEEE Library
|
71 |
|
|
use ieee.std_logic_1164.all; --! IEEE 1164
|
72 |
|
|
use work.cpu_types.all; --! Types
|
73 |
|
|
|
74 |
|
|
--
|
75 |
|
|
--! CPU Instruction Field (IF/INF) Memory Extension Register Entity
|
76 |
|
|
--
|
77 |
|
|
|
78 |
|
|
entity eIF is port (
|
79 |
|
|
sys : in sys_t; --! Clock/Reset
|
80 |
|
|
ifOP : in ifOP_t; --! IF Op
|
81 |
|
|
IB : in field_t; --! IB Input
|
82 |
|
|
SR : in data_t; --! SR Input
|
83 |
|
|
INF : out field_t --! IF Output
|
84 |
|
|
);
|
85 |
|
|
end eIF;
|
86 |
|
|
|
87 |
|
|
--
|
88 |
|
|
--! CPU Instruction Field (IF/INF) Memory Extension Register RTL
|
89 |
|
|
--
|
90 |
|
|
|
91 |
|
|
architecture rtl of eIF is
|
92 |
|
|
|
93 |
|
|
signal ifREG : field_t; --! Instruction Field
|
94 |
|
|
signal ifMUX : field_t; --! Instruction Field Multiplexer
|
95 |
|
|
|
96 |
|
|
begin
|
97 |
|
|
|
98 |
|
|
--
|
99 |
|
|
-- IF Multiplexer
|
100 |
|
|
--
|
101 |
|
|
|
102 |
|
|
with ifOP select
|
103 |
|
|
ifMUX <= ifREG when ifopNOP,
|
104 |
|
|
"000" when ifopCLR,
|
105 |
|
|
IB when ifopIB,
|
106 |
|
|
SR(6 to 8) when ifopSR6to8;
|
107 |
|
|
|
108 |
|
|
--
|
109 |
|
|
--! IF Register
|
110 |
|
|
--
|
111 |
|
|
|
112 |
|
|
REG_IF : process(sys)
|
113 |
|
|
begin
|
114 |
|
|
if sys.rst = '1' then
|
115 |
|
|
ifREG <= (others => '0');
|
116 |
|
|
elsif rising_edge(sys.clk) then
|
117 |
|
|
ifREG <= ifMUX;
|
118 |
|
|
end if;
|
119 |
|
|
end process REG_IF;
|
120 |
|
|
|
121 |
|
|
INF <= ifREG;
|
122 |
|
|
|
123 |
|
|
end rtl;
|