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

Subversion Repositories pdp8

[/] [pdp8/] [trunk/] [nexys2/] [nexys2_pdp8.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
--!      NEXYS2 Wrapper: PDP8 Processor
7
--!
8
--! \details
9
--!      This 'layer' of code wraps the basic PDP8 implementation
10
--!      with a set of IO that is provided by the Digilent
11
--!      NexysII evaluation board.
12
--!
13
--!      Other implementations may wrapper the PDP8 with alternate
14
--!      IO implementations.
15
--!
16
--! \file
17
--!      nexys2_pdp8.vhd
18
--!
19
--! \author
20
--!      Rob Doyle - doyle (at) cox (dot) net
21
--!
22
--------------------------------------------------------------------
23
--
24
--  Copyright (C) 2009, 2010, 2011, 2012 Rob Doyle
25
--
26
-- This source file may be used and distributed without
27
-- restriction provided that this copyright statement is not
28
-- removed from the file and that any derivative work contains
29
-- the original copyright notice and the associated disclaimer.
30
--
31
-- This source file is free software; you can redistribute it
32
-- and/or modify it under the terms of the GNU Lesser General
33
-- Public License as published by the Free Software Foundation;
34
-- version 2.1 of the License.
35
--
36
-- This source is distributed in the hope that it will be
37
-- useful, but WITHOUT ANY WARRANTY; without even the implied
38
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
39
-- PURPOSE. See the GNU Lesser General Public License for more
40
-- details.
41
--
42
-- You should have received a copy of the GNU Lesser General
43
-- Public License along with this source; if not, download it
44
-- from http://www.gnu.org/licenses/lgpl.txt
45
--
46
--------------------------------------------------------------------
47
--
48
-- Comments are formatted for doxygen
49
--
50
 
51
library ieee;                                   --! IEEE Library
52
use ieee.std_logic_1164.all;                    --! IEEE 1164
53
use work.sd_types.all;                          --! SD Types
54
use work.uart_types.all;                        --! UART Types
55
use work.kc8e_types.all;                        --! KC8E Types
56
use work.kl8e_types.all;                        --! KL8E Types
57
use work.dk8e_types.all;                        --! DK8E Types
58
use work.rk8e_types.all;                        --! RK8E Types
59
use work.cpu_types.all;                         --! CPU Types
60
use work.nexys2_types.all;                      --! Nexys2 Types
61
 
62
--
63
--! NEXYS2 PDP8 Entity
64
--
65
 
66
entity eNEXYS2_PDP8 is port (
67
    clk       : in    std_logic;                --! Clock
68
    rstIN     : in    std_logic;                --! Reset Input
69
    sw        : in    sw_t;                     --! Switches
70
    led       : out   led_t;                    --! LEDs
71
    -- TTY1 Interfaces
72
    tty1RXD   : in  std_logic;                  --! TTY1 Receive Data
73
    tty1TXD   : out std_logic;                  --! TTY1 Transmit Data
74
    -- TTY2 Interfaces
75
    tty2RXD   : in  std_logic;                  --! TTY2 Receive Data
76
    tty2TXD   : out std_logic;                  --! TTY2 Transmit Data
77
    -- LPR Interface
78
    lprRXD    : in  std_logic;                  --! LPR Receive Data
79
    lprTXD    : out std_logic;                  --! LPR Transmit Data
80
    -- PTR Interface
81
    ptrRXD    : in  std_logic;                  --! PTR Receive Data
82
    ptrTXD    : out std_logic;                  --! PTR Transmit Data
83
    -- SD Interface
84
    sdCD      : in    std_logic;                --! SD Card Detect
85
    sdWP      : in    std_logic;                --! SD Write Protect
86
    sdMISO    : in    std_logic;                --! SD Data In
87
    sdMOSI    : out   std_logic;                --! SD Data Out
88
    sdSCLK    : out   std_logic;                --! SD Clock
89
    sdCS      : out   std_logic;                --! SD Chip Select
90
    -- IO Interface
91
    ioDATA    : inout iodata_t;                 --! IO Data
92
    inOEA_L   : out   std_logic;                --! Input A Output Enable
93
    inOEB_L   : out   std_logic;                --! Input B Output Enable
94
    outLEA    : out   std_logic;                --! Output A Latch Enable
95
    outLEB    : out   std_logic;                --! Output B Latch Enable
96
    -- Seven Segment Display
97
    dispSeg_L : out   dispSeg_t;                --! Display Segments
98
    dispDig_L : out   dispDig_t                 --! Display Digits
99
);
100
end eNEXYS2_PDP8;
101
 
102
--
103
--! NEXYS2 PDP8 RTL
104
--
105
 
106
architecture rtl of eNEXYS2_PDP8 is
107
 
108
    signal   swCPU    : swCPU_t;                  --! CPU Configuration Switches
109
    signal   swOPT    : swOPT_t;                  --! Option Switches
110
    signal   swRTC    : swRTC_t;                  --! RTC Configuration Switches
111
    signal   swROT    : swROT_t;                  --! Rotary Switch
112
    signal   swDATA   : data_t;                   --! Data Switches
113
    signal   swCNTL   : swCNTL_t;                 --! Control Switches
114
    signal   ledRUN   : std_logic;                --! Run LED
115
    signal   ledDATA  : data_t;                   --! Data LEDs
116
    signal   ledADDR  : xaddr_t;                  --! Addr LEDs
117
    signal   rst      : std_logic;                --! Delayed Reset
118
    signal   rk8eSTAT : rk8eSTAT_t;               --! RK8E Status
119
 
120
    --
121
    -- TTY Configuration
122
    --
123
 
124
    signal   ttyBR    : uartBR_t;                 --! Baud Rate Switches
125
    constant ttyHS    : uartHS_t   := uartHSnone; --! TTY set to no handshaking
126
    constant tty1CTS  : std_logic  := '1';        --! TTY1 Clear To Send
127
    signal   tty1RTS  : std_logic;                --! TTY1 Request To Send
128
    constant tty2CTS  : std_logic  := '1';        --! TTY2 Clear To Send
129
    signal   tty2RTS  : std_logic;                --! TTY2 Request To Send
130
 
131
    --
132
    -- LPR Configuration
133
    --
134
 
135
    constant lprBR    : uartBR_t   := uartBR9600; --! LPR set to 9600 Baud
136
    constant lprHS    : uartHS_t   := uartHSsw;   --! LPR set to SW handshaking
137
    constant lprDTR   : std_logic  := '1';        --! LPR Data Terminal Ready
138
    signal   lprDSR   : std_logic;                --! LPR Data Set Ready
139
 
140
    --
141
    -- PTR Configuration
142
    --
143
 
144
    constant ptrBR    : uartBR_t   := uartBR9600; --! PTR set to 9600 Baud
145
    constant ptrHS    : uartHS_t   := uartHSsw;   --! PTR set to SW handshaking
146
    constant ptrCTS   : std_logic  := '1';        --! PTR Clear To Send
147
    signal   ptrRTS   : std_logic;                --! PTR Request To Send
148
 
149
    --
150
    -- Disk Status
151
    --
152
 
153
    signal diskINFAIL : std_logic;                -- ! Disk is OK
154
    signal diskRWFAIL : std_logic;                -- ! Disk is OK
155
    signal diskSTAT   : std_logic_vector(0 to 7); --! Disk Status LEDS
156
 
157
begin
158
 
159
    --
160
    -- Disk Status
161
    --
162
 
163
    diskINFAIL <= '1' when (rk8eSTAT.sdSTAT.state = sdstateINFAIL) else '0';
164
    diskRWFAIL <= '1' when (rk8eSTAT.sdSTAT.state = sdstateRWFAIL) else '0';
165
 
166
    diskSTAT   <= rk8eSTAT.sdCD               &
167
                  rk8eSTAT.sdWP               &
168
                  diskINFAIL                  &
169
                  diskRWFAIL                  &
170
                  rk8eSTAT.rk05STAT(0).active &
171
                  rk8eSTAT.rk05STAT(1).active &
172
                  rk8eSTAT.rk05STAT(2).active &
173
                  rk8eSTAT.rk05STAT(3).active;
174
 
175
    --
176
    --! Nexys2 IO Interfaces
177
    --! This device holds the PDP8 reset while it reads the configuration data
178
    --
179
 
180
    iNEXYS2_IO : entity work.eNEXYS2_IO (rtl) port map (
181
        clk     => clk,
182
        rstIN   => rstIN,
183
        ttyBR   => ttyBR,
184
        swCPU   => swCPU,
185
        swOPT   => swOPT,
186
        swROT   => swROT,
187
        swRTC   => swRTC,
188
        swDATA  => swDATA,
189
        swCNTL  => swCNTL,
190
        ledRUN  => ledRUN,
191
        ledADDR => ledADDR,
192
        ledDATA => ledDATA,
193
        ioDATA  => ioDATA,
194
        inOEA_L => inOEA_L,
195
        inOEB_L => inOEB_L,
196
        outLEA  => outLEA,
197
        outLEB  => outLEB,
198
        rst     => rst
199
    );
200
 
201
    --
202
    --! Nexys2 Seven Segment Display.
203
    --! The Seven Segment Display is 'slaved' to the DATA LEDS.
204
    --
205
 
206
    iNEXYS2_DISP : entity work.eNEXYS2_DISP (rtl)  port map (
207
        clk       => clk,
208
        rst       => rst,
209
        dispData  => to_octal(ledDATA),
210
        dispSeg_L => dispSeg_L,
211
        dispDig_L => dispDig_L
212
    );
213
 
214
    --
215
    --! The PDP8 processor and peripherals
216
    --
217
 
218
    iPDP8 : entity work.ePDP8 (rtl) port map (
219
        -- System
220
        clk      => clk,
221
        rst      => rst,
222
        -- Configuration
223
        swCPU    => swCPU,
224
        swOPT    => swOPT,
225
        -- Real Time Clock
226
        swRTC    => swRTC,
227
        -- TTY1 Interface
228
        tty1BR   => ttyBR,
229
        tty1HS   => ttyHS,
230
        tty1CTS  => tty1CTS,
231
        tty1RTS  => tty1RTS,
232
        tty1RXD  => tty1RXD,
233
        tty1TXD  => tty1TXD,
234
        -- TTY2 Interface
235
        tty2BR   => ttyBR,
236
        tty2HS   => ttyHS,
237
        tty2CTS  => tty2CTS,
238
        tty2RTS  => tty2RTS,
239
        tty2RXD  => tty2RXD,
240
        tty2TXD  => tty2TXD,
241
        -- LPR Interface
242
        lprBR    => lprBR,
243
        lprHS    => lprHS,
244
        lprDTR   => lprDTR,
245
        lprDSR   => lprDSR,
246
        lprRXD   => lprRXD,
247
        lprTXD   => lprTXD,
248
        -- PTR Interface
249
        ptrBR    => ptrBR,
250
        ptrHS    => ptrHS,
251
        ptrCTS   => ptrCTS,
252
        ptrRTS   => ptrRTS,
253
        ptrRXD   => ptrRXD,
254
        ptrTXD   => ptrTXD,
255
        -- SD Interface
256
        sdCD     => sdCD,
257
        sdWP     => sdWP,
258
        sdMISO   => sdMISO,
259
        sdMOSI   => sdMOSI,
260
        sdSCLK   => sdSCLK,
261
        sdCS     => sdCS,
262
        -- RK8E Status 
263
        rk8eSTAT => rk8eSTAT,
264
        -- Switches and LEDS
265
        swROT    => swROT,
266
        swDATA   => swDATA,
267
        swCNTL   => swCNTL,
268
        ledRUN   => ledRUN,
269
        ledADDR  => ledADDR,
270
        ledDATA  => ledDATA
271
    );
272
 
273
    --
274
    -- Status MUX for LEDs
275
    --
276
 
277
    with sw(5 to 7) select
278
         led <= diskSTAT              when "000",
279
                rk8eSTAT.sdSTAT.debug when "001",
280
                rk8eSTAT.sdSTAT.err   when "010",
281
                rk8eSTAT.sdSTAT.val   when "011",
282
                rk8eSTAT.sdSTAT.rdCNT when "100",
283
                rk8eSTAT.sdSTAT.wrCNT when "101",
284
                diskSTAT              when others;
285
 
286
end rtl;

powered by: WebSVN 2.1.0

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