gem5  v20.1.0.0
convenience_socket_bases.cc
Go to the documentation of this file.
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 #include <tlm_utils/convenience_socket_bases.h>
21 
22 #include <sstream>
23 
27 
28 namespace tlm_utils
29 {
30 
31 void
32 convenience_socket_base::display_warning(const char *text) const
33 {
34  std::stringstream s;
35  s << get_socket()->name() << ": " << text;
36  SC_REPORT_WARNING(get_report_type(), s.str().c_str());
37 }
38 
39 void
40 convenience_socket_base::display_error(const char *text) const
41 {
42  std::stringstream s;
43  s << get_socket()->name() << ": " << text;
44  SC_REPORT_ERROR(get_report_type(), s.str().c_str());
45 }
46 
47 // Simple helpers for warnings an errors to shorten in code notation.
48 
49 void
51 {
53 }
54 
55 void
57 {
58  m_owner->display_error(msg);
59 }
60 
61 const char *
63 {
64  return "/OSCI_TLM-2/simple_socket";
65 }
66 
67 void
68 simple_socket_base::elaboration_check(const char *action) const
69 {
70  if (sc_core::sc_get_curr_simcontext()->elaboration_done()) {
71  std::stringstream s;
72  s << " elaboration completed, " << action << " not allowed";
73  display_error(s.str().c_str());
74  }
75 }
76 
77 const char *
79 {
80  return "/OSCI_TLM-2/passthrough_socket";
81 }
82 
83 const char *
85 {
86  return "/OSCI_TLM-2/multi_socket";
87 }
88 
89 } // namespace tlm_utils
tlm_utils::multi_socket_base::get_report_type
virtual const char * get_report_type() const
Definition: convenience_socket_bases.cc:101
tlm_utils::convenience_socket_cb_holder::m_owner
convenience_socket_base * m_owner
Definition: convenience_socket_bases.h:81
tlm_utils::convenience_socket_base::display_warning
void display_warning(const char *msg) const
Definition: convenience_socket_bases.cc:49
tlm_utils::convenience_socket_cb_holder::display_error
void display_error(const char *msg) const
Definition: convenience_socket_bases.cc:73
sc_core::sc_get_curr_simcontext
sc_simcontext * sc_get_curr_simcontext()
Definition: sc_simcontext.cc:85
tlm_utils::simple_socket_base::elaboration_check
void elaboration_check(const char *action) const
Definition: convenience_socket_bases.cc:85
SC_REPORT_ERROR
#define SC_REPORT_ERROR(msg_type, msg)
Definition: sc_report_handler.hh:127
tlm_utils::passthrough_socket_base::get_report_type
virtual const char * get_report_type() const
Definition: convenience_socket_bases.cc:95
tlm_utils::convenience_socket_base::get_report_type
virtual const char * get_report_type() const =0
tlm_utils::convenience_socket_base::get_socket
virtual const sc_core::sc_object * get_socket() const =0
tlm_utils::convenience_socket_base::display_error
void display_error(const char *msg) const
Definition: convenience_socket_bases.cc:57
sc_simcontext.hh
SC_REPORT_WARNING
#define SC_REPORT_WARNING(msg_type, msg)
Definition: sc_report_handler.hh:123
tlm_utils
Definition: convenience_socket_bases.h:29
sc_report_handler.hh
tlm_utils::convenience_socket_cb_holder::display_warning
void display_warning(const char *msg) const
Definition: convenience_socket_bases.cc:67
tlm_utils::simple_socket_base::get_report_type
virtual const char * get_report_type() const
Definition: convenience_socket_bases.cc:79
sc_core::sc_object::name
const char * name() const
Definition: sc_object.cc:44
sc_object.hh
ArmISA::s
Bitfield< 4 > s
Definition: miscregs_types.hh:556

Generated on Wed Sep 30 2020 14:02:18 for gem5 by doxygen 1.8.17