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 |
---|
24 | * Nicolas Pouillon <nipo@ssji.net>, 2009 |
---|
25 | * |
---|
26 | * Maintainers: nipo |
---|
27 | */ |
---|
28 | #ifndef SOCLIB_VCI_XICU_H |
---|
29 | #define SOCLIB_VCI_XICU_H |
---|
30 | |
---|
31 | #include <systemc> |
---|
32 | #include "vci_target_fsm.h" |
---|
33 | #include "caba_base_module.h" |
---|
34 | #include "mapping_table.h" |
---|
35 | |
---|
36 | namespace soclib { |
---|
37 | namespace caba { |
---|
38 | |
---|
39 | template<typename vci_param> |
---|
40 | class VciXicu |
---|
41 | : public caba::BaseModule |
---|
42 | { |
---|
43 | private: |
---|
44 | std::list<soclib::common::Segment> m_seglist; |
---|
45 | soclib::caba::VciTargetFsm<vci_param, true> m_vci_fsm; |
---|
46 | |
---|
47 | const size_t m_pti_count; |
---|
48 | const size_t m_hwi_count; |
---|
49 | const size_t m_wti_count; |
---|
50 | const size_t m_irq_count; |
---|
51 | const size_t m_cfg_count; |
---|
52 | |
---|
53 | uint32_t* r_msk_pti; |
---|
54 | uint32_t* r_msk_wti; |
---|
55 | uint32_t* r_msk_hwi; |
---|
56 | uint32_t r_pti_pending; |
---|
57 | uint32_t r_wti_pending; |
---|
58 | uint32_t r_hwi_pending; |
---|
59 | uint32_t *r_pti_per; |
---|
60 | uint32_t *r_pti_val; |
---|
61 | uint32_t *r_wti_reg; |
---|
62 | uint32_t *r_cfg_reg; |
---|
63 | |
---|
64 | size_t m_faulty_wti_reg; |
---|
65 | int m_faulty_wti_msk; |
---|
66 | uint32_t m_clock_cycles; |
---|
67 | |
---|
68 | |
---|
69 | bool on_write( int seg, |
---|
70 | typename vci_param::addr_t addr, |
---|
71 | typename vci_param::data_t data, |
---|
72 | int be ); |
---|
73 | bool on_read( int seg, |
---|
74 | typename vci_param::addr_t addr, |
---|
75 | typename vci_param::data_t &data ); |
---|
76 | |
---|
77 | void transition(); |
---|
78 | void genMoore(); |
---|
79 | |
---|
80 | |
---|
81 | protected: |
---|
82 | SC_HAS_PROCESS(VciXicu); |
---|
83 | |
---|
84 | public: |
---|
85 | sc_core::sc_in<bool> p_clk; |
---|
86 | sc_core::sc_in<bool> p_resetn; |
---|
87 | soclib::caba::VciTarget<vci_param> p_vci; |
---|
88 | sc_core::sc_out<bool>* p_irq; |
---|
89 | sc_core::sc_in<bool>* p_hwi; |
---|
90 | sc_core::sc_out<uint32_t>* p_cfg; |
---|
91 | |
---|
92 | void print_trace( size_t channel ); |
---|
93 | |
---|
94 | ~VciXicu(); |
---|
95 | |
---|
96 | VciXicu( sc_core::sc_module_name name, |
---|
97 | const soclib::common::MappingTable &mt, |
---|
98 | const soclib::common::IntTab &index, |
---|
99 | size_t pti_count, |
---|
100 | size_t hwi_count, |
---|
101 | size_t wti_count, |
---|
102 | size_t irq_count, |
---|
103 | size_t cfg_count = 0 ); |
---|
104 | |
---|
105 | inline void set_faulty_wti(const int index, const int mask) |
---|
106 | { |
---|
107 | m_faulty_wti_reg = index; |
---|
108 | m_faulty_wti_msk = mask; |
---|
109 | } |
---|
110 | |
---|
111 | soclib_static_assert(vci_param::B == 4); |
---|
112 | }; |
---|
113 | |
---|
114 | }} |
---|
115 | |
---|
116 | #endif /* SOCLIB_VCI_XICU_H */ |
---|
117 | |
---|
118 | // Local Variables: |
---|
119 | // tab-width: 4 |
---|
120 | // c-basic-offset: 4 |
---|
121 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
122 | // indent-tabs-mode: nil |
---|
123 | // End: |
---|
124 | |
---|
125 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
126 | |
---|