1 |
4 |
trurl |
--!
|
2 |
|
|
--! ORSoC ordb2a-ep4ce22 PDP-8 Processor
|
3 |
|
|
--!
|
4 |
|
|
--! \brief
|
5 |
|
|
--! PDP-8 implementation for the ORSoC ordb2a-ep4ce22 board
|
6 |
|
|
--!
|
7 |
|
|
--! \details
|
8 |
|
|
--!
|
9 |
|
|
--! \file
|
10 |
|
|
--! pdp8_top.vhd
|
11 |
|
|
--!
|
12 |
|
|
--! \author
|
13 |
|
|
--! Joe Manojlovich - joe.manojlovich (at) gmail (dot) com
|
14 |
|
|
--!
|
15 |
|
|
--------------------------------------------------------------------
|
16 |
|
|
--
|
17 |
|
|
-- Copyright (C) 2012 Joe Manojlovich
|
18 |
|
|
--
|
19 |
|
|
-- This source file may be used and distributed without
|
20 |
|
|
-- restriction provided that this copyright statement is not
|
21 |
|
|
-- removed from the file and that any derivative work contains
|
22 |
|
|
-- the original copyright notice and the associated disclaimer.
|
23 |
|
|
--
|
24 |
|
|
-- This source file is free software; you can redistribute it
|
25 |
|
|
-- and/or modify it under the terms of the GNU Lesser General
|
26 |
|
|
-- Public License as published by the Free Software Foundation;
|
27 |
|
|
-- version 2.1 of the License.
|
28 |
|
|
--
|
29 |
|
|
-- This source is distributed in the hope that it will be
|
30 |
|
|
-- useful, but WITHOUT ANY WARRANTY; without even the implied
|
31 |
|
|
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
32 |
|
|
-- PURPOSE. See the GNU Lesser General Public License for more
|
33 |
|
|
-- details.
|
34 |
|
|
--
|
35 |
|
|
-- You should have received a copy of the GNU Lesser General
|
36 |
|
|
-- Public License along with this source; if not, download it
|
37 |
|
|
-- from http://www.gnu.org/licenses/lgpl.txt
|
38 |
|
|
--
|
39 |
|
|
--------------------------------------------------------------------
|
40 |
|
|
--
|
41 |
|
|
-- Comments are formatted for doxygen
|
42 |
|
|
--
|
43 |
|
|
|
44 |
|
|
LIBRARY ieee;
|
45 |
|
|
USE ieee.std_logic_1164.all;
|
46 |
|
|
USE ieee.std_logic_arith.all;
|
47 |
|
|
USE ieee.std_logic_unsigned.all;
|
48 |
|
|
use ieee.numeric_std;
|
49 |
|
|
use work.uart_types.all; --! UART Types
|
50 |
|
|
use work.dk8e_types.all; --! DK8E Types
|
51 |
|
|
use work.kc8e_types.all; --! KC8E Types
|
52 |
|
|
use work.kl8e_types.all; --! KL8E Types
|
53 |
|
|
use work.rk8e_types.all; --! RK8E Types
|
54 |
|
|
use work.rk05_types.all;
|
55 |
|
|
use work.ls8e_types.all; --! LS8E Types
|
56 |
|
|
use work.pr8e_types.all; --! PR8E Types
|
57 |
|
|
use work.cpu_types.all; --! CPU Types
|
58 |
|
|
use work.sd_types.all; --! SD Types
|
59 |
|
|
use work.sdspi_types.all; --! SPI Types
|
60 |
|
|
|
61 |
|
|
ENTITY pdp8_top IS
|
62 |
|
|
generic(
|
63 |
|
|
invert_reset : std_logic := '0' -- 0 : not invert, 1 invert
|
64 |
|
|
);
|
65 |
|
|
PORT (
|
66 |
|
|
sys_clk_pad_i : IN STD_LOGIC;
|
67 |
|
|
rst_n_pad_i : IN STD_LOGIC;
|
68 |
|
|
spi0_sck_o : OUT STD_LOGIC;
|
69 |
|
|
spi0_mosi_o : OUT STD_LOGIC;
|
70 |
|
|
spi0_miso_i : IN STD_LOGIC;
|
71 |
|
|
spi0_ss_o : OUT STD_LOGIC;
|
72 |
|
|
uart0_srx_pad_i : IN STD_LOGIC;
|
73 |
|
|
uart0_stx_pad_o : OUT STD_LOGIC
|
74 |
|
|
);
|
75 |
|
|
END pdp8_top;
|
76 |
|
|
|
77 |
|
|
architecture a of pdp8_top is
|
78 |
|
|
signal rk8eSTAT : rk8eSTAT_t;
|
79 |
|
|
signal swCNTL : swCNTL_t := (others => '0'); --! Front Panel Control Switches
|
80 |
|
|
signal swROT : swROT_t := dispPC; --! Front panel rotator switch
|
81 |
|
|
signal swOPT : swOPT_t; --! PDP-8 options
|
82 |
|
|
signal swDATA : swDATA_t; --! Front panel switches
|
83 |
|
|
|
84 |
|
|
signal dly: std_logic := '0'; --! Delay used for reset logic
|
85 |
|
|
signal rst: std_logic := '0'; --! Internal reset line
|
86 |
|
|
signal int_reset : std_logic; --! Initial reset line
|
87 |
|
|
signal rst_out : std_logic; --! Reset line output to PDP-8
|
88 |
|
|
|
89 |
|
|
begin
|
90 |
|
|
|
91 |
|
|
swOPT.KE8 <= '1';
|
92 |
|
|
swOPT.KM8E <= '1';
|
93 |
|
|
swOPT.TSD <= '1';
|
94 |
|
|
swOPT.STARTUP <= '1'; -- Setting the 'STARTUP' bit will cause the PDP8 to boot
|
95 |
|
|
-- to the address in the switch register
|
96 |
|
|
|
97 |
|
|
int_reset <= '0';
|
98 |
|
|
|
99 |
|
|
----------------------------------------------------------------------------
|
100 |
|
|
-- RESET signal generator.
|
101 |
|
|
----------------------------------------------------------------------------
|
102 |
|
|
process(sys_clk_pad_i)
|
103 |
|
|
begin
|
104 |
|
|
if(rising_edge(sys_clk_pad_i)) then
|
105 |
|
|
dly <= ( not(int_reset) and dly and not(rst) )
|
106 |
|
|
or ( not(int_reset) and not(dly) and rst );
|
107 |
|
|
rst <= ( not(int_reset) and not(dly) and not(rst) );
|
108 |
|
|
end if;
|
109 |
|
|
end process;
|
110 |
|
|
|
111 |
|
|
rst_out <= rst xor invert_reset ;
|
112 |
|
|
|
113 |
|
|
--
|
114 |
|
|
-- Front Panel Data Switches
|
115 |
|
|
--
|
116 |
|
|
|
117 |
|
|
swDATA <= o"0023";
|
118 |
|
|
|
119 |
|
|
----------------------------------------------------------------------------
|
120 |
|
|
-- PDP8 Processor
|
121 |
|
|
---------------------------------------------------------------------------
|
122 |
|
|
iPDP8 : entity work.ePDP8 (rtl) port map (
|
123 |
|
|
-- System
|
124 |
|
|
clk => sys_clk_pad_i, --! 50 MHz Clock
|
125 |
|
|
rst => rst_out, --! Reset Button
|
126 |
|
|
-- CPU Configuration
|
127 |
|
|
swCPU => swPDP8A, --! CPU Configured to emulate PDP8A
|
128 |
|
|
swOPT => swOPT, --! Enable Options
|
129 |
|
|
-- Real Time Clock Configuration
|
130 |
|
|
swRTC => clkDK8EC2, --! RTC 50 Hz interrupt
|
131 |
|
|
-- TTY1 Interfaces
|
132 |
|
|
tty1BR => uartBR9600, --! TTY1 is 9600 Baud
|
133 |
|
|
tty1HS => uartHSnone, --! TTY1 has no flow control
|
134 |
|
|
tty1CTS => '1', --! TTY1 doesn't need CTS
|
135 |
|
|
tty1RTS => open, --! TTY1 doesn't need RTS
|
136 |
|
|
tty1RXD => uart0_srx_pad_i, --! TTY1 RXD (to RS-232 interface)
|
137 |
|
|
tty1TXD => uart0_stx_pad_o, --! TTY1 TXD (to RS-232 interface)
|
138 |
|
|
-- TTY2 Interfaces
|
139 |
|
|
tty2BR => uartBR9600, --! TTY2 is 9600 Baud
|
140 |
|
|
tty2HS => uartHSnone, --! TTY2 has no flow control
|
141 |
|
|
tty2CTS => '1', --! TTY2 doesn't need CTS
|
142 |
|
|
tty2RTS => open, --! TTY2 doesn't need RTS
|
143 |
|
|
tty2RXD => '1', --! TTY2 RXD (tied off)
|
144 |
|
|
tty2TXD => open, --! TTY2 TXD (tied off)
|
145 |
|
|
-- LPR Interface
|
146 |
|
|
lprBR => uartBR9600, --! LPR is 9600 Baud
|
147 |
|
|
lprHS => uartHSnone, --! LPR has no flow control
|
148 |
|
|
lprDTR => '1', --! LPR doesn't need DTR
|
149 |
|
|
lprDSR => open, --! LPR doesn't need DSR
|
150 |
|
|
lprRXD => '1', --! LPR RXD (tied off)
|
151 |
|
|
lprTXD => open, --! LPR TXD (tied off)
|
152 |
|
|
-- Paper Tape Reader Interface
|
153 |
|
|
ptrBR => uartBR9600, --! PTR is 9600 Baud
|
154 |
|
|
ptrHS => uartHSnone, --! PTR has no flow control
|
155 |
|
|
ptrCTS => '1', --! PTR doesn't need CTS
|
156 |
|
|
ptrRTS => open, --! PTR doesn't need RTS
|
157 |
|
|
ptrRXD => '1', --! PTR RXD (tied off)
|
158 |
|
|
ptrTXD => open, --! PTR TXD (tied off)
|
159 |
|
|
-- Secure Digital Disk Interface
|
160 |
|
|
sdCD => '0', --! SD Card Detect
|
161 |
|
|
sdWP => '0', --! SD Write Protect
|
162 |
|
|
sdMISO => spi0_miso_i, --! SD Data In
|
163 |
|
|
sdMOSI => spi0_mosi_o, --! SD Data Out
|
164 |
|
|
sdSCLK => spi0_sck_o, --! SD Clock
|
165 |
|
|
sdCS => spi0_ss_o, --! SD Chip Select
|
166 |
|
|
-- Status
|
167 |
|
|
rk8eSTAT => rk8eSTAT, --! Disk Status (Ignore)
|
168 |
|
|
-- Switches and LEDS
|
169 |
|
|
swROT => swROT, --! Data LEDS display PC
|
170 |
|
|
swDATA => swDATA, --! RK8E Boot Loader Address
|
171 |
|
|
swCNTL => swCNTL, --! Switches
|
172 |
|
|
ledRUN => open, --! Run LED
|
173 |
|
|
ledDATA => open, --! Data output register
|
174 |
|
|
ledADDR => open --! Address output register
|
175 |
|
|
);
|
176 |
|
|
|
177 |
|
|
end a;
|
178 |
|
|
|