scc 2025.09
SystemC components library
tl_uh_bfm.h
1/*******************************************************************************
2 * Copyright (C) 2018 MINRES Technologies GmbH
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 *******************************************************************************/
32
33#ifndef _TLBFM_H_
34#define _TLBFM_H_
35
36#include <tlm/scc/scv/tlm_rec_target_socket.h>
37#include <tlm/scc/target_mixin.h>
38#include <tlm>
39
40namespace sysc {
41
42class tl_uh_bfm : public sc_core::sc_module {
43public:
44 SC_HAS_PROCESS(tl_uh_bfm); // NOLINT
45
46 enum { Get = 4, AccessAckData = 1, PutFullData = 0, PutPartialData = 1, AccessAck = 0 };
47
49
50 sc_core::sc_in<bool> clock;
51 sc_core::sc_in<bool> reset;
52 sc_core::sc_in<bool> a_ready;
53 sc_core::sc_out<bool> a_valid;
54 sc_core::sc_out<sc_dt::sc_uint<32>> a_bits_address;
55 sc_core::sc_out<sc_dt::sc_uint<32>> a_bits_data;
56 sc_core::sc_out<sc_dt::sc_uint<32>> a_bits_opcode;
57 sc_core::sc_out<sc_dt::sc_uint<32>> a_bits_param;
58 sc_core::sc_out<sc_dt::sc_uint<32>> a_bits_size;
59 sc_core::sc_out<sc_dt::sc_uint<32>> a_bits_source;
60 sc_core::sc_out<sc_dt::sc_uint<32>> a_bits_mask;
61 sc_core::sc_out<bool> a_bits_corrupt;
62 sc_core::sc_in<sc_dt::sc_uint<32>> d_bits_data;
63 sc_core::sc_out<bool> d_ready;
64 sc_core::sc_in<bool> d_valid;
65 sc_core::sc_in<sc_dt::sc_uint<32>> d_bits_opcode;
66 sc_core::sc_in<sc_dt::sc_uint<32>> d_bits_size;
67 sc_core::sc_in<sc_dt::sc_uint<32>> d_bits_source;
68
69 tl_uh_bfm(sc_core::sc_module_name nm, int64_t offset = 0);
70
71 ~tl_uh_bfm() override;
72
73private:
74 const int64_t offset;
75 tlm_utils::peq_with_get<tlm::tlm_generic_payload> fw_queue;
76 std::deque<tlm::tlm_generic_payload*> tl_in_progress;
77 void fw_thread();
78 void tl_response_method();
79};
80
81} /* namespace sysc */
82
83#endif /* _TLBFM_H_ */