| 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 | * Alain Greiner <alain.greiner@lip6.fr>, 2003-2007 |
|---|
| 25 | * Nicolas Pouillon <nipo@ssji.net>, 2006 |
|---|
| 26 | * |
|---|
| 27 | * Maintainers: nipo |
|---|
| 28 | */ |
|---|
| 29 | #ifndef SOCLIB_CABA_VCI_LOCKS_H |
|---|
| 30 | #define SOCLIB_CABA_VCI_LOCKS_H |
|---|
| 31 | |
|---|
| 32 | #define SOCLIB_CABA_VCI_LOCKS_DEBUG 0 |
|---|
| 33 | |
|---|
| 34 | #include <systemc> |
|---|
| 35 | #include "caba_base_module.h" |
|---|
| 36 | #include "vci_target.h" |
|---|
| 37 | #include "mapping_table.h" |
|---|
| 38 | |
|---|
| 39 | namespace soclib { |
|---|
| 40 | namespace caba { |
|---|
| 41 | |
|---|
| 42 | using namespace sc_core; |
|---|
| 43 | |
|---|
| 44 | template<typename vci_param> |
|---|
| 45 | class VciLocks |
|---|
| 46 | : public soclib::caba::BaseModule |
|---|
| 47 | { |
|---|
| 48 | enum vci_target_fsm_state_e { |
|---|
| 49 | IDLE, |
|---|
| 50 | WAIT_IDLE, |
|---|
| 51 | WRITE_RSP, |
|---|
| 52 | READ_RSP, |
|---|
| 53 | ERROR_RSP, |
|---|
| 54 | }; |
|---|
| 55 | |
|---|
| 56 | sc_signal<int> r_vci_fsm; |
|---|
| 57 | sc_signal<typename vci_param::srcid_t> r_buf_srcid; |
|---|
| 58 | sc_signal<typename vci_param::trdid_t> r_buf_trdid; |
|---|
| 59 | sc_signal<typename vci_param::pktid_t> r_buf_pktid; |
|---|
| 60 | sc_signal<typename vci_param::eop_t> r_buf_eop; |
|---|
| 61 | sc_signal<bool> r_buf_value; |
|---|
| 62 | |
|---|
| 63 | // Activity counters |
|---|
| 64 | uint32_t m_cpt_read; // READ (teset and set) access |
|---|
| 65 | uint32_t m_cpt_write; // WRITE (reset) access |
|---|
| 66 | uint32_t m_cpt_error; // ERROR count |
|---|
| 67 | uint32_t m_cpt_idle; // IDLE cycles count |
|---|
| 68 | |
|---|
| 69 | soclib::common::Segment m_segment; |
|---|
| 70 | bool *m_contents; |
|---|
| 71 | |
|---|
| 72 | #if SOCLIB_CABA_VCI_LOCKS_DEBUG |
|---|
| 73 | uint32_t *m_taker_srcid; |
|---|
| 74 | size_t m_max_seen; |
|---|
| 75 | #endif |
|---|
| 76 | |
|---|
| 77 | protected: |
|---|
| 78 | SC_HAS_PROCESS(VciLocks); |
|---|
| 79 | |
|---|
| 80 | public: |
|---|
| 81 | sc_in<bool> p_resetn; |
|---|
| 82 | sc_in<bool> p_clk; |
|---|
| 83 | soclib::caba::VciTarget<vci_param> p_vci; |
|---|
| 84 | |
|---|
| 85 | VciLocks( |
|---|
| 86 | sc_module_name insname, |
|---|
| 87 | const soclib::common::IntTab &index, |
|---|
| 88 | const soclib::common::MappingTable &mt); |
|---|
| 89 | ~VciLocks(); |
|---|
| 90 | |
|---|
| 91 | private: |
|---|
| 92 | void transition(); |
|---|
| 93 | void genMoore(); |
|---|
| 94 | }; |
|---|
| 95 | |
|---|
| 96 | }} |
|---|
| 97 | |
|---|
| 98 | #endif /* SOCLIB_CABA_VCI_LOCKS_H */ |
|---|
| 99 | |
|---|
| 100 | // Local Variables: |
|---|
| 101 | // tab-width: 4 |
|---|
| 102 | // c-basic-offset: 4 |
|---|
| 103 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
|---|
| 104 | // indent-tabs-mode: nil |
|---|
| 105 | // End: |
|---|
| 106 | |
|---|
| 107 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
|---|
| 108 | |
|---|