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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [include/] [UartSC.h] - Diff between revs 6 and 63

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 6 Rev 63
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
 
 
// SystemC Uart: definition
// SystemC Uart: definition
 
 
// This file is part of the cycle accurate model of the OpenRISC 1000 based
// This file is part of the cycle accurate model of the OpenRISC 1000 based
// system-on-chip, ORPSoC, built using Verilator.
// system-on-chip, ORPSoC, built using Verilator.
 
 
// This program is free software: you can redistribute it and/or modify it
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or (at your
// the Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
// option) any later version.
 
 
// This program is distributed in the hope that it will be useful, but WITHOUT
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
// License for more details.
// License for more details.
 
 
// You should have received a copy of the GNU Lesser General Public License
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
 
 
// $Id: $
// $Id: $
 
 
#ifndef UART_SC__H
#ifndef UART_SC__H
#define UART_SC__H
#define UART_SC__H
 
 
#include "systemc.h"
#include "systemc.h"
 
#include <stdint.h>
 
 
//! Handle UART I/O
//! Handle UART I/O
 
 
class UartSC
class UartSC
  : public sc_core::sc_module
  : public sc_core::sc_module
{
{
public:
public:
 
 
  // Constructor
  // Constructor
  UartSC (sc_core::sc_module_name  name);
  UartSC (sc_core::sc_module_name  name);
 
 
  // The ports
  // The ports
  sc_in<bool>   clk;
  sc_in<bool>   clk;
  sc_in<bool>   uarttx;
  sc_in<bool>   uarttx;
  sc_out<bool>   uartrx;
  sc_out<bool>   uartrx;
 
 
  // Init function
  // Init function
  void initUart (int clk_freq_hz, int uart_baud) ;
  void initUart (int clk_freq_hz, int uart_baud) ;
  // Transmit (from ORPSoC) handling function
  // Transmit (from ORPSoC) handling function
  void checkTx();
  void checkTx();
 
 
private:
private:
  int clocks_per_bit;
  int clocks_per_bit;
  uint8_t current_char;
  uint8_t current_char;
  int counter;
  int counter;
  int bits_received;
  int bits_received;
 
 
};      // UartSC ()
};      // UartSC ()
 
 
#endif  // UART_SC__H
#endif  // UART_SC__H
 
 

powered by: WebSVN 2.1.0

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