OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [include/] [UartSC.h] - Blame information for rev 509

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 julius
// ----------------------------------------------------------------------------
2
 
3
// SystemC Uart: definition
4
 
5
// This file is part of the cycle accurate model of the OpenRISC 1000 based
6
// system-on-chip, ORPSoC, built using Verilator.
7
 
8
// This program is free software: you can redistribute it and/or modify it
9
// under the terms of the GNU Lesser General Public License as published by
10
// the Free Software Foundation, either version 3 of the License, or (at your
11
// option) any later version.
12
 
13
// This program is distributed in the hope that it will be useful, but WITHOUT
14
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16
// License for more details.
17
 
18
// You should have received a copy of the GNU Lesser General Public License
19
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 
21
// ----------------------------------------------------------------------------
22
 
23
// $Id: $
24
 
25
#ifndef UART_SC__H
26
#define UART_SC__H
27
 
28
#include "systemc.h"
29 63 julius
#include <stdint.h>
30 6 julius
 
31
//! Handle UART I/O
32
 
33 462 julius
class UartSC:public sc_core::sc_module {
34 6 julius
public:
35
 
36 462 julius
        // Constructor
37
        UartSC(sc_core::sc_module_name name);
38 6 julius
 
39 462 julius
        // The ports
40
        sc_in < bool > clk;
41
        sc_in < bool > uarttx;
42
        sc_out < bool > uartrx;
43 6 julius
 
44 462 julius
        // Init function
45 500 julius
        void initUart(int uart_baud);
46 462 julius
        // Transmit (from ORPSoC) handling function
47
        void checkTx();
48 500 julius
        // Receieve (in ORPSoC) generation function
49
        void driveRx();
50
        // Check keyboard for entry
51
        int kbhit();
52
        // Enable canonical mode on console
53
        void nonblock(int state);
54 6 julius
 
55
private:
56 462 julius
        uint8_t current_char;
57
        int counter;
58
        int bits_received;
59 500 julius
        int ns_per_bit;
60 6 julius
 
61 500 julius
        int rx_state;
62
        int rx_counter;
63
        int rx_bits_sent;
64
        char rx_char;
65
 
66 462 julius
};                              // UartSC ()
67 6 julius
 
68 462 julius
#endif // UART_SC__H

powered by: WebSVN 2.1.0

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