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

Subversion Repositories pdp8

[/] [pdp8/] [trunk/] [de2_115/] [pdp8_top.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 trurl
--!
2
--! DE2-115 PDP-8 Processor
3
--!
4
--! \brief
5
--!      PDP-8 implementation for the DE2-115 board
6
--!
7
--! \details
8
--!     Switch 17 - Single step
9
--!     Switch 16 - Halt
10
--!     Switches 11 to 0 - Front panel data switches
11
--!     Key 2 - Address load
12
--!     Key 1 - Continue
13
--!     Key 0 - Front panel rotator switch (press to "rotate")
14
--!     Hex 3 to 0 - Data register
15
--!     Red LEDs 14 to 0 - Address register
16
--!
17
--! \file
18 4 trurl
--!      pdp8_top.vhd
19 3 trurl
--!
20
--! \author
21
--!    Joe Manojlovich - joe.manojlovich (at) gmail (dot) com
22
--!
23
--------------------------------------------------------------------
24
--
25
--  Copyright (C) 2012 Joe Manojlovich
26
--
27
-- This source file may be used and distributed without
28
-- restriction provided that this copyright statement is not
29
-- removed from the file and that any derivative work contains
30
-- the original copyright notice and the associated disclaimer.
31
--
32
-- This source file is free software; you can redistribute it
33
-- and/or modify it under the terms of the GNU Lesser General
34
-- Public License as published by the Free Software Foundation;
35
-- version 2.1 of the License.
36
--
37
-- This source is distributed in the hope that it will be
38
-- useful, but WITHOUT ANY WARRANTY; without even the implied
39
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
40
-- PURPOSE. See the GNU Lesser General Public License for more
41
-- details.
42
--
43
-- You should have received a copy of the GNU Lesser General
44
-- Public License along with this source; if not, download it
45
-- from http://www.gnu.org/licenses/lgpl.txt
46
--
47
--------------------------------------------------------------------
48
--
49
-- Comments are formatted for doxygen
50
--
51
 
52
LIBRARY ieee;
53
USE ieee.std_logic_1164.all;
54
USE ieee.std_logic_arith.all;
55
USE ieee.std_logic_unsigned.all;
56
use ieee.numeric_std;
57
use work.uart_types.all;                        --! UART Types
58
use work.dk8e_types.all;                        --! DK8E Types
59
use work.kc8e_types.all;                        --! KC8E Types
60
use work.kl8e_types.all;                        --! KL8E Types
61
use work.rk8e_types.all;                        --! RK8E Types
62
use work.rk05_types.all;                        --! RK05 Types
63
use work.ls8e_types.all;                        --! LS8E Types
64
use work.pr8e_types.all;                        --! PR8E Types
65
use work.cpu_types.all;                         --! CPU Types
66
use work.sd_types.all;                          --! SD Types
67
use work.sdspi_types.all;                       --! SPI Types
68
 
69
ENTITY pdp8_top IS
70
  generic(
71
    invert_reset : std_logic := '0' -- 0 : not invert, 1 invert
72
    );
73
 
74
  PORT (
75
    SW : IN STD_LOGIC_VECTOR(17 DOWNTO 0) := (others => 'Z');    --! Toggle switches
76
    KEY : IN STD_LOGIC_VECTOR(3 DOWNTO 0) := (others => 'Z');    --! Push buttons
77
    CLOCK_50 : IN STD_LOGIC;                                     --! Input clock
78
    LEDG : OUT STD_LOGIC_VECTOR(7 DOWNTO 0) := (others => 'Z');  --! Output green LEDs
79
    LEDR : OUT STD_LOGIC_VECTOR(17 DOWNTO 0) := (others => 'Z'); --! Output red LEDs
80
    SD_CLK : OUT STD_LOGIC;                                      --! SD card clock
81
    SD_CMD : OUT STD_LOGIC;                                      --! SD card master out slave in
82
    SD_DAT0 : IN STD_LOGIC;                                      --! SD card master in slave out
83
    SD_DAT3 : OUT STD_LOGIC;                                     --! SD card chip select
84
    UART_RXD : IN STD_LOGIC;                                     --! UART receive line
85
    UART_TXD : OUT STD_LOGIC;                                    --! UART send line
86
    HEX0 : OUT STD_LOGIC_VECTOR(6 DOWNTO 0) := (others => 'Z');  --! 7 segment display 0
87
    HEX1 : OUT STD_LOGIC_VECTOR(6 DOWNTO 0) := (others => 'Z');  --! 7 segment display 1
88
    HEX2 : OUT STD_LOGIC_VECTOR(6 DOWNTO 0) := (others => 'Z');  --! 7 segment display 2
89
    HEX3 : OUT STD_LOGIC_VECTOR(6 DOWNTO 0) := (others => 'Z')   --! 7 segment display 3
90
    );
91
END pdp8_top;
92
 
93
architecture rtl of pdp8_top is
94
  signal rk8eSTAT : rk8eSTAT_t;
95
  signal ledDATA : std_logic_vector(11 downto 0) := (others => 'Z'); --! Output data register
96
  signal swCNTL : swCNTL_t := (others => '0');                       --! Front Panel Control Switches
97
  signal swROT : swROT_t := dispPC;                                  --! Front panel rotator switch
98
  signal swOPT  : swOPT_t;                                           --! PDP-8 options
99
 
100
  signal dly: std_logic := '0';         --! Delay used for reset logic
101
  signal rst: std_logic := '0';         --! Internal reset line
102
  signal int_reset : std_logic;         --! Initial reset line
103
  signal rst_out : std_logic;           --! Reset line output to PDP-8
104
 
105
begin
106
 
107
  swOPT.KE8       <= '1';
108
  swOPT.KM8E      <= '1';
109
  swOPT.TSD       <= '1';
110
  swOPT.STARTUP   <= '1'; -- Setting the 'STARTUP' bit will cause the PDP8 to boot
111
  -- to the address in the switch register
112
 
113
  int_reset <= '0';
114
 
115
  ----------------------------------------------------------------------------
116
  --  RESET signal generator.
117
  ----------------------------------------------------------------------------
118
  process(CLOCK_50)
119
  begin
120
    if(rising_edge(CLOCK_50)) then
121
      dly <= ( not(int_reset) and     dly  and not(rst) )
122
             or ( not(int_reset) and not(dly) and     rst  );
123
      rst <= ( not(int_reset) and not(dly) and not(rst) );
124
    end if;
125
  end process;
126
 
127
  rst_out <= rst xor invert_reset ;
128
 
129
  ----------------------------------------------------------------------------
130
  -- Display toggle switch (stand in for rotator switch)
131
  ---------------------------------------------------------------------------  
132
  toggle_switch : process(CLOCK_50)
133
  begin
134
    if rising_edge(KEY(0)) then
135
      swROT <= swROT + 1;
136
    end if;
137
  end process toggle_switch;
138
 
139
  ----------------------------------------------------------------------------
140
  -- Process that converts address into hex for the 7 segment displays
141
  ---------------------------------------------------------------------------  
142
  displaystate : process (CLOCK_50)
143
  begin
144
    if rising_edge(CLOCK_50) then
145
 
146
      case ledDATA(11 downto 9) is
147
        when O"0" => HEX3 <= "1000000";
148
        when O"1" => HEX3 <= "1111001";
149
        when O"2" => HEX3 <= "0100100";
150
        when O"3" => HEX3 <= "0110000";
151
        when O"4" => HEX3 <= "0011001";
152
        when O"5" => HEX3 <= "0010010";
153
        when O"6" => HEX3 <= "0000010";
154
        when O"7" => HEX3 <= "1111000";
155
        when others => null;
156
      end case;
157
 
158
      case ledDATA(8 downto 6) is
159
        when O"0" => HEX2 <= "1000000";
160
        when O"1" => HEX2 <= "1111001";
161
        when O"2" => HEX2 <= "0100100";
162
        when O"3" => HEX2 <= "0110000";
163
        when O"4" => HEX2 <= "0011001";
164
        when O"5" => HEX2 <= "0010010";
165
        when O"6" => HEX2 <= "0000010";
166
        when O"7" => HEX2 <= "1111000";
167
        when others => null;
168
      end case;
169
 
170
      case ledDATA(5 downto 3) is
171
        when O"0" => HEX1 <= "1000000";
172
        when O"1" => HEX1 <= "1111001";
173
        when O"2" => HEX1 <= "0100100";
174
        when O"3" => HEX1 <= "0110000";
175
        when O"4" => HEX1 <= "0011001";
176
        when O"5" => HEX1 <= "0010010";
177
        when O"6" => HEX1 <= "0000010";
178
        when O"7" => HEX1 <= "1111000";
179
        when others => null;
180
      end case;
181
 
182
      case ledDATA(2 downto 0) is
183
        when O"0" => HEX0 <= "1000000";
184
        when O"1" => HEX0 <= "1111001";
185
        when O"2" => HEX0 <= "0100100";
186
        when O"3" => HEX0 <= "0110000";
187
        when O"4" => HEX0 <= "0011001";
188
        when O"5" => HEX0 <= "0010010";
189
        when O"6" => HEX0 <= "0000010";
190
        when O"7" => HEX0 <= "1111000";
191
        when others => null;
192
      end case;
193
 
194
    end if;
195
  end process displaystate;
196
 
197
  swCNTL.step <= SW(17);                -- Single step switch
198
  swCNTL.halt <= SW(16);                -- Halt switch
199
  swCNTL.loadADDR <= KEY(2);            -- Address load momentary switch
200
  swCNTL.cont <= KEY(1);                -- Continue momentary switch
201
 
202
  ----------------------------------------------------------------------------
203
  -- PDP8 Processor
204
  ---------------------------------------------------------------------------    
205
  iPDP8 : entity work.ePDP8 (rtl) port map (
206
    -- System
207
    clk      => CLOCK_50,                   --! 50 MHz Clock
208
    rst      => rst_out,                    --! Reset Button
209
    -- CPU Configuration
210
    swCPU    => swPDP8A,                    --! CPU Configured to emulate PDP8A
211
    swOPT    => swOPT,                      --! Enable Options
212
    -- Real Time Clock Configuration
213
    swRTC    => clkDK8EC2,                  --! RTC 50 Hz interrupt
214
    -- TTY1 Interfaces
215
    tty1BR   => uartBR9600,                 --! TTY1 is 9600 Baud
216
    tty1HS   => uartHSnone,                 --! TTY1 has no flow control
217
    tty1CTS  => '1',                        --! TTY1 doesn't need CTS
218
    tty1RTS  => open,                       --! TTY1 doesn't need RTS
219
    tty1RXD  => UART_RXD,                   --! TTY1 RXD (to RS-232 interface)
220
    tty1TXD  => UART_TXD,                   --! TTY1 TXD (to RS-232 interface)
221
    -- TTY2 Interfaces
222
    tty2BR   => uartBR9600,                 --! TTY2 is 9600 Baud
223
    tty2HS   => uartHSnone,                 --! TTY2 has no flow control
224
    tty2CTS  => '1',                        --! TTY2 doesn't need CTS
225
    tty2RTS  => open,                       --! TTY2 doesn't need RTS
226
    tty2RXD  => '1',                        --! TTY2 RXD (tied off)
227
    tty2TXD  => open,                       --! TTY2 TXD (tied off)
228
    -- LPR Interface
229
    lprBR    => uartBR9600,                 --! LPR is 9600 Baud
230
    lprHS    => uartHSnone,                 --! LPR has no flow control
231
    lprDTR   => '1',                        --! LPR doesn't need DTR
232
    lprDSR   => open,                       --! LPR doesn't need DSR
233
    lprRXD   => '1',                        --! LPR RXD (tied off)
234
    lprTXD   => open,                       --! LPR TXD (tied off)
235
    -- Paper Tape Reader Interface
236
    ptrBR    => uartBR9600,                 --! PTR is 9600 Baud
237
    ptrHS    => uartHSnone,                 --! PTR has no flow control
238
    ptrCTS   => '1',                        --! PTR doesn't need CTS
239
    ptrRTS   => open,                       --! PTR doesn't need RTS
240
    ptrRXD   => '1',                        --! PTR RXD (tied off)
241
    ptrTXD   => open,                       --! PTR TXD (tied off)
242
    -- Secure Digital Disk Interface
243
    sdCD     => '0',                        --! SD Card Detect
244
    sdWP     => '0',                        --! SD Write Protect
245
    sdMISO   => SD_DAT0,                    --! SD Data In
246
    sdMOSI   => SD_CMD,                     --! SD Data Out
247
    sdSCLK   => SD_CLK,                     --! SD Clock
248
    sdCS     => SD_DAT3,                    --! SD Chip Select
249
    -- Status
250
    rk8eSTAT => rk8eSTAT,                   --! Disk Status (Ignore)
251
    -- Switches and LEDS
252
    swROT    => swROT,                      --! Data LEDS display PC
253
    swDATA   => SW(11 DOWNTO 0),            --! RK8E Boot Loader Address
254
    swCNTL   => swCNTL,                     --! Switches
255
    ledRUN => LEDR(17),                     --! Run LED
256
    ledDATA => ledDATA,                     --! Data output register
257
    ledADDR => LEDR(14 downto 0)            --! Address output register
258
    );
259
 
260
end rtl;

powered by: WebSVN 2.1.0

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