1 /*****************************************************************************
2
3 Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4 more contributor license agreements. See the NOTICE file distributed
5 with this work for additional information regarding copyright ownership.
6 Accellera licenses this file to you under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with the
8 License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15 implied. See the License for the specific language governing
16 permissions and limitations under the License.
17
18 *****************************************************************************/
19 //=====================================================================
20 /// @file initiator_top.cpp
21 //
22 /// @brief Implements instantiation and interconnect of traffic_generator
23 /// and an initiator via sc_fifos for at_1_phase_example
24 //
25 //=====================================================================
26 // Original Authors:
27 // Bill Bunton, ESLX
28 // Charles Wilson, ESLX
29 // Anna Keist, ESLX
30 // Jack Donovan, ESLX
31 //=====================================================================
32
33
34 #include "initiator_top.h" // Top traffic generator & initiator
35 #include "reporting.h" // reporting macro helpers
36
37 static const char *filename = "initiator_top.cpp"; ///< filename for reporting
38
39 /// Constructor
40
initiator_top(sc_core::sc_module_name name,const unsigned int ID,sc_dt::uint64 base_address_1,sc_dt::uint64 base_address_2,unsigned int active_txn_count)41 initiator_top::initiator_top
42 ( sc_core::sc_module_name name
43 , const unsigned int ID
44 , sc_dt::uint64 base_address_1
45 , sc_dt::uint64 base_address_2
46 , unsigned int active_txn_count
47 )
48 :sc_module (name) // module name for top
49
50 ,initiator_socket ("at_initiator_socket") // TLM socket
51
52 ,m_ID (ID) // initiator ID
53
54 ,m_initiator // Init initiator
55 ("m_initiator_1_phase"
56 ,ID
57 ,sc_core::sc_time(7, sc_core::SC_NS) // set initiator end rsp delay
58 )
59
60 ,m_traffic_gen // Init traffic Generator
61 ("m_traffic_gen"
62 ,ID
63 ,base_address_1 // first base address
64 ,base_address_2 // second base address
65 ,active_txn_count // Max active transactions
66 )
67
68 {
69 /// Bind ports to m_request_fifo between m_initiator and m_traffic_gen
70 m_traffic_gen.request_out_port (m_request_fifo);
71 m_initiator.request_in_port (m_request_fifo);
72
73 /// Bind ports to m_response_fifo between m_initiator and m_traffic_gen
74 m_initiator.response_out_port (m_response_fifo);
75 m_traffic_gen.response_in_port (m_response_fifo);
76
77 /// Bind initiator-socket to initiator-socket hierarchical connection
78 m_initiator.initiator_socket(initiator_socket);
79 }
80
81 //=====================================================================
82 /// @fn initiator_top::invalidate_direct_mem_ptr
83 ///
84 /// @brief Unused mandatory virtual implementation
85 ///
86 /// @details
87 /// No DMI is implemented in this example so unused
88 ///
89 //=====================================================================
90 void
invalidate_direct_mem_ptr(sc_dt::uint64 start_range,sc_dt::uint64 end_range)91 initiator_top::invalidate_direct_mem_ptr
92 ( sc_dt::uint64 start_range
93 , sc_dt::uint64 end_range
94 )
95 {
96 std::ostringstream msg; // log message
97 msg.str ("");
98
99 msg << "Initiator: " << m_ID << " Not implemented";
100 REPORT_ERROR(filename, __FUNCTION__, msg.str());
101 } // end invalidate_direct_mem_ptr
102
103 //=====================================================================
104 /// @fn initiator_top::nb_transport_bw
105 //
106 /// @brief Unused mandatory virtual implementation
107 ///
108 /// @details
109 /// Unused implementation from hierarchichal connectivity of
110 /// Initiator sockets.
111 ///
112 //=====================================================================
113 tlm::tlm_sync_enum
nb_transport_bw(tlm::tlm_generic_payload & payload,tlm::tlm_phase & phase,sc_core::sc_time & delta)114 initiator_top::nb_transport_bw
115 ( tlm::tlm_generic_payload &payload
116 , tlm::tlm_phase &phase
117 , sc_core::sc_time &delta
118 )
119 {
120 std::ostringstream msg; // log message
121 msg.str ("");
122
123 msg << "Initiator: " << m_ID
124 << " Not implemented, for hierachical connection of initiator socket";
125 REPORT_ERROR(filename, __FUNCTION__, msg.str());
126
127 return tlm::TLM_COMPLETED;
128
129 } // end nb_transport_bw
130