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

Subversion Repositories pdp8

[/] [pdp8/] [trunk/] [pdp8/] [kl8e.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 Serial Interface
7
--!
8
--! \file
9
--!      kl8e.vhd
10
--!
11
--! \author
12
--!      Rob Doyle - doyle (at) cox (dot) net
13
--!
14
--------------------------------------------------------------------
15
--
16
--  Copyright (C) 2009, 2010, 2011 Rob Doyle
17
--
18
-- This source file may be used and distributed without
19
-- restriction provided that this copyright statement is not
20
-- removed from the file and that any derivative work contains
21
-- the original copyright notice and the associated disclaimer.
22
--
23
-- This source file is free software; you can redistribute it
24
-- and/or modify it under the terms of the GNU Lesser General
25
-- Public License as published by the Free Software Foundation;
26
-- version 2.1 of the License.
27
--
28
-- This source is distributed in the hope that it will be
29
-- useful, but WITHOUT ANY WARRANTY; without even the implied
30
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
31
-- PURPOSE. See the GNU Lesser General Public License for more
32
-- details.
33
--
34
-- You should have received a copy of the GNU Lesser General
35
-- Public License along with this source; if not, download it
36
-- from http://www.gnu.org/licenses/lgpl.txt
37
--
38
--------------------------------------------------------------------
39
--
40
-- Comments are formatted for doxygen
41
--
42
 
43
library ieee;                                   --! IEEE Library
44
use ieee.std_logic_1164.all;                    --! IEEE 1164
45
use ieee.numeric_std.all;                       --! IEEE Numeric Standard
46
use work.uart_types.all;                        --! UART Types
47
use work.kl8e_types.all;                        --! KL8E types
48
use work.cpu_types.all;                         --! CPU types
49
 
50
--
51
--! KL8E Serial Interface Entity
52
--
53
 
54
entity eKL8E is port (
55
    sys    : in  sys_t;                         --! Clock/Reset
56
    uartBR : in  uartBR_t;                      --! Baud Rate Select
57
    uartHS : in  uartHS_t;                      --! Handshake Select
58
    devNUM : in  devNUM_t;                      --! Device Number
59
    cpu    : in  cpu_t;                         --! CPU Output
60
    dev    : out dev_t;                         --! Device Output
61
    cts    : in  std_logic;                     --! CTS Input
62
    rts    : out std_logic;                     --! RTS Output
63
    rxd    : in  std_logic;                     --! Serial Data In
64
    txd    : out std_logic                      --! Serial Data Out
65
);
66
end eKL8E;
67
 
68
--
69
--! KL8E Serial Interface RTL
70
--
71
 
72
architecture rtl of eKL8E is
73
 
74
    signal clkBR    : std_logic;                --! Baud Rate Generator Clock Enable
75
    signal intEN    : std_logic;                --! Interrupt Enable
76
    signal rxDEV    : dev_t;                    --! RX DEV
77
    signal txDEV    : dev_t;                    --! TX DEV
78
    signal rxdevNUM : devNUM_t;                 --! Receiver Device Number
79
    signal txdevNUM : devNUM_t;                 --! Transmitter Device Number
80
 
81
begin
82
 
83
    --
84
    -- Create the Device Numbers
85
    --
86
 
87
    rxdevNUM <= devNUM;
88
    txdevNUM <= std_logic_vector(unsigned(devNUM) + "1");
89
 
90
    --
91
    --! Baud Rate Generator
92
    --
93
 
94
    iKL8E_BRG : entity work.eUART_BRG port map (
95
        sys    => sys,
96
        uartBR => uartBR,
97
        clkBR  => clkBR
98
    );
99
 
100
    --
101
    --! Receiver UART Device
102
    --
103
 
104
    iKL8E_RX : entity work.eKL8E_RX port map (
105
        sys    => sys,
106
        intEN  => intEN,
107
        clkBR  => clkBR,
108
        devNUM => rxdevNUM,
109
        cpu    => cpu,
110
        dev    => rxDEV,
111
        rxd    => rxd
112
    );
113
 
114
    --
115
    --! Transmitter UART Device
116
    --
117
 
118
    iKL8E_TX : entity work.eKL8E_TX port map (
119
        sys    => sys,
120
        intEN  => intEN,
121
        clkBR  => clkBR,
122
        devNUM => txdevNUM,
123
        cpu    => cpu,
124
        dev    => txDEV,
125
        txd    => txd
126
    );
127
 
128
    --
129
    --! This process implements a Bus Multiplexer that multiplexes
130
    --! the bus between the UART Receiver and the UART Transmitter.
131
    --
132
 
133
    KL8E_BUSMUX : process (txDev, txDev.dma, rxDev, rxDev.dma)
134
    begin
135
 
136
        if txDEV.ack = '1' then
137
            dev <= txDEV;
138
        elsif rxDEV.ack = '1' then
139
            dev <= rxDEV;
140
        else
141
            dev <= nullDEV;
142
        end if;
143
 
144
        dev.intr <= txDEV.intr or rxDEV.intr;
145
 
146
    end process KL8E_BUSMUX;
147
 
148
end rtl;

powered by: WebSVN 2.1.0

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