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: nipo |
---|
27 | */ |
---|
28 | #ifndef SOCLIB_VCI_DMA_TSAR_V2_H |
---|
29 | #define SOCLIB_VCI_DMA_TSAR_V2_H |
---|
30 | |
---|
31 | #include <stdint.h> |
---|
32 | #include <systemc> |
---|
33 | #include "vci_target_fsm.h" |
---|
34 | #include "vci_initiator_fsm.h" |
---|
35 | #include "caba_base_module.h" |
---|
36 | #include "mapping_table.h" |
---|
37 | |
---|
38 | namespace soclib { |
---|
39 | namespace caba { |
---|
40 | |
---|
41 | using namespace sc_core; |
---|
42 | |
---|
43 | template<typename vci_param> |
---|
44 | class VciDmaTsarV2 |
---|
45 | : public caba::BaseModule |
---|
46 | { |
---|
47 | private: |
---|
48 | soclib::caba::VciTargetFsm<vci_param, true> m_vci_target_fsm; |
---|
49 | soclib::caba::VciInitiatorFsm<vci_param> m_vci_init_fsm; |
---|
50 | typedef typename soclib::caba::VciInitiatorReq<vci_param> req_t; |
---|
51 | |
---|
52 | bool on_write(int seg, typename vci_param::addr_t addr, typename vci_param::data_t data, int be); |
---|
53 | bool on_read(int seg, typename vci_param::addr_t addr, typename vci_param::data_t &data); |
---|
54 | void read_done( req_t *req ); |
---|
55 | void write_finish( req_t *req ); |
---|
56 | void transition(); |
---|
57 | void genMoore(); |
---|
58 | |
---|
59 | uint32_t m_src; |
---|
60 | uint32_t m_dst; |
---|
61 | uint32_t m_len; |
---|
62 | uint32_t m_offset; |
---|
63 | uint32_t m_offset_buffer; |
---|
64 | bool m_partial; |
---|
65 | bool m_must_finish; |
---|
66 | bool m_irq_enabled; |
---|
67 | bool r_irq; |
---|
68 | |
---|
69 | std::vector<uint8_t> m_data; |
---|
70 | |
---|
71 | bool m_handling; |
---|
72 | |
---|
73 | void next_req(); |
---|
74 | void ended(); |
---|
75 | |
---|
76 | protected: |
---|
77 | SC_HAS_PROCESS(VciDmaTsarV2); |
---|
78 | |
---|
79 | public: |
---|
80 | sc_in<bool> p_clk; |
---|
81 | sc_in<bool> p_resetn; |
---|
82 | soclib::caba::VciTarget<vci_param> p_vci_target; |
---|
83 | soclib::caba::VciInitiator<vci_param> p_vci_initiator; |
---|
84 | sc_out<bool> p_irq; |
---|
85 | |
---|
86 | VciDmaTsarV2( |
---|
87 | sc_module_name name, |
---|
88 | const soclib::common::MappingTable &mt, |
---|
89 | const soclib::common::IntTab &srcid, |
---|
90 | const soclib::common::IntTab &tgtid, |
---|
91 | const size_t burst_size ); |
---|
92 | }; |
---|
93 | |
---|
94 | }} |
---|
95 | |
---|
96 | #endif /* SOCLIB_VCI_DMA_TSAR_V2_H */ |
---|
97 | |
---|
98 | // Local Variables: |
---|
99 | // tab-width: 4 |
---|
100 | // c-basic-offset: 4 |
---|
101 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
102 | // indent-tabs-mode: nil |
---|
103 | // End: |
---|
104 | |
---|
105 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
106 | |
---|