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