source: trunk/modules/vci_tty_tsar/caba/source/include/vci_tty_tsar.h

Last change on this file was 1054, checked in by alain, 7 years ago

Introduce the "vci_tty_tsar" component, that has two maskable interrups
(TX_IRQ and RX_IRQ) per channel.

File size: 3.5 KB
Line 
1/* -*- c++ -*-
2 *
3 * SOCLIB_LGPL_HEADER_BEGIN
4 *
5 * This file is part of SoCLib, GNU LGPLv2.1.
6 *
7 * SoCLib is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation; version 2.1 of the License.
10 *
11 * SoCLib is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with SoCLib; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 * SOCLIB_LGPL_HEADER_END
22 *
23 * Copyright (c) UPMC, Lip6, Asim
24 *         Nicolas Pouillon <nipo@ssji.net>, 2007
25 *
26 * Maintainers: alain
27 */
28
29#ifndef SOCLIB_VCI_TTY_TSAR_H
30#define SOCLIB_VCI_TTY_TSAR_H
31
32#include <systemc>
33#include "caba_base_module.h"
34#include "tty_wrapper.h"
35#include "mapping_table.h"
36#include "int_tab.h"
37#include "vci_target.h"
38
39namespace soclib {
40namespace caba {
41
42using namespace sc_core;
43using namespace soclib::common;
44
45///////////////////////////////////////////
46template<typename vci_param>
47class VciTtyTsar
48///////////////////////////////////////////
49        : public soclib::caba::BaseModule
50{
51public:
52
53    typedef typename vci_param::fast_addr_t  vci_addr_t;
54    typedef typename vci_param::fast_data_t  vci_data_t;
55    typedef typename vci_param::srcid_t      vci_srcid_t;
56    typedef typename vci_param::trdid_t      vci_trdid_t;
57    typedef typename vci_param::pktid_t      vci_pktid_t;
58
59
60    enum fsm_state_e
61    {
62        IDLE,
63        RSP_WRITE,
64        RSP_READ,
65        RSP_ERROR,
66    };
67
68    // Ports
69    sc_in<bool>                                 p_clk;
70    sc_in<bool>                                 p_resetn;
71    soclib::caba::VciTarget<vci_param>          p_vci;
72    sc_out<bool>*                               p_irq_rx;
73    sc_out<bool>*                               p_irq_tx;
74
75        VciTtyTsar( sc_module_name                  name,
76                        const IntTab                    &index,
77                        const MappingTable              &mt,
78                const std::vector<std::string>  &names );
79
80        VciTtyTsar( sc_module_name                  name, 
81                const IntTab                    &index,
82                        const MappingTable              &mt,
83                const char*                     first_name, ...);
84
85
86    ~VciTtyTsar();
87   
88
89private:
90
91    // Registers
92    sc_signal<int>                              r_fsm_state;
93    sc_signal<vci_data_t>                       r_rdata;
94    sc_signal<vci_srcid_t>                      r_srcid;
95    sc_signal<vci_trdid_t>                      r_trdid;
96    sc_signal<vci_pktid_t>                      r_pktid;
97    sc_signal<bool>                             r_rx_irq_enable[32];
98    sc_signal<bool>                             r_tx_irq_enable[32];
99     
100    std::vector<soclib::common::TtyWrapper*>    m_term;
101    std::list<soclib::common::Segment>          m_seglist;
102
103    void transition();
104    void genMoore();
105
106        void init(const std::vector<std::string> &names );
107
108protected:
109
110    SC_HAS_PROCESS(VciTtyTsar);
111
112public:
113
114    void print_trace( size_t channel );
115};
116
117}}
118
119#endif /* SOCLIB_VCI_TTY_TSAR_H */
120
121// Local Variables:
122// tab-width: 4
123// c-basic-offset: 4
124// c-file-offsets:((innamespace . 0)(inline-open . 0))
125// indent-tabs-mode: nil
126// End:
127
128// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
129
Note: See TracBrowser for help on using the repository browser.