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 #ifndef __LT_INITIATOR_EXTENSION_MANDATORY_H__
21 #define __LT_INITIATOR_EXTENSION_MANDATORY_H__
22 
23 #include "tlm.h"                                    // TLM headers
24 #include "tlm_utils/simple_initiator_socket.h"      // simple socket header
25 #include "extension_initiator_id.h"                 // extension header
26 #include "reporting.h"                              // reporting utility routines
27 
28 #include <cassert>                                  // assert ()
29 
30 class lt_initiator_extension_mandatory
31 : public sc_core::sc_module
32 {
33   public:
34 
35   typedef tlm::tlm_generic_payload  transaction_type;       ///< transaction type
36   typedef tlm::tlm_dmi              dmi_type;               ///< DMI type
37   typedef tlm::tlm_phase            phase_type;             ///< phase type
38   typedef tlm::tlm_sync_enum        sync_enum_type;         ///< synchronization type
39 
40   typedef tlm_utils::simple_initiator_socket< lt_initiator_extension_mandatory
41                                             , 32
42                                             , extension_initiator_id>
43                                     initiator_socket_type;  ///< initiator socket type
44 
45   SC_HAS_PROCESS( lt_initiator_extension_mandatory );
46 
47   lt_initiator_extension_mandatory                      ///< constructor
48   ( sc_core::sc_module_name name                        ///< instance name
49   , unsigned int            num_trans                   ///< number of transactions
50   , sc_dt::uint64           base_address                ///< starting address
51   );
52 
53   bool                                                  ///< transaction created
54   create_transaction                                    ///< create new transaction
55   ( transaction_type    &trans                          ///< transaction
56   );
57 
58   void
59   log_start                                             ///< log start of transaction
60   ( transaction_type    &trans                          ///< transaction
61   );
62 
63   void
64   log_end                                               ///< log end of transaction
65   ( transaction_type    &trans                          ///< transaction
66   );
67 
68   void
69   initiator_thread                                      ///< initiator thread
70   ( void
71   );
72 
73   sync_enum_type                                        ///< state
74   nb_transport_bw                                       ///< non-blocking backward transport
75   ( transaction_type    &trans                          ///< transaction
76   , phase_type          &phase                          ///< phase
77   , sc_core::sc_time    &t                              ///< time
78   );
79 
80   void
81   invalidate_dmi_properties                             ///< invalidate DMI properties
82   ( void
83   );
84 
85   void
86   invalidate_direct_mem_ptr                             ///< invalidate DMI pointer
87   ( sc_dt::uint64       start_range                     ///< start DMI range
88   , sc_dt::uint64       end_range                       ///< end DMI range
89   );
90 
91   //  member variables
92 
93   public:
94 
95   initiator_socket_type m_socket;                     ///< socket
96 
97   private:
98 
99   dmi_type              m_dmi_properties;             ///< DMI propteries
100   sc_core::sc_event     mEndEvent;                    ///< end event
101   unsigned int          m_transaction_max;            ///< transaction maximum
102   sc_dt::uint64         m_base_address;               ///< address
103   unsigned int          m_transaction_count;          ///< transaction count
104   unsigned int          m_data;                       ///< transaction data
105 };
106 
107 #endif /* __LT_INITIATOR_EXTENSION_MANDATORY_H__ */
108