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

Subversion Repositories pdp8

[/] [pdp8/] [trunk/] [pdp8/] [kl8e/] [kl8e_tx.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
--!      KL8E UART Transmitter
7
--!
8
--! \details
9
--!      The UART Transmitter is hard configured for:
10
--!      - 8 data bits
11
--!      - no parity
12
--!      - 1 stop bit
13
--!
14
--! \note
15
--!      The TTY data is transmitted with 7 bits of data and mark
16
--!      parity where the the parity is generated in the software
17
--!      and is sent as the MSB of data.
18
--!
19
--!      From the point-of-view of the UART this is just 8-bit
20
--!      data with no parity.
21
--!
22
--!      From the point-of-view of your terminal emulator, the
23
--!      data is 7 bits with mark parity (or 7 bits of data with
24
--!      two stop bits). 
25
--!
26
--!      This seemingly odd behaviour is is traceable to the
27
--!      operation of the old teletypes which were mark parity.
28
--!
29
--! \file
30
--!      kl8e_tx.vhd
31
--!
32
--! \author
33
--!      Rob Doyle - doyle (at) cox (dot) net
34
--!
35
--------------------------------------------------------------------
36
--
37
--  Copyright (C) 2009, 2010, 2011, 2012 Rob Doyle
38
--
39
-- This source file may be used and distributed without
40
-- restriction provided that this copyright statement is not
41
-- removed from the file and that any derivative work contains
42
-- the original copyright notice and the associated disclaimer.
43
--
44
-- This source file is free software; you can redistribute it
45
-- and/or modify it under the terms of the GNU Lesser General
46
-- Public License as published by the Free Software Foundation;
47
-- version 2.1 of the License.
48
--
49
-- This source is distributed in the hope that it will be
50
-- useful, but WITHOUT ANY WARRANTY; without even the implied
51
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
52
-- PURPOSE. See the GNU Lesser General Public License for more
53
-- details.
54
--
55
-- You should have received a copy of the GNU Lesser General
56
-- Public License along with this source; if not, download it
57
-- from http://www.gnu.org/licenses/lgpl.txt
58
--
59
--------------------------------------------------------------------
60
--
61
-- Comments are formatted for doxygen
62
--
63
 
64
library ieee;                                   --! IEEE Library
65
use ieee.std_logic_1164.all;                    --! IEEE 1164
66
use work.uart_types.all;                        --! UART Types
67
use work.kl8e_types.all;                        --! KL8E Types
68
use work.cpu_types.all;                         --! CPU Types
69
 
70
--
71
--! KL8E UART Transmitter Entity
72
--
73
 
74
entity eKL8E_TX is port (
75
    sys    : in  sys_t;                         --! Clock/Reset
76
    intEN  : in  std_logic;                     --! Interrupt Enable
77
    clkBR  : in  std_logic;                     --! Clock Enable (for Baud Rate)
78
    devNUM : in  devNUM_t;                      --! IOT Device
79
    cpu    : in  cpu_t;                         --! CPU Output
80
    dev    : out dev_t;                         --! Device Output
81
    txd    : out std_logic                      --! Serial Data Out
82
);
83
end eKL8E_TX;
84
 
85
--
86
--! KL8E UART Transmitter RTL
87
--
88
 
89
architecture rtl of eKL8E_TX is
90
 
91
    signal tirCLR   : std_logic;                --! Teleprinter Interrupt Request Clear
92
    signal tirSET   : std_logic;                --! Teleprinter Interrupt Request Set
93
    signal tirREG   : std_logic;                --! Teleprinter Interrupt Request
94
    signal loadUART : std_logic;                --! Load Transmitter Buffer
95
    signal intr     : std_logic;                --! UART Interrupt
96
    signal data     : ascii_t;                  --! UART Data
97
 
98
begin
99
 
100
    --
101
    --! Bus Interface
102
    --
103
 
104
    KL8E_BUSINTF : process(cpu.buss, tirREG, intEN, devNUM)
105
    begin
106
 
107
        tirSET   <= '0';
108
        tirCLR   <= '0';
109
        loadUART <= '0';
110
        dev      <= nulldev;
111
 
112
        if cpu.buss.addr(0 to 2) = opIOT and cpu.buss.addr(3 to 8) = devNUM and cpu.buss.lxdar = '1' then
113
 
114
            case cpu.buss.addr(9 to 11) is
115
 
116
                --
117
                -- IOT 6xx0: TFL - Teleprinter Flag Set
118
                --
119
 
120
                when opTFL =>
121
                    dev.ack  <= '1';
122
                    dev.devc <= devWR;
123
                    dev.skip <= '0';
124
                    tirSET   <= '1';
125
                    tirCLR   <= '0';
126
                    loadUART <= '0';
127
 
128
                --
129
                -- IOT 6xx1: TSF - Teleprinter Skip if Flag
130
                --
131
 
132
                when opTSF =>
133
                    dev.ack  <= '1';
134
                    dev.devc <= devWR;
135
                    dev.skip <= tirREG;
136
                    tirSET   <= '0';
137
                    tirCLR   <= '0';
138
                    loadUART <= '0';
139
 
140
                --
141
                -- IOT 6xx2: TCF - Teleprinter Clear Flag
142
                --
143
 
144
                when opTCF =>
145
                    dev.ack  <= '1';
146
                    dev.devc <= devWRCLR;
147
                    dev.skip <= '0';
148
                    tirSET   <= '0';
149
                    tirCLR   <= '1';
150
                    loadUART <= '0';
151
 
152
                --
153
                -- IOT 6xx4: TPC - Teleprinter Print Character
154
                --
155
 
156
                when opTPC =>
157
                    dev.ack  <= '1';
158
                    dev.devc <= devWR;
159
                    dev.skip <= '0';
160
                    tirSET   <= '0';
161
                    tirCLR   <= '0';
162
                    loadUART <= '1';
163
 
164
                --
165
                -- IOT 6xx5: TSK: Teleprinter Skip
166
                -- 
167
 
168
                when opTSK =>
169
                    dev.ack  <= '1';
170
                    dev.devc <= devWR;
171
                    dev.skip <= intEN;
172
                    tirSET   <= '0';
173
                    tirCLR   <= '0';
174
                    loadUART <= '0';
175
 
176
                --
177
                -- IOT 6xx6: TLS: Teleprinter Load and Start
178
                --
179
 
180
                when opTLS =>
181
                    dev.ack  <= '1';
182
                    dev.devc <= devWR;
183
                    dev.skip <= '0';
184
                    tirSET   <= '0';
185
                    tirCLR   <= '1';
186
                    loadUART <= '1';
187
 
188
                --
189
                -- IOT 6xx3 and 6xx7:
190
                --
191
 
192
                when others =>
193
                    null;
194
 
195
            end case;
196
        end if;
197
 
198
        dev.intr <= tirREG and intEN;
199
 
200
    end process KL8E_BUSINTF;
201
 
202
    --
203
    --! UART Data
204
    --
205
 
206
    data <= cpu.buss.data(4 to 11);
207
 
208
    --
209
    --! UART Transmitter
210
    --
211
 
212
    iUART_TX : entity work.eUART_TX port map (
213
        sys   => sys,
214
        clkBR => clkBR,
215
        data  => data,
216
        load  => loadUART,
217
        intr  => intr,
218
        txd   => txd
219
    );
220
 
221
    --
222
    --! Teleprinter Interrupt Request Flip-Flop
223
    --!
224
    --! The CAF instruction (IOCLR) should clear the transmit
225
    --! interupt flag.
226
    --
227
 
228
    KL8E_TIR : process(sys)
229
    begin
230
        if sys.rst = '1' then
231
            tirREG  <= '0';
232
        elsif rising_edge(sys.clk) then
233
            if cpu.buss.ioclr = '1' or tirCLR = '1' then
234
                tirREG <= '0';
235
            elsif tirSET = '1' or intr = '1'then
236
                tirREG <= '1';
237
            end if;
238
        end if;
239
    end process KL8E_TIR;
240
 
241
end rtl;

powered by: WebSVN 2.1.0

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