Browse Source

Cleanup using clang-tidy & clang-format, updated license statements

Eyck Jentzsch 1 year ago
parent
commit
4fdd3c9c66
51 changed files with 1328 additions and 1304 deletions
  1. 33
    22
      incl/scc/configurable_tracer.h
  2. 22
    22
      incl/scc/configurer.h
  3. 8
    8
      incl/scc/core/sc_logic_7.h
  4. 3
    3
      incl/scc/ext_attribute.h
  5. 3
    4
      incl/scc/initiator_mixin.h
  6. 1
    1
      incl/scc/memory.h
  7. 50
    42
      incl/scc/peq.h
  8. 28
    14
      incl/scc/perf_estimator.h
  9. 16
    13
      incl/scc/register.h
  10. 37
    25
      incl/scc/report.h
  11. 2
    2
      incl/scc/resetable.h
  12. 6
    4
      incl/scc/resource_access_if.h
  13. 19
    18
      incl/scc/router.h
  14. 14
    5
      incl/scc/scv_tr_db.h
  15. 24
    26
      incl/scc/signal_initiator_mixin.h
  16. 15
    18
      incl/scc/signal_target_mixin.h
  17. 12
    9
      incl/scc/tagged_initiator_mixin.h
  18. 18
    14
      incl/scc/tagged_target_mixin.h
  19. 3
    4
      incl/scc/target_mixin.h
  20. 27
    16
      incl/scc/time2tick.h
  21. 7
    7
      incl/scc/tlm_target.h
  22. 1
    1
      incl/scc/traceable.h
  23. 2
    2
      incl/scc/tracer.h
  24. 27
    29
      incl/scc/utilities.h
  25. 32
    34
      incl/scv4tlm/tlm2_recorder.h
  26. 2
    2
      incl/scv4tlm/tlm2_recorder_module.h
  27. 13
    14
      incl/scv4tlm/tlm_gp_data.h
  28. 1
    1
      incl/scv4tlm/tlm_gp_data_ext.h
  29. 1
    1
      incl/scv4tlm/tlm_rec_initiator_socket.h
  30. 1
    1
      incl/scv4tlm/tlm_rec_target_socket.h
  31. 3
    3
      incl/scv4tlm/tlm_recording_extension.h
  32. 37
    38
      incl/tlm/tlm_extensions.h
  33. 50
    47
      incl/tlm/tlm_signal.h
  34. 34
    33
      incl/tlm/tlm_signal_conv.h
  35. 130
    163
      incl/tlm/tlm_signal_gp.h
  36. 61
    88
      incl/tlm/tlm_signal_sockets.h
  37. 15
    3
      incl/util/delegate.h
  38. 15
    18
      incl/util/ities.h
  39. 16
    19
      incl/util/logging.h
  40. 5
    4
      incl/util/range_lut.h
  41. 62
    41
      src/configurable_tracer.cpp
  42. 121
    124
      src/configurer.cpp
  43. 44
    43
      src/perf_estimator.cpp
  44. 37
    30
      src/report.cpp
  45. 61
    57
      src/sc_logic_7.cpp
  46. 120
    146
      src/scv_tr_binary/scv_tr_binary.cpp
  47. 17
    17
      src/scv_tr_compressed.cpp
  48. 42
    47
      src/scv_tr_sqlite/scv_tr_sqlite.cpp
  49. 9
    10
      src/tracer.cpp
  50. 2
    2
      src/utilities.cpp
  51. 19
    9
      src/verilator_callbacks.cpp

+ 33
- 22
incl/scc/configurable_tracer.h View File

@@ -1,24 +1,35 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright (C) 2018, MINRES Technologies GmbH
3
+ * All rights reserved.
3 4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7 7
  *
8
- *     http://www.apache.org/licenses/LICENSE-2.0
8
+ * 1. Redistributions of source code must retain the above copyright notice,
9
+ *    this list of conditions and the following disclaimer.
9 10
  *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *******************************************************************************/
16
-/*
17
- * tracer.h
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.
18 14
  *
19
- *  Created on: Nov 9, 2016
20
- *      Author: developer
21
- */
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
+ * Contributors:
31
+ *       eyck@minres.com - initial API and implementation
32
+ ******************************************************************************/
22 33
 
23 34
 #ifndef _SCC_CONFIGURABLE_TRACER_H_
24 35
 #define _SCC_CONFIGURABLE_TRACER_H_
@@ -40,17 +51,17 @@ public:
40 51
 
41 52
     ~configurable_tracer();
42 53
 
43
-    void add_control(){
44
-        for(auto* o:sc_core::sc_get_top_level_objects(sc_core::sc_curr_simcontext))
45
-            augment_object_hierarchical(o);
54
+    void add_control() {
55
+        for (auto *o : sc_core::sc_get_top_level_objects(sc_core::sc_curr_simcontext)) augment_object_hierarchical(o);
46 56
     }
57
+
47 58
 protected:
48 59
     void descend(const sc_core::sc_object *) override;
49
-    bool get_trace_enabled(const sc_core::sc_object*, bool =false );
50
-    void augment_object_hierarchical(const sc_core::sc_object*);
60
+    bool get_trace_enabled(const sc_core::sc_object *, bool = false);
61
+    void augment_object_hierarchical(const sc_core::sc_object *);
51 62
     cci::cci_originator cci_originator;
52 63
     cci::cci_broker_handle cci_broker;
53
-    std::vector<cci::cci_param_untyped*> params;
64
+    std::vector<cci::cci_param_untyped *> params;
54 65
 };
55 66
 
56 67
 } /* namespace scc */

+ 22
- 22
incl/scc/configurer.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2017 MINRES Technologies GmbH
2
+ * Copyright 2017, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -38,13 +38,13 @@ public:
38 38
 
39 39
     configurer() = delete;
40 40
 
41
-    configurer(const configurer&) = delete;
41
+    configurer(const configurer &) = delete;
42 42
 
43
-    configurer(configurer&&) = delete;
43
+    configurer(configurer &&) = delete;
44 44
 
45
-    configurer& operator=(const configurer&) = delete;
45
+    configurer &operator=(const configurer &) = delete;
46 46
 
47
-    configurer& operator=(configurer&&) = delete;
47
+    configurer &operator=(configurer &&) = delete;
48 48
 
49 49
     void configure();
50 50
 
@@ -53,22 +53,22 @@ public:
53 53
     void dump_configuration(std::ostream &os = std::cout, sc_core::sc_object *obj = nullptr);
54 54
 
55 55
     template <typename T> void set_value(const std::string &hier_name, T value) {
56
-  	    cci::cci_param_handle param_handle = cci_broker.get_param_handle(hier_name);
57
-  	    if(param_handle.is_valid()) {
58
-  	    	param_handle.set_cci_value(cci::cci_value(value));
59
-  	    } else {
60
-  	    	size_t pos = hier_name.find_last_of('.');
61
-  	    	sc_core::sc_module *mod =
62
-  	    			dynamic_cast<sc_core::sc_module *>(sc_core::sc_find_object(hier_name.substr(0, pos).c_str()));
63
-  	    	if (mod != nullptr) {
64
-  	    		sc_core::sc_attribute<T> *attr =
65
-  	    				dynamic_cast<sc_core::sc_attribute<T> *>(mod->get_attribute(hier_name.substr(pos + 1)));
66
-  	    		if (attr != nullptr)
67
-  	    			attr->value = value;
68
-  	    		else
69
-  	    			LOG(ERROR) << "Could not set attribute value " << hier_name;
70
-  	    	}
71
-  	    }
56
+        cci::cci_param_handle param_handle = cci_broker.get_param_handle(hier_name);
57
+        if (param_handle.is_valid()) {
58
+            param_handle.set_cci_value(cci::cci_value(value));
59
+        } else {
60
+            size_t pos = hier_name.find_last_of('.');
61
+            sc_core::sc_module *mod =
62
+                dynamic_cast<sc_core::sc_module *>(sc_core::sc_find_object(hier_name.substr(0, pos).c_str()));
63
+            if (mod != nullptr) {
64
+                sc_core::sc_attribute<T> *attr =
65
+                    dynamic_cast<sc_core::sc_attribute<T> *>(mod->get_attribute(hier_name.substr(pos + 1)));
66
+                if (attr != nullptr)
67
+                    attr->value = value;
68
+                else
69
+                    LOG(ERROR) << "Could not set attribute value " << hier_name;
70
+            }
71
+        }
72 72
     }
73 73
 
74 74
     void set_configuration_value(sc_core::sc_attr_base *attr_base, sc_core::sc_object *owner);
@@ -80,7 +80,7 @@ public:
80 80
     }
81 81
 
82 82
 protected:
83
-    void dump_configuration(std::ostream& os, sc_core::sc_object* obj, Json::Value& node);
83
+    void dump_configuration(std::ostream &os, sc_core::sc_object *obj, Json::Value &node);
84 84
 
85 85
     void configure_sc_attribute_hierarchical(sc_core::sc_object *obj, Json::Value &hier_val);
86 86
 

+ 8
- 8
incl/scc/core/sc_logic_7.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -22,8 +22,8 @@
22 22
 
23 23
 #ifndef INCL_SYSC_CORE_SC_LOGIC_7_H_
24 24
 #define INCL_SYSC_CORE_SC_LOGIC_7_H_
25
-#include <cstdio>
26 25
 #include <array>
26
+#include <cstdio>
27 27
 
28 28
 #include "sysc/datatypes/bit/sc_bit.h"
29 29
 #include "sysc/kernel/sc_macros.h"
@@ -93,12 +93,12 @@ private:
93 93
 public:
94 94
     // conversion tables
95 95
 
96
-	static std::array<const sc_logic_7_value_t, 128> char_to_logic;
97
-	static std::array<const char, 7> logic_to_char;
98
-	static std::array<std::array<const sc_logic_7_value_t, 7>, 7> and_table;
99
-	static std::array<std::array<const sc_logic_7_value_t, 7>, 7> or_table;
100
-	static std::array<std::array<const sc_logic_7_value_t, 7>, 7> xor_table;
101
-	static std::array<const sc_logic_7_value_t, 7> not_table;
96
+    static std::array<const sc_logic_7_value_t, 128> char_to_logic;
97
+    static std::array<const char, 7> logic_to_char;
98
+    static std::array<std::array<const sc_logic_7_value_t, 7>, 7> and_table;
99
+    static std::array<std::array<const sc_logic_7_value_t, 7>, 7> or_table;
100
+    static std::array<std::array<const sc_logic_7_value_t, 7>, 7> xor_table;
101
+    static std::array<const sc_logic_7_value_t, 7> not_table;
102 102
 
103 103
     // constructors
104 104
 

+ 3
- 3
incl/scc/ext_attribute.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2017 MINRES Technologies GmbH
2
+ * Copyright 2017, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -20,8 +20,8 @@
20 20
  *      Author: eyck
21 21
  */
22 22
 
23
-#ifndef _SYSC_EXT_ATTRIBUTE_H_
24
-#define _SYSC_EXT_ATTRIBUTE_H_
23
+#ifndef _SCC_EXT_ATTRIBUTE_H_
24
+#define _SCC_EXT_ATTRIBUTE_H_
25 25
 
26 26
 #include "configurer.h"
27 27
 #include "utilities.h"

+ 3
- 4
incl/scc/initiator_mixin.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -17,15 +17,14 @@
17 17
 #ifndef _SYSC_INITIATOR_MIXIN_H__
18 18
 #define _SYSC_INITIATOR_MIXIN_H__
19 19
 
20
+#include "utilities.h"
20 21
 #include <functional>
21 22
 #include <sstream>
22
-#include "utilities.h"
23 23
 #include <tlm>
24 24
 
25 25
 namespace scc {
26 26
 
27
-template <typename BASE_TYPE, typename TYPES = tlm::tlm_base_protocol_types>
28
-class initiator_mixin : public BASE_TYPE {
27
+template <typename BASE_TYPE, typename TYPES = tlm::tlm_base_protocol_types> class initiator_mixin : public BASE_TYPE {
29 28
 public:
30 29
     using transaction_type = typename TYPES::tlm_payload_type;
31 30
     using phase_type = typename TYPES::tlm_phase_type;

+ 1
- 1
incl/scc/memory.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.

+ 50
- 42
incl/scc/peq.h View File

@@ -1,70 +1,78 @@
1
-/*
2
- * peq.h
1
+/*******************************************************************************
2
+ * Copyright 2018 MINRES Technologies GmbH
3 3
  *
4
- *  Created on: 13.07.2018
5
- *      Author: eyck
6
- */
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *******************************************************************************/
7 16
 
8 17
 #ifndef _SCC_PEQ_H_
9 18
 #define _SCC_PEQ_H_
10 19
 
11
-#include <systemc>
12 20
 #include <boost/optional.hpp>
13 21
 #include <map>
22
+#include <systemc>
14 23
 #include <type_traits>
15 24
 
16 25
 namespace scc {
17 26
 /**
18 27
  * a simple priority event queue with a copy of the original value
19 28
  */
20
-template <class TYPE>
21
-struct peq : public sc_core::sc_object {
29
+template <class TYPE> struct peq : public sc_core::sc_object {
22 30
 
23
-  static_assert(std::is_copy_constructible<TYPE>::value, "TYPE needs to be copy-constructible");
31
+    static_assert(std::is_copy_constructible<TYPE>::value, "TYPE needs to be copy-constructible");
24 32
 
25
-  using pair_type = std::pair<const sc_core::sc_time, TYPE>;
33
+    using pair_type = std::pair<const sc_core::sc_time, TYPE>;
26 34
 
27
-  peq() : sc_core::sc_object(sc_core::sc_gen_unique_name("peq")){ }
35
+    peq()
36
+    : sc_core::sc_object(sc_core::sc_gen_unique_name("peq")) {}
28 37
 
29
-  explicit
30
-  peq(const char* name) : sc_core::sc_object(name){ }
38
+    explicit peq(const char *name)
39
+    : sc_core::sc_object(name) {}
31 40
 
32
-  void notify(const TYPE& trans, const sc_core::sc_time& t){
33
-    m_scheduled_events.insert(pair_type(t + sc_core::sc_time_stamp(), trans));
34
-    m_event.notify(t);
35
-  }
41
+    void notify(const TYPE &trans, const sc_core::sc_time &t) {
42
+        m_scheduled_events.insert(pair_type(t + sc_core::sc_time_stamp(), trans));
43
+        m_event.notify(t);
44
+    }
36 45
 
37
-  void notify(const TYPE& trans) {
38
-    m_scheduled_events.insert(pair_type(sc_core::sc_time_stamp(), trans));
39
-    m_event.notify(); // immediate notification
40
-  }
46
+    void notify(const TYPE &trans) {
47
+        m_scheduled_events.insert(pair_type(sc_core::sc_time_stamp(), trans));
48
+        m_event.notify(); // immediate notification
49
+    }
41 50
 
42
-  boost::optional<TYPE> get_next() {
43
-    if (m_scheduled_events.empty())
44
-      return boost::none;;
45
-    sc_core::sc_time now = sc_core::sc_time_stamp();
46
-    if (m_scheduled_events.begin()->first <= now) {
47
-      auto trans = m_scheduled_events.begin()->second;
48
-      m_scheduled_events.erase(m_scheduled_events.begin());
49
-      return trans;
51
+    boost::optional<TYPE> get_next() {
52
+        if (m_scheduled_events.empty()) return boost::none;
53
+        ;
54
+        sc_core::sc_time now = sc_core::sc_time_stamp();
55
+        if (m_scheduled_events.begin()->first <= now) {
56
+            auto trans = m_scheduled_events.begin()->second;
57
+            m_scheduled_events.erase(m_scheduled_events.begin());
58
+            return trans;
59
+        }
60
+        m_event.notify(m_scheduled_events.begin()->first - now);
61
+        return boost::none;
62
+        ;
50 63
     }
51
-    m_event.notify(m_scheduled_events.begin()->first - now);
52
-    return boost::none;;
53
-  }
54 64
 
55
-  sc_core::sc_event& event(){
56
-    return m_event;
57
-  }
65
+    sc_core::sc_event &event() { return m_event; }
58 66
 
59
-  // Cancel all events from the event queue
60
-  void cancel_all() {
61
-    m_scheduled_events.clear();
62
-    m_event.cancel();
63
-  }
67
+    // Cancel all events from the event queue
68
+    void cancel_all() {
69
+        m_scheduled_events.clear();
70
+        m_event.cancel();
71
+    }
64 72
 
65 73
 private:
66
-  std::map<const sc_core::sc_time, TYPE> m_scheduled_events;
67
-  sc_core::sc_event m_event;
74
+    std::map<const sc_core::sc_time, TYPE> m_scheduled_events;
75
+    sc_core::sc_event m_event;
68 76
 };
69 77
 }
70 78
 

+ 28
- 14
incl/scc/perf_estimator.h View File

@@ -1,9 +1,18 @@
1
-/*
2
- * performancetracer.h
1
+/*******************************************************************************
2
+ * Copyright 2018 MINRES Technologies GmbH
3 3
  *
4
- *  Created on: 08.08.2018
5
- *      Author: eyck
6
- */
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *******************************************************************************/
7 16
 
8 17
 #ifndef _SCC_PERFORMANCETRACER_H_
9 18
 #define _SCC_PERFORMANCETRACER_H_
@@ -13,27 +22,32 @@
13 22
 
14 23
 namespace scc {
15 24
 
16
-class perf_estimator: public sc_core::sc_module {
25
+class perf_estimator : public sc_core::sc_module {
17 26
     struct time_stamp {
18 27
         boost::posix_time::ptime wall_clock_stamp;
19 28
         double proc_clock_stamp;
20
-        time_stamp(): wall_clock_stamp(boost::posix_time::microsec_clock::universal_time()), proc_clock_stamp(get_cpu_time()){}
21
-        time_stamp& operator=(const time_stamp& o){
22
-            wall_clock_stamp=o.wall_clock_stamp;
23
-            proc_clock_stamp=o.proc_clock_stamp;
29
+        time_stamp()
30
+        : wall_clock_stamp(boost::posix_time::microsec_clock::universal_time())
31
+        , proc_clock_stamp(get_cpu_time()) {}
32
+        time_stamp &operator=(const time_stamp &o) {
33
+            wall_clock_stamp = o.wall_clock_stamp;
34
+            proc_clock_stamp = o.proc_clock_stamp;
24 35
             return *this;
25 36
         }
26
-        void set(){
27
-            wall_clock_stamp=boost::posix_time::microsec_clock::universal_time();
28
-            proc_clock_stamp=get_cpu_time();
37
+        void set() {
38
+            wall_clock_stamp = boost::posix_time::microsec_clock::universal_time();
39
+            proc_clock_stamp = get_cpu_time();
29 40
         }
41
+
30 42
     private:
31 43
         static double get_cpu_time();
32 44
     };
45
+
33 46
 public:
34
-    SC_HAS_PROCESS(perf_estimator);
47
+    SC_HAS_PROCESS(perf_estimator);// NOLINT
35 48
     perf_estimator();
36 49
     virtual ~perf_estimator();
50
+
37 51
 protected:
38 52
     void start_of_simulation() override;
39 53
     void end_of_simulation() override;

+ 16
- 13
incl/scc/register.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -25,13 +25,13 @@
25 25
 
26 26
 #include <memory>
27 27
 
28
-#include <functional>
29
-#include <limits>
30
-#include <sstream>
31 28
 #include "resetable.h"
32 29
 #include "resource_access_if.h"
33
-#include "utilities.h"
34 30
 #include "util/delegate.h"
31
+#include "utilities.h"
32
+#include <functional>
33
+#include <limits>
34
+#include <sstream>
35 35
 
36 36
 namespace scc {
37 37
 
@@ -81,6 +81,9 @@ public:
81 81
     , storage(storage) {
82 82
         owner.register_resource(this);
83 83
     }
84
+
85
+    ~sc_register() = default;
86
+
84 87
     /**
85 88
      *
86 89
      * @return
@@ -200,7 +203,7 @@ public:
200 203
      * @param read_cb
201 204
      */
202 205
     void set_read_cb(std::function<bool(const this_type &, DATATYPE &)> read_cb) {
203
-        rd_cb = [read_cb](const this_type &reg, DATATYPE& data, sc_core::sc_time delay){return read_cb(reg, data);};
206
+        rd_cb = [read_cb](const this_type &reg, DATATYPE &data, sc_core::sc_time delay) { return read_cb(reg, data); };
204 207
     }
205 208
     /**
206 209
      *
@@ -212,7 +215,7 @@ public:
212 215
      * @param write_cb
213 216
      */
214 217
     void set_write_cb(std::function<bool(this_type &, DATATYPE &)> write_cb) {
215
-        wr_cb = [write_cb](this_type &reg, DATATYPE& data, sc_core::sc_time delay){return write_cb(reg, data);};
218
+        wr_cb = [write_cb](this_type &reg, DATATYPE &data, sc_core::sc_time delay) { return write_cb(reg, data); };
216 219
     }
217 220
     /**
218 221
      *
@@ -250,9 +253,10 @@ public:
250 253
     using pointer = value_type *;
251 254
 
252 255
     sc_register_indexed(sc_core::sc_module_name nm, std::array<DATATYPE, SIZE> &storage, const DATATYPE reset_val,
253
-                        resetable &owner, BASE_DATA_TYPE rdmask = std::numeric_limits<BASE_DATA_TYPE>::is_signed
254
-                                                                      ? -1
255
-                                                                      : std::numeric_limits<BASE_DATA_TYPE>::max(),
256
+                        resetable &owner,
257
+                        BASE_DATA_TYPE rdmask = std::numeric_limits<BASE_DATA_TYPE>::is_signed
258
+                                                    ? -1
259
+                                                    : std::numeric_limits<BASE_DATA_TYPE>::max(),
256 260
                         BASE_DATA_TYPE wrmask = std::numeric_limits<BASE_DATA_TYPE>::is_signed
257 261
                                                     ? -1
258 262
                                                     : std::numeric_limits<BASE_DATA_TYPE>::max()) {
@@ -266,9 +270,8 @@ public:
266 270
     }
267 271
 
268 272
     ~sc_register_indexed() override {
269
-        for (size_t idx = START; idx < (START + SIZE); ++idx) {
270
-            (_reg_field + idx)->~sc_register<DATATYPE>();
271
-        }
273
+//        for (size_t idx = START; idx < (START + SIZE); ++idx)
274
+//            (_reg_field + idx)->~sc_register<DATATYPE>();
272 275
         free(_reg_field);
273 276
     }
274 277
 

+ 37
- 25
incl/scc/report.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -23,12 +23,12 @@
23 23
 #ifndef _SYSC_REPORT_H_
24 24
 #define _SYSC_REPORT_H_
25 25
 
26
-#include <sysc/utils/sc_report.h>
27 26
 #include "utilities.h"
28
-#include <util/logging.h>
29
-#include <sysc/kernel/sc_time.h>
30 27
 #include <iomanip>
31 28
 #include <sstream>
29
+#include <sysc/kernel/sc_time.h>
30
+#include <sysc/utils/sc_report.h>
31
+#include <util/logging.h>
32 32
 
33 33
 namespace logging {
34 34
 class SystemC {};
@@ -38,11 +38,14 @@ namespace scc {
38 38
 /**
39 39
  * initializes the SystemC logging system to use logging::Logger with a particular logging level
40 40
  */
41
-void init_logging(logging::log_level level=logging::WARNING);
41
+void init_logging(logging::log_level level = logging::WARNING);
42 42
 
43
-template<sc_core::sc_severity SEVERITY>
44
-struct ScLogger {
45
-    ScLogger(const char* file, int line, sc_core::sc_verbosity level=sc_core::SC_MEDIUM):t(nullptr), file(file), line(line), level(level){};
43
+template <sc_core::sc_severity SEVERITY> struct ScLogger {
44
+    ScLogger(const char *file, int line, sc_core::sc_verbosity level = sc_core::SC_MEDIUM)
45
+    : t(nullptr)
46
+    , file(file)
47
+    , line(line)
48
+    , level(level){};
46 49
 
47 50
     ScLogger() = delete;
48 51
 
@@ -51,34 +54,43 @@ struct ScLogger {
51 54
     ScLogger &operator=(const ScLogger &) = delete;
52 55
 
53 56
     virtual ~ScLogger() {
54
-      ::sc_core::sc_report_handler::report(SEVERITY, t?t:"SystemC", os.str().c_str(), level, file , line );
57
+        ::sc_core::sc_report_handler::report(SEVERITY, t ? t : "SystemC", os.str().c_str(), level, file, line);
55 58
     }
56 59
 
57
-    inline
58
-    ScLogger& type(){return *this;}
60
+    inline ScLogger &type() { return *this; }
59 61
 
60
-    inline
61
-    ScLogger& type(const char* t){this->t=const_cast<char*>(t); return *this;}
62
+    inline ScLogger &type(const char *t) {
63
+        this->t = const_cast<char *>(t);
64
+        return *this;
65
+    }
62 66
 
63
-    inline
64
-    std::ostringstream& get() {return os;};
67
+    inline std::ostringstream &get() { return os; };
65 68
 
66 69
 protected:
67 70
     std::ostringstream os;
68
-    char* t;
69
-    const char* file;
71
+    char *t;
72
+    const char *file;
70 73
     const int line;
71 74
     const sc_core::sc_verbosity level;
72 75
 };
73 76
 
74
-#define SCDBGTRC(...) if (::sc_core::sc_report_handler::get_verbosity_level() >= sc_core::SC_DEBUG)   ::scc::ScLogger<::sc_core::SC_INFO>(__FILE__,__LINE__, sc_core::SC_DEBUG).type(__VA_ARGS__).get()
75
-#define SCTRACE(...)  if (::sc_core::sc_report_handler::get_verbosity_level() >= sc_core::SC_FULL)   ::scc::ScLogger<::sc_core::SC_INFO>(__FILE__,__LINE__, sc_core::SC_FULL).type(__VA_ARGS__).get()
76
-#define SCDEBUG(...)  if (::sc_core::sc_report_handler::get_verbosity_level() >= sc_core::SC_HIGH)  ::scc::ScLogger<::sc_core::SC_INFO>(__FILE__,__LINE__, sc_core::SC_HIGH).type(__VA_ARGS__).get()
77
-#define SCINFO(...)   if (::sc_core::sc_report_handler::get_verbosity_level() >= sc_core::SC_MEDIUM) ::scc::ScLogger<::sc_core::SC_INFO>(__FILE__,__LINE__, sc_core::SC_MEDIUM).type(__VA_ARGS__).get()
78
-#define SCWARN(...)   ::scc::ScLogger<::sc_core::SC_WARNING>(__FILE__,__LINE__,sc_core::SC_MEDIUM).type(__VA_ARGS__).get()
79
-#define SCERR(...)    ::scc::ScLogger<::sc_core::SC_ERROR>(__FILE__,__LINE__,sc_core::SC_MEDIUM).type(__VA_ARGS__).get()
80
-#define SCFATAL(...)    ::scc::ScLogger<::sc_core::SC_FATAL>(__FILE__,__LINE__,sc_core::SC_MEDIUM).type(__VA_ARGS__).get()
81
-
77
+#define SCDBGTRC(...)                                                                                                  \
78
+    if (::sc_core::sc_report_handler::get_verbosity_level() >= sc_core::SC_DEBUG)                                      \
79
+    ::scc::ScLogger<::sc_core::SC_INFO>(__FILE__, __LINE__, sc_core::SC_DEBUG).type(__VA_ARGS__).get()
80
+#define SCTRACE(...)                                                                                                   \
81
+    if (::sc_core::sc_report_handler::get_verbosity_level() >= sc_core::SC_FULL)                                       \
82
+    ::scc::ScLogger<::sc_core::SC_INFO>(__FILE__, __LINE__, sc_core::SC_FULL).type(__VA_ARGS__).get()
83
+#define SCDEBUG(...)                                                                                                   \
84
+    if (::sc_core::sc_report_handler::get_verbosity_level() >= sc_core::SC_HIGH)                                       \
85
+    ::scc::ScLogger<::sc_core::SC_INFO>(__FILE__, __LINE__, sc_core::SC_HIGH).type(__VA_ARGS__).get()
86
+#define SCINFO(...)                                                                                                    \
87
+    if (::sc_core::sc_report_handler::get_verbosity_level() >= sc_core::SC_MEDIUM)                                     \
88
+    ::scc::ScLogger<::sc_core::SC_INFO>(__FILE__, __LINE__, sc_core::SC_MEDIUM).type(__VA_ARGS__).get()
89
+#define SCWARN(...)                                                                                                    \
90
+    ::scc::ScLogger<::sc_core::SC_WARNING>(__FILE__, __LINE__, sc_core::SC_MEDIUM).type(__VA_ARGS__).get()
91
+#define SCERR(...) ::scc::ScLogger<::sc_core::SC_ERROR>(__FILE__, __LINE__, sc_core::SC_MEDIUM).type(__VA_ARGS__).get()
92
+#define SCFATAL(...)                                                                                                   \
93
+    ::scc::ScLogger<::sc_core::SC_FATAL>(__FILE__, __LINE__, sc_core::SC_MEDIUM).type(__VA_ARGS__).get()
82 94
 }
83 95
 
84 96
 #endif /* _SYSC_REPORT_H_ */

+ 2
- 2
incl/scc/resetable.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -23,8 +23,8 @@
23 23
 #ifndef _SYSC_RESETTABLE_H_
24 24
 #define _SYSC_RESETTABLE_H_
25 25
 
26
-#include <vector>
27 26
 #include "resource_access_if.h"
27
+#include <vector>
28 28
 
29 29
 namespace scc {
30 30
 

+ 6
- 4
incl/scc/resource_access_if.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -23,9 +23,9 @@
23 23
 #ifndef _SYSC_RESOURCE_ACCESS_IF_H_
24 24
 #define _SYSC_RESOURCE_ACCESS_IF_H_
25 25
 
26
-#include <sysc/kernel/sc_time.h>
27 26
 #include <cstddef>
28 27
 #include <cstdint>
28
+#include <sysc/kernel/sc_time.h>
29 29
 
30 30
 namespace scc {
31 31
 
@@ -52,7 +52,8 @@ public:
52 52
      * @param offset
53 53
      * @return
54 54
      */
55
-    virtual bool write(const uint8_t *data, std::size_t length, uint64_t offset = 0, sc_core::sc_time d=sc_core::SC_ZERO_TIME) = 0;
55
+    virtual bool write(const uint8_t *data, std::size_t length, uint64_t offset = 0,
56
+                       sc_core::sc_time d = sc_core::SC_ZERO_TIME) = 0;
56 57
     /**
57 58
      *
58 59
      * @param data
@@ -60,7 +61,8 @@ public:
60 61
      * @param offset
61 62
      * @return
62 63
      */
63
-    virtual bool read(uint8_t *data, std::size_t length, uint64_t offset = 0, sc_core::sc_time d=sc_core::SC_ZERO_TIME) const = 0;
64
+    virtual bool read(uint8_t *data, std::size_t length, uint64_t offset = 0,
65
+                      sc_core::sc_time d = sc_core::SC_ZERO_TIME) const = 0;
64 66
     // non-functional/debug accesses
65 67
     /**
66 68
      *

+ 19
- 18
incl/scc/router.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -23,15 +23,15 @@
23 23
 #ifndef _SYSC_ROUTER_H_
24 24
 #define _SYSC_ROUTER_H_
25 25
 
26
-#include "util/range_lut.h"
27
-#include "utilities.h"
26
+#include "initiator_mixin.h"
28 27
 #include "scv4tlm/tlm_rec_initiator_socket.h"
29 28
 #include "scv4tlm/tlm_rec_target_socket.h"
30
-#include "initiator_mixin.h"
31 29
 #include "target_mixin.h"
30
+#include "util/range_lut.h"
31
+#include "utilities.h"
32
+#include <limits>
32 33
 #include <sysc/utils/sc_vector.h>
33 34
 #include <tlm.h>
34
-#include <limits>
35 35
 #include <unordered_map>
36 36
 
37 37
 namespace scc {
@@ -76,7 +76,7 @@ public:
76 76
      * @param idx
77 77
      * @param name
78 78
      */
79
-    void set_target_name(size_t idx, std::string name){ target_name_lut.insert(std::make_pair(name, idx));}
79
+    void set_target_name(size_t idx, std::string name) { target_name_lut.insert(std::make_pair(name, idx)); }
80 80
     /**
81 81
      *
82 82
      * @param idx
@@ -93,13 +93,13 @@ public:
93 93
      * @param remap
94 94
      */
95 95
     void add_target_range(size_t idx, uint64_t base, uint64_t size, bool remap = true);
96
-   /**
97
-     * tagged blocking transport method
98
-     *
99
-     * @param i
100
-     * @param trans
101
-     * @param delay
102
-     */
96
+    /**
97
+      * tagged blocking transport method
98
+      *
99
+      * @param i
100
+      * @param trans
101
+      * @param delay
102
+      */
103 103
     void b_transport(int i, tlm::tlm_generic_payload &trans, sc_core::sc_time &delay);
104 104
     /**
105 105
      * tagged forward DMI method
@@ -182,13 +182,14 @@ template <unsigned BUSWIDTH>
182 182
 void router<BUSWIDTH>::add_target_range(std::string name, uint64_t base, uint64_t size, bool remap) {
183 183
     auto it = target_name_lut.find(name);
184 184
 #ifndef NDEBUG
185
-    //sc_assert(it!=target_name_lut.end());
186
-    if(it==target_name_lut.end()){
187
-        std::stringstream ss; ss<<"No target index entry for '"<<name<<"' found ";
188
-        ::sc_core::sc_assertion_failed(ss.str().c_str(),__FILE__,__LINE__);
185
+    // sc_assert(it!=target_name_lut.end());
186
+    if (it == target_name_lut.end()) {
187
+        std::stringstream ss;
188
+        ss << "No target index entry for '" << name << "' found ";
189
+        ::sc_core::sc_assertion_failed(ss.str().c_str(), __FILE__, __LINE__);
189 190
     }
190 191
 #endif
191
-    auto idx=it->second;
192
+    auto idx = it->second;
192 193
     tranges[idx].base = base;
193 194
     tranges[idx].size = size;
194 195
     tranges[idx].remap = remap;

+ 14
- 5
incl/scc/scv_tr_db.h View File

@@ -1,9 +1,18 @@
1
-/*
2
- * scv_tr_db.h
1
+/*******************************************************************************
2
+ * Copyright 2018 MINRES Technologies GmbH
3 3
  *
4
- *  Created on: 16.12.2016
5
- *      Author: eyck
6
- */
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *******************************************************************************/
7 16
 
8 17
 #ifndef _SCC_SCV_TR_DB_H_
9 18
 #define _SCC_SCV_TR_DB_H_

+ 24
- 26
incl/scc/signal_initiator_mixin.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -18,14 +18,13 @@
18 18
 #define __SIGNAL_INITIATOR_MIXIN_H__
19 19
 
20 20
 #include "utilities.h"
21
-#include <tlm/tlm_signal.h>
22 21
 #include <functional>
23 22
 #include <sstream>
23
+#include <tlm/tlm_signal.h>
24 24
 
25 25
 namespace scc {
26 26
 
27
-template <typename BASE_TYPE>
28
-class signal_initiator_mixin : public BASE_TYPE {
27
+template <typename BASE_TYPE> class signal_initiator_mixin : public BASE_TYPE {
29 28
 public:
30 29
     using tlm_signal_type = typename BASE_TYPE::tlm_signal_type;
31 30
     using transaction_type = typename BASE_TYPE::transaction_type;
@@ -36,20 +35,19 @@ public:
36 35
 
37 36
 public:
38 37
     signal_initiator_mixin()
39
-    : signal_initiator_mixin(sc_core::sc_gen_unique_name("signal_initiator_mixinn_socket")){}
38
+    : signal_initiator_mixin(sc_core::sc_gen_unique_name("signal_initiator_mixinn_socket")) {}
40 39
 
41 40
     explicit signal_initiator_mixin(const char *n)
42 41
     : BASE_TYPE(n)
43 42
     , error_if_no_callback(false)
44
-    , bw_if(this)
45
-    {
43
+    , bw_if(this) {
46 44
         bind(bw_if);
47 45
     }
48 46
 
49 47
     using BASE_TYPE::bind;
50 48
 
51
-    void write_now(tlm_signal_type value){
52
-        auto*  gp = tlm::tlm_signal_gp<tlm_signal_type>::create();
49
+    void write_now(tlm_signal_type value) {
50
+        auto *gp = tlm::tlm_signal_gp<tlm_signal_type>::create();
53 51
         gp->set_command(tlm::TLM_WRITE_COMMAND);
54 52
         gp->set_value(value);
55 53
         gp->acquire();
@@ -59,12 +57,11 @@ public:
59 57
         gp->release();
60 58
     }
61 59
 
62
-    template<typename EXT_TYPE>
63
-    void write_now(tlm_signal_type value, EXT_TYPE* ext){
64
-        auto*  gp = tlm::tlm_signal_gp<tlm_signal_type>::create();
60
+    template <typename EXT_TYPE> void write_now(tlm_signal_type value, EXT_TYPE *ext) {
61
+        auto *gp = tlm::tlm_signal_gp<tlm_signal_type>::create();
65 62
         gp->set_command(tlm::TLM_WRITE_COMMAND);
66 63
         gp->set_value(value);
67
-        if(ext) gp->set_extension(ext);
64
+        if (ext) gp->set_extension(ext);
68 65
         gp->acquire();
69 66
         tlm::tlm_phase phase{tlm::BEGIN_REQ};
70 67
         sc_core::sc_time delay{sc_core::SC_ZERO_TIME};
@@ -84,7 +81,9 @@ public:
84 81
      *
85 82
      * @param cb the callback function
86 83
      */
87
-    void register_nb_transport(std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)> cb, unsigned int tag) {
84
+    void register_nb_transport(
85
+        std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)> cb,
86
+        unsigned int tag) {
88 87
         bw_if.set_nb_transport_ptr(cb);
89 88
     }
90 89
 
@@ -93,12 +92,12 @@ public:
93 92
 private:
94 93
     class bw_transport_if : public bw_interface_type {
95 94
     public:
96
-        using transport_fct        = std::function<sync_enum_type(transaction_type &, phase_type &, sc_core::sc_time &)>;
97
-        using transport_tagged_fct = std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)>;
95
+        using transport_fct = std::function<sync_enum_type(transaction_type &, phase_type &, sc_core::sc_time &)>;
96
+        using transport_tagged_fct =
97
+            std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)>;
98 98
 
99
-        bw_transport_if(const signal_initiator_mixin* owner)
100
-        : m_owner(owner)
101
-        {}
99
+        bw_transport_if(const signal_initiator_mixin *owner)
100
+        : m_owner(owner) {}
102 101
 
103 102
         void set_nb_transport_ptr(transport_fct p) {
104 103
             if (m_transport_ptr || m_transport_tagged_ptr) {
@@ -117,7 +116,7 @@ private:
117 116
                 SC_REPORT_WARNING("/OSCI_TLM-2/signal_initiator_mixin", s.str().c_str());
118 117
             } else {
119 118
                 m_transport_tagged_ptr = p;
120
-                this->tag=tag;
119
+                this->tag = tag;
121 120
             }
122 121
         }
123 122
 
@@ -126,7 +125,7 @@ private:
126 125
                 return m_transport_ptr(trans, phase, t);
127 126
             else if (m_transport_tagged_ptr)
128 127
                 return m_transport_tagged_ptr(tag, trans, phase, t);
129
-            else if(m_owner->error_if_no_callback){
128
+            else if (m_owner->error_if_no_callback) {
130 129
                 std::stringstream s;
131 130
                 s << m_owner->name() << ": no transport callback registered";
132 131
                 SC_REPORT_ERROR("/OSCI_TLM-2/signal_initiator_mixin", s.str().c_str());
@@ -135,10 +134,10 @@ private:
135 134
         }
136 135
 
137 136
     private:
138
-        const signal_initiator_mixin* m_owner;
139
-        unsigned int tag=0;
140
-        transport_fct m_transport_ptr=nullptr;
141
-        transport_tagged_fct m_transport_tagged_ptr=nullptr;
137
+        const signal_initiator_mixin *m_owner;
138
+        unsigned int tag = 0;
139
+        transport_fct m_transport_ptr = nullptr;
140
+        transport_tagged_fct m_transport_tagged_ptr = nullptr;
142 141
     };
143 142
 
144 143
 private:
@@ -153,6 +152,5 @@ using tlm_signal_bool_out = signal_initiator_mixin<tlm::tlm_signal_initiator_soc
153 152
 using tlm_signal_logic_out = signal_initiator_mixin<tlm::tlm_signal_initiator_socket<sc_dt::sc_logic>>;
154 153
 using tlm_signal_bool_opt_out = signal_initiator_mixin<tlm::tlm_signal_opt_initiator_socket<bool>>;
155 154
 using tlm_signal_logic_opt_out = signal_initiator_mixin<tlm::tlm_signal_opt_initiator_socket<sc_dt::sc_logic>>;
156
-
157 155
 }
158 156
 #endif //__SIGNAL_INITIATOR_MIXIN_H__

+ 15
- 18
incl/scc/signal_target_mixin.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -17,14 +17,13 @@
17 17
 #define __SIGNAL_TARGET_MIXIN_H__
18 18
 
19 19
 #include "utilities.h"
20
-#include <tlm/tlm_signal.h>
21 20
 #include <functional>
22 21
 #include <sstream>
22
+#include <tlm/tlm_signal.h>
23 23
 
24 24
 namespace scc {
25 25
 
26
-template <typename BASE_TYPE>
27
-class signal_target_mixin : public BASE_TYPE {
26
+template <typename BASE_TYPE> class signal_target_mixin : public BASE_TYPE {
28 27
 public:
29 28
     using tlm_signal_type = typename BASE_TYPE::tlm_signal_type;
30 29
     using transaction_type = typename BASE_TYPE::transaction_type;
@@ -46,8 +45,7 @@ public:
46 45
     explicit signal_target_mixin(const char *n)
47 46
     : BASE_TYPE(n)
48 47
     , error_if_no_callback(true)
49
-    , fw_if(this)
50
-    {
48
+    , fw_if(this) {
51 49
         bind(fw_if);
52 50
     }
53 51
 
@@ -57,16 +55,16 @@ public:
57 55
      *
58 56
      * @param cb
59 57
      */
60
-    void
61
-    register_nb_transport(std::function<sync_enum_type(transaction_type &, phase_type &, sc_core::sc_time &)> cb) {
58
+    void register_nb_transport(std::function<sync_enum_type(transaction_type &, phase_type &, sc_core::sc_time &)> cb) {
62 59
         fw_if.set_nb_transport_ptr(cb);
63 60
     }
64 61
     /**
65 62
      *
66 63
      * @param cb
67 64
      */
68
-    void
69
-    register_nb_transport(std::function<sync_enum_type(unsigned int,transaction_type &, phase_type &, sc_core::sc_time &)> cb, unsigned int tag) {
65
+    void register_nb_transport(
66
+        std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)> cb,
67
+        unsigned int tag) {
70 68
         fw_if.set_nb_transport_ptr(cb, tag);
71 69
     }
72 70
 
@@ -80,12 +78,12 @@ private:
80 78
 
81 79
     class fw_process_if : public fw_interface_type {
82 80
     public:
83
-        using transport_fct        = std::function<sync_enum_type(transaction_type &, phase_type &, sc_core::sc_time &)>;
84
-        using transport_tagged_fct = std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)>;
81
+        using transport_fct = std::function<sync_enum_type(transaction_type &, phase_type &, sc_core::sc_time &)>;
82
+        using transport_tagged_fct =
83
+            std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)>;
85 84
 
86 85
         fw_process_if(const signal_target_mixin *p_own)
87
-        : m_owner(p_own)
88
-        {}
86
+        : m_owner(p_own) {}
89 87
 
90 88
         void set_nb_transport_ptr(transport_fct p) {
91 89
             if (m_transport_ptr || m_transport_tagged_ptr) {
@@ -104,7 +102,7 @@ private:
104 102
                 SC_REPORT_WARNING("/OSCI_TLM-2/signal_target_mixin", s.str().c_str());
105 103
             } else {
106 104
                 m_transport_tagged_ptr = p;
107
-                this->tag=tag;
105
+                this->tag = tag;
108 106
             }
109 107
         }
110 108
 
@@ -116,7 +114,7 @@ private:
116 114
             } else if (m_transport_tagged_ptr) {
117 115
                 // forward call
118 116
                 return m_transport_tagged_ptr(tag, trans, phase, t);
119
-            } else if(m_owner->error_if_no_callback){
117
+            } else if (m_owner->error_if_no_callback) {
120 118
                 std::stringstream s;
121 119
                 s << m_owner->name() << ": no transport callback registered";
122 120
                 SC_REPORT_ERROR("/OSCI_TLM-2/signal_target_mixin", s.str().c_str());
@@ -126,7 +124,7 @@ private:
126 124
 
127 125
     private:
128 126
         const signal_target_mixin *m_owner;
129
-        unsigned int tag=0;
127
+        unsigned int tag = 0;
130 128
         transport_fct m_transport_ptr = nullptr;
131 129
         transport_tagged_fct m_transport_tagged_ptr = nullptr;
132 130
     };
@@ -142,7 +140,6 @@ using tlm_signal_bool_in = signal_target_mixin<tlm::tlm_signal_target_socket<boo
142 140
 using tlm_signal_logic_in = signal_target_mixin<tlm::tlm_signal_target_socket<sc_dt::sc_logic>>;
143 141
 using tlm_signal_bool_opt_in = signal_target_mixin<tlm::tlm_signal_opt_target_socket<bool>>;
144 142
 using tlm_signal_logic_opt_in = signal_target_mixin<tlm::tlm_signal_opt_target_socket<sc_dt::sc_logic>>;
145
-
146 143
 }
147 144
 
148 145
 #endif //__SIGNAL_TARGET_MIXIN_H__

+ 12
- 9
incl/scc/tagged_initiator_mixin.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -17,9 +17,9 @@
17 17
 #ifndef _SCC_TAGGED_INITIATOR_MIXIN_H__
18 18
 #define _SCC_TAGGED_INITIATOR_MIXIN_H__
19 19
 
20
+#include "utilities.h"
20 21
 #include <functional>
21 22
 #include <sstream>
22
-#include "utilities.h"
23 23
 #include <tlm>
24 24
 
25 25
 namespace scc {
@@ -50,8 +50,9 @@ public:
50 50
      * @param cb the callback function
51 51
      * @param tag the tag to return upon calling
52 52
      */
53
-    void
54
-    register_nb_transport_bw(std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)> cb, unsigned int tag) {
53
+    void register_nb_transport_bw(
54
+        std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)> cb,
55
+        unsigned int tag) {
55 56
         bw_if.set_transport_function(cb, tag);
56 57
     }
57 58
     /**
@@ -59,14 +60,16 @@ public:
59 60
      * @param cb the callback function
60 61
      * @param tag the tag to return upon calling
61 62
      */
62
-    void register_invalidate_direct_mem_ptr(std::function<void(unsigned int, sc_dt::uint64, sc_dt::uint64)> cb, unsigned int tag) {
63
+    void register_invalidate_direct_mem_ptr(std::function<void(unsigned int, sc_dt::uint64, sc_dt::uint64)> cb,
64
+                                            unsigned int tag) {
63 65
         bw_if.set_invalidate_direct_mem_function(cb, tag);
64 66
     }
65 67
 
66 68
 private:
67 69
     class bw_transport_if : public tlm::tlm_bw_transport_if<TYPES> {
68 70
     public:
69
-        using transport_fct = std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)>;
71
+        using transport_fct =
72
+            std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)>;
70 73
         using invalidate_dmi_fct = std::function<void(unsigned int, sc_dt::uint64, sc_dt::uint64)>;
71 74
 
72 75
         bw_transport_if(const std::string &name)
@@ -81,7 +84,7 @@ private:
81 84
                 SC_REPORT_WARNING("/OSCI_TLM-2/simple_socket", s.str().c_str());
82 85
             } else {
83 86
                 m_transport_ptr = p;
84
-                tags[0]=tag;
87
+                tags[0] = tag;
85 88
             }
86 89
         }
87 90
 
@@ -92,7 +95,7 @@ private:
92 95
                 SC_REPORT_WARNING("/OSCI_TLM-2/simple_socket", s.str().c_str());
93 96
             } else {
94 97
                 m_invalidate_direct_mem_ptr = p;
95
-                tags[1]=tag;
98
+                tags[1] = tag;
96 99
             }
97 100
         }
98 101
 
@@ -111,7 +114,7 @@ private:
111 114
 
112 115
     private:
113 116
         const std::string m_name;
114
-        unsigned int tags[2];//dbg, dmi
117
+        unsigned int tags[2]; // dbg, dmi
115 118
         transport_fct m_transport_ptr;
116 119
         invalidate_dmi_fct m_invalidate_direct_mem_ptr;
117 120
     };

+ 18
- 14
incl/scc/tagged_target_mixin.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -20,8 +20,8 @@
20 20
 #define SC_INCLUDE_DYNAMIC_PROCESSES
21 21
 #endif
22 22
 
23
-#include <sstream>
24 23
 #include "utilities.h"
24
+#include <sstream>
25 25
 #include <tlm>
26 26
 #include <tlm_utils/peq_with_get.h>
27 27
 
@@ -71,8 +71,9 @@ public:
71 71
      * @param cb
72 72
      * @param tag the tag to return upon calling
73 73
      */
74
-    void
75
-    register_nb_transport_fw(std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)> cb, unsigned int tag) {
74
+    void register_nb_transport_fw(
75
+        std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)> cb,
76
+        unsigned int tag) {
76 77
         assert(!sc_core::sc_get_curr_simcontext()->elaboration_done());
77 78
         m_fw_process.set_nb_transport_ptr(cb, tag);
78 79
     }
@@ -81,7 +82,8 @@ public:
81 82
      * @param cb
82 83
      * @param tag the tag to return upon calling
83 84
      */
84
-    void register_b_transport(std::function<void(unsigned int, transaction_type &, sc_core::sc_time &)> cb, unsigned int tag) {
85
+    void register_b_transport(std::function<void(unsigned int, transaction_type &, sc_core::sc_time &)> cb,
86
+                              unsigned int tag) {
85 87
         assert(!sc_core::sc_get_curr_simcontext()->elaboration_done());
86 88
         m_fw_process.set_b_transport_ptr(cb, tag);
87 89
     }
@@ -99,7 +101,8 @@ public:
99 101
      * @param cb
100 102
      * @param tag the tag to return upon calling
101 103
      */
102
-    void register_get_direct_mem_ptr(std::function<bool(unsigned int, transaction_type &, tlm::tlm_dmi &)> cb, unsigned int tag) {
104
+    void register_get_direct_mem_ptr(std::function<bool(unsigned int, transaction_type &, tlm::tlm_dmi &)> cb,
105
+                                     unsigned int tag) {
103 106
         assert(!sc_core::sc_get_curr_simcontext()->elaboration_done());
104 107
         m_fw_process.set_get_direct_mem_ptr(cb, tag);
105 108
     }
@@ -162,7 +165,8 @@ private:
162 165
 
163 166
     class fw_process : public tlm::tlm_fw_transport_if<TYPES>, public tlm::tlm_mm_interface {
164 167
     public:
165
-        using NBTransportPtr = std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)>;
168
+        using NBTransportPtr =
169
+            std::function<sync_enum_type(unsigned int, transaction_type &, phase_type &, sc_core::sc_time &)>;
166 170
         using BTransportPtr = std::function<void(unsigned int, transaction_type &, sc_core::sc_time &)>;
167 171
         using TransportDbgPtr = std::function<unsigned int(unsigned int, transaction_type &)>;
168 172
         using GetDirectMemPtr = std::function<bool(unsigned int, transaction_type &, tlm::tlm_dmi &)>;
@@ -189,7 +193,7 @@ private:
189 193
                 SC_REPORT_WARNING("/OSCI_TLM-2/simple_socket", s.str().c_str());
190 194
             } else {
191 195
                 m_nb_transport_ptr = p;
192
-                tags[1]=tag;
196
+                tags[1] = tag;
193 197
             }
194 198
         }
195 199
 
@@ -200,8 +204,8 @@ private:
200 204
                 SC_REPORT_WARNING("/OSCI_TLM-2/simple_socket", s.str().c_str());
201 205
             } else {
202 206
                 m_b_transport_ptr = p;
203
-                tags[0]=tag;
204
-           }
207
+                tags[0] = tag;
208
+            }
205 209
         }
206 210
 
207 211
         void set_transport_dbg_ptr(TransportDbgPtr p, unsigned int tag) {
@@ -211,8 +215,8 @@ private:
211 215
                 SC_REPORT_WARNING("/OSCI_TLM-2/simple_socket", s.str().c_str());
212 216
             } else {
213 217
                 m_transport_dbg_ptr = p;
214
-                tags[2]=tag;
215
-           }
218
+                tags[2] = tag;
219
+            }
216 220
         }
217 221
 
218 222
         void set_get_direct_mem_ptr(GetDirectMemPtr p, unsigned int tag) {
@@ -222,7 +226,7 @@ private:
222 226
                 SC_REPORT_WARNING("/OSCI_TLM-2/simple_socket", s.str().c_str());
223 227
             } else {
224 228
                 m_get_direct_mem_ptr = p;
225
-                tags[3]=tag;
229
+                tags[3] = tag;
226 230
             }
227 231
         }
228 232
         // Interface implementation
@@ -488,7 +492,7 @@ private:
488 492
     private:
489 493
         const std::string m_name;
490 494
         tagged_target_mixin *m_owner;
491
-        unsigned int tags[4];//bl, nb, dbg, dmi
495
+        unsigned int tags[4]; // bl, nb, dbg, dmi
492 496
         NBTransportPtr m_nb_transport_ptr;
493 497
         BTransportPtr m_b_transport_ptr;
494 498
         TransportDbgPtr m_transport_dbg_ptr;

+ 3
- 4
incl/scc/target_mixin.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -20,15 +20,14 @@
20 20
 #define SC_INCLUDE_DYNAMIC_PROCESSES
21 21
 #endif
22 22
 
23
-#include <sstream>
24 23
 #include "utilities.h"
24
+#include <sstream>
25 25
 #include <tlm>
26 26
 #include <tlm_utils/peq_with_get.h>
27 27
 
28 28
 namespace scc {
29 29
 
30
-template <typename base_type, typename TYPES = tlm::tlm_base_protocol_types>
31
-class target_mixin : public base_type {
30
+template <typename base_type, typename TYPES = tlm::tlm_base_protocol_types> class target_mixin : public base_type {
32 31
     friend class fw_process;
33 32
     friend class bw_process;
34 33
 

+ 27
- 16
incl/scc/time2tick.h View File

@@ -1,9 +1,18 @@
1
-/*
2
- * time2tick.h
1
+/*******************************************************************************
2
+ * Copyright 2018 MINRES Technologies GmbH
3 3
  *
4
- *  Created on: 03.10.2018
5
- *      Author: eyck
6
- */
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *******************************************************************************/
7 16
 
8 17
 #ifndef _SCC_TIME2TICK_H_
9 18
 #define _SCC_TIME2TICK_H_
@@ -11,27 +20,29 @@
11 20
 #include "utilities.h"
12 21
 
13 22
 namespace scc {
14
-struct time2tick: public sc_core::sc_module {
15
-    SC_HAS_PROCESS(time2tick);
23
+struct time2tick : public sc_core::sc_module {
24
+    SC_HAS_PROCESS(time2tick);// NOLINT
16 25
     sc_core::sc_in<sc_core::sc_time> clk_i;
17 26
     sc_core::sc_out<bool> clk_o;
18 27
 
19
-    time2tick(sc_core::sc_module_name nm): sc_core::sc_module(nm){
28
+    time2tick(sc_core::sc_module_name nm)
29
+    : sc_core::sc_module(nm) {
20 30
         SC_THREAD(clocker);
21 31
     }
32
+
22 33
 private:
23 34
     sc_core::sc_time clk_period;
24
-    void clocker(){
25
-        while(true){
35
+    void clocker() {
36
+        while (true) {
26 37
             auto t = clk_i.read();
27
-            if(t==sc_core::SC_ZERO_TIME){
38
+            if (t == sc_core::SC_ZERO_TIME) {
28 39
                 wait(clk_i.value_changed_event());
29
-                t=clk_i.read();
40
+                t = clk_i.read();
30 41
             }
31
-            clk_o=true;
32
-            wait(t/2);
33
-            clk_o=false;
34
-            wait(t-t/2);
42
+            clk_o = true;
43
+            wait(t / 2);
44
+            clk_o = false;
45
+            wait(t - t / 2);
35 46
         }
36 47
     }
37 48
 };

+ 7
- 7
incl/scc/tlm_target.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -23,11 +23,11 @@
23 23
 #ifndef _SYSC_TLM_TARGET_H_
24 24
 #define _SYSC_TLM_TARGET_H_
25 25
 
26
-#include "utilities.h"
27
-#include "scv4tlm/tlm_rec_target_socket.h"
28
-#include "util/range_lut.h"
29 26
 #include "resource_access_if.h"
27
+#include "scv4tlm/tlm_rec_target_socket.h"
30 28
 #include "target_mixin.h"
29
+#include "util/range_lut.h"
30
+#include "utilities.h"
31 31
 #include <array>
32 32
 
33 33
 namespace scc {
@@ -84,12 +84,13 @@ public:
84 84
 
85 85
 private:
86 86
     sc_core::sc_time &clk;
87
+
87 88
 protected:
88 89
     util::range_lut<std::pair<resource_access_if *, uint64_t>> socket_map;
89 90
 };
90 91
 
91 92
 template <unsigned BUSWIDTH = 32> struct target_memory_map_entry {
92
-    tlm::tlm_target_socket<BUSWIDTH>& target;
93
+    tlm::tlm_target_socket<BUSWIDTH> &target;
93 94
     sc_dt::uint64 start;
94 95
     sc_dt::uint64 size;
95 96
 };
@@ -154,8 +155,7 @@ void scc::tlm_target<BUSWIDTH>::b_tranport_cb(tlm::tlm_generic_payload &gp, sc_c
154 155
     delay += clk;
155 156
 }
156 157
 
157
-template <unsigned int BUSWIDTH>
158
-unsigned int scc::tlm_target<BUSWIDTH>::tranport_dbg_cb(tlm::tlm_generic_payload &gp) {
158
+template <unsigned int BUSWIDTH> unsigned int scc::tlm_target<BUSWIDTH>::tranport_dbg_cb(tlm::tlm_generic_payload &gp) {
159 159
     resource_access_if *ra = nullptr;
160 160
     uint64_t base = 0;
161 161
     std::tie(ra, base) = socket_map.getEntry(gp.get_address());

+ 1
- 1
incl/scc/traceable.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.

+ 2
- 2
incl/scc/tracer.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ public:
57 57
 
58 58
 protected:
59 59
     void end_of_elaboration() override;
60
-    virtual void descend(const sc_core::sc_object*);
60
+    virtual void descend(const sc_core::sc_object *);
61 61
     virtual void try_trace_signal(const sc_core::sc_object *);
62 62
     virtual void try_trace_port(const sc_core::sc_object *);
63 63
     bool enabled;

+ 27
- 29
incl/scc/utilities.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -36,16 +36,15 @@
36 36
 
37 37
 #if __cplusplus < 201402L
38 38
 namespace std {
39
-template<typename T, typename... Args>
40
-std::unique_ptr<T> make_unique(Args&&... args){
39
+template <typename T, typename... Args> std::unique_ptr<T> make_unique(Args &&... args) {
41 40
     return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
42 41
 }
43 42
 }
44 43
 #endif
45 44
 
46
-#define NAMED(X, ...)         X(#X, ##__VA_ARGS__)
47
-#define NAMEDD(X, T, ...)     X(std::make_unique<T>(#X, ##__VA_ARGS__))
48
-#define NAMEDC(X, T, I, ...)  X(T::create<I>(#X, ##__VA_ARGS__))
45
+#define NAMED(X, ...) X(#X, ##__VA_ARGS__)
46
+#define NAMEDD(X, T, ...) X(std::make_unique<T>(#X, ##__VA_ARGS__))
47
+#define NAMEDC(X, T, I, ...) X(T::create<I>(#X, ##__VA_ARGS__))
49 48
 
50 49
 #define TRACE_VAR(F, X) sc_core::sc_trace(F, X, std::string(this->name()) + "." #X)
51 50
 #define TRACE_ARR(F, X, I)                                                                                             \
@@ -54,7 +53,7 @@ std::unique_ptr<T> make_unique(Args&&... args){
54 53
 
55 54
 namespace sc_core {
56 55
 // needed to be able to use sc_time as signal value
57
-#if SC_VERSION_MAJOR<=2 && SC_VERSION_MINOR<=3 && SC_VERSION_PATCH<2
56
+#if SC_VERSION_MAJOR <= 2 && SC_VERSION_MINOR <= 3 && SC_VERSION_PATCH < 2
58 57
 /**
59 58
  *
60 59
  * @param
@@ -172,11 +171,10 @@ inline constexpr uint64_t operator"" _GB(unsigned long long val) { return val *
172 171
 
173 172
 namespace scc {
174 173
 
175
-inline bool icompare(std::string const& a, std::string const& b){
176
-    if (a.length()==b.length()) {
177
-        return std::equal(b.begin(), b.end(), a.begin(),  [](unsigned char a, unsigned char b) -> bool {
178
-            return std::tolower(a) == std::tolower(b);
179
-        });
174
+inline bool icompare(std::string const &a, std::string const &b) {
175
+    if (a.length() == b.length()) {
176
+        return std::equal(b.begin(), b.end(), a.begin(),
177
+                          [](unsigned char a, unsigned char b) -> bool { return std::tolower(a) == std::tolower(b); });
180 178
     } else {
181 179
         return false;
182 180
     }
@@ -184,29 +182,29 @@ inline bool icompare(std::string const& a, std::string const& b){
184 182
 
185 183
 inline sc_core::sc_time parse_from_string(std::string value, std::string unit) noexcept {
186 184
     std::string::size_type offs{0};
187
-    double t_val=std::stod(value, &offs);
188
-    if(offs>0){
189
-        if(icompare(unit, "fs")) return t_val * 1_fs;
190
-        if(icompare(unit, "ps")) return t_val * 1_ps;
191
-        if(icompare(unit, "ns")) return t_val * 1_ns;
192
-        if(icompare(unit, "us")) return t_val * 1_us;
193
-        if(icompare(unit, "ms")) return t_val * 1_ms;
194
-        if(icompare(unit, "s")) return t_val * 1_sec;
185
+    double t_val = std::stod(value, &offs);
186
+    if (offs > 0) {
187
+        if (icompare(unit, "fs")) return t_val * 1_fs;
188
+        if (icompare(unit, "ps")) return t_val * 1_ps;
189
+        if (icompare(unit, "ns")) return t_val * 1_ns;
190
+        if (icompare(unit, "us")) return t_val * 1_us;
191
+        if (icompare(unit, "ms")) return t_val * 1_ms;
192
+        if (icompare(unit, "s")) return t_val * 1_sec;
195 193
     }
196 194
     return sc_core::SC_ZERO_TIME;
197 195
 }
198 196
 
199 197
 inline sc_core::sc_time parse_from_string(std::string value) noexcept {
200 198
     std::string::size_type offs{0};
201
-    double t_val=std::stod(value, &offs);
202
-    if(offs>0){
203
-        std::string unit=value.substr(offs);
204
-        if(icompare(unit, "fs")) return t_val * 1_fs;
205
-        if(icompare(unit, "ps")) return t_val * 1_ps;
206
-        if(icompare(unit, "ns")) return t_val * 1_ns;
207
-        if(icompare(unit, "us")) return t_val * 1_us;
208
-        if(icompare(unit, "ms")) return t_val * 1_ms;
209
-        if(icompare(unit, "s")) return t_val * 1_sec;
199
+    double t_val = std::stod(value, &offs);
200
+    if (offs > 0) {
201
+        std::string unit = value.substr(offs);
202
+        if (icompare(unit, "fs")) return t_val * 1_fs;
203
+        if (icompare(unit, "ps")) return t_val * 1_ps;
204
+        if (icompare(unit, "ns")) return t_val * 1_ns;
205
+        if (icompare(unit, "us")) return t_val * 1_us;
206
+        if (icompare(unit, "ms")) return t_val * 1_ms;
207
+        if (icompare(unit, "s")) return t_val * 1_sec;
210 208
     }
211 209
     return sc_core::SC_ZERO_TIME;
212 210
 }

+ 32
- 34
incl/scv4tlm/tlm2_recorder.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
19 19
 
20 20
 #include "tlm_gp_data_ext.h"
21 21
 #include "tlm_recording_extension.h"
22
+#include <array>
22 23
 #include <map>
23 24
 #include <regex>
24 25
 #include <scv.h>
@@ -26,7 +27,6 @@
26 27
 #include <tlm>
27 28
 #include <tlm_utils/peq_with_cb_and_phase.h>
28 29
 #include <vector>
29
-#include <array>
30 30
 
31 31
 namespace scv4tlm {
32 32
 
@@ -65,8 +65,9 @@ class tlm2_recorder : public virtual tlm::tlm_fw_transport_if<TYPES>,
65 65
                       public virtual tlm::tlm_bw_transport_if<TYPES>,
66 66
                       public sc_core::sc_object {
67 67
     const std::regex pat{"_rec$"};
68
+
68 69
 public:
69
-    SC_HAS_PROCESS(tlm2_recorder<TYPES>);
70
+    SC_HAS_PROCESS(tlm2_recorder<TYPES>);// NOLINT
70 71
 
71 72
     //! \brief the attribute to selectively enable/disable recording
72 73
     sc_core::sc_attribute<bool> enableTracing;
@@ -89,8 +90,7 @@ public:
89 90
      * scv_tr_db::set_default_db() ) recording is disabled.
90 91
      */
91 92
     tlm2_recorder(bool recording_enabled = true, scv_tr_db *tr_db = scv_tr_db::get_default_db())
92
-    : tlm2_recorder(sc_core::sc_gen_unique_name("tlm2_recorder"), recording_enabled, tr_db)
93
-    { }
93
+    : tlm2_recorder(sc_core::sc_gen_unique_name("tlm2_recorder"), recording_enabled, tr_db) {}
94 94
     /*! \brief The constructor of the component
95 95
      *
96 96
      * \param name is the SystemC module name of the recorder
@@ -122,9 +122,9 @@ public:
122 122
     , dmi_trGetHandle(NULL)
123 123
     , dmi_trInvalidateHandle(NULL)
124 124
     , extensionRecording(NULL)
125
-    , fixed_basename(regex_replace(sc_core::sc_object::name(), pat, "")){
126
-    	this->add_attribute(enableTracing);
127
-    	this->add_attribute(enableTimed);
125
+    , fixed_basename(regex_replace(sc_core::sc_object::name(), pat, "")) {
126
+        this->add_attribute(enableTracing);
127
+        this->add_attribute(enableTimed);
128 128
     }
129 129
 
130 130
     virtual ~tlm2_recorder() override {
@@ -299,7 +299,7 @@ private:
299 299
     //! blocking transaction recording stream handle
300 300
     scv_tr_stream *b_streamHandle;
301 301
     //! transaction generator handle for blocking transactions
302
-	std::array<scv_tr_generator<sc_dt::uint64,sc_dt::uint64> *,3> b_trHandle;
302
+    std::array<scv_tr_generator<sc_dt::uint64, sc_dt::uint64> *, 3> b_trHandle;
303 303
     //! timed blocking transaction recording stream handle
304 304
     scv_tr_stream *b_streamHandleTimed;
305 305
     //! transaction generator handle for blocking transactions with annotated
@@ -388,8 +388,8 @@ void tlm2_recorder<TYPES>::b_transport(typename TYPES::tlm_payload_type &trans,
388 388
     }
389 389
     scv_tr_handle preTx{preExt->txHandle};
390 390
     preExt->txHandle = h;
391
-    if(trans.get_command()==tlm::TLM_WRITE_COMMAND && tgd.data_length<8)
392
-    	h.record_attribute("trans.data_value", tgd.get_data_value());
391
+    if (trans.get_command() == tlm::TLM_WRITE_COMMAND && tgd.data_length < 8)
392
+        h.record_attribute("trans.data_value", tgd.get_data_value());
393 393
     fw_port->b_transport(trans, delay);
394 394
     trans.get_extension(preExt);
395 395
     if (preExt->get_creator() == this) {
@@ -400,10 +400,10 @@ void tlm2_recorder<TYPES>::b_transport(typename TYPES::tlm_payload_type &trans,
400 400
         preExt->txHandle = preTx;
401 401
     }
402 402
 
403
-    tgd.response_status=trans.get_response_status();
403
+    tgd.response_status = trans.get_response_status();
404 404
     h.record_attribute("trans", tgd);
405
-    if(trans.get_command()==tlm::TLM_READ_COMMAND && tgd.data_length<8)
406
-    	h.record_attribute("trans.data_value", tgd.get_data_value());
405
+    if (trans.get_command() == tlm::TLM_READ_COMMAND && tgd.data_length < 8)
406
+        h.record_attribute("trans.data_value", tgd.get_data_value());
407 407
     if (extensionRecording) extensionRecording->recordEndTx(h, trans);
408 408
     // End the transaction
409 409
     b_trHandle[trans.get_command()]->end_transaction(h, delay.value(), sc_time_stamp());
@@ -511,13 +511,13 @@ tlm::tlm_sync_enum tlm2_recorder<TYPES>::nb_transport_fw(typename TYPES::tlm_pay
511 511
     /*************************************************************************
512 512
      * handle recording
513 513
      *************************************************************************/
514
-    tgd.response_status=trans.get_response_status();
514
+    tgd.response_status = trans.get_response_status();
515 515
     h.record_attribute("trans", tgd);
516
-    if(tgd.data_length<8){
517
-    	uint64_t buf=0;
518
-    	//FIXME: this is endianess dependent
519
-    	for(size_t i = 0; i<tgd.data_length; i++) buf+=(*tgd.data)<<i*8;
520
-    	h.record_attribute("trans.data_value", buf);
516
+    if (tgd.data_length < 8) {
517
+        uint64_t buf = 0;
518
+        // FIXME: this is endianess dependent
519
+        for (size_t i = 0; i < tgd.data_length; i++) buf += (*tgd.data) << i * 8;
520
+        h.record_attribute("trans.data_value", buf);
521 521
     }
522 522
     if (extensionRecording) extensionRecording->recordEndTx(h, trans);
523 523
     h.record_attribute("tlm_phase[return_path]", (tlm::tlm_phase_enum)(unsigned)phase);
@@ -596,13 +596,13 @@ tlm::tlm_sync_enum tlm2_recorder<TYPES>::nb_transport_bw(typename TYPES::tlm_pay
596 596
     /*************************************************************************
597 597
      * handle recording
598 598
      *************************************************************************/
599
-    tgd.response_status=trans.get_response_status();
599
+    tgd.response_status = trans.get_response_status();
600 600
     h.record_attribute("trans", tgd);
601
-    if(tgd.data_length<8){
602
-    	uint64_t buf=0;
603
-    	//FIXME: this is endianess dependent
604
-    	for(size_t i = 0; i<tgd.data_length; i++) buf+=(*tgd.data)<<i*8;
605
-    	h.record_attribute("trans.data_value", buf);
601
+    if (tgd.data_length < 8) {
602
+        uint64_t buf = 0;
603
+        // FIXME: this is endianess dependent
604
+        for (size_t i = 0; i < tgd.data_length; i++) buf += (*tgd.data) << i * 8;
605
+        h.record_attribute("trans.data_value", buf);
606 606
     }
607 607
     if (extensionRecording) extensionRecording->recordEndTx(h, trans);
608 608
     // phase and delay are already recorded
@@ -713,9 +713,8 @@ bool tlm2_recorder<TYPES>::get_direct_mem_ptr(typename TYPES::tlm_payload_type &
713 713
     if (!isRecordingEnabled()) {
714 714
         return fw_port->get_direct_mem_ptr(trans, dmi_data);
715 715
     }
716
-    if (!dmi_streamHandle)
717
-        dmi_streamHandle = new scv_tr_stream((fixed_basename + "_dmi").c_str(), "TRANSACTOR", m_db);
718
-    if(!dmi_trGetHandle)
716
+    if (!dmi_streamHandle) dmi_streamHandle = new scv_tr_stream((fixed_basename + "_dmi").c_str(), "TRANSACTOR", m_db);
717
+    if (!dmi_trGetHandle)
719 718
         dmi_trGetHandle =
720 719
             new scv_tr_generator<tlm_gp_data, tlm_dmi_data>("get_dmi_ptr", *dmi_streamHandle, "trans", "dmi_data");
721 720
     scv_tr_handle h = dmi_trGetHandle->begin_transaction(tlm_gp_data(trans));
@@ -735,11 +734,10 @@ void tlm2_recorder<TYPES>::invalidate_direct_mem_ptr(sc_dt::uint64 start_addr, s
735 734
         bw_port->invalidate_direct_mem_ptr(start_addr, end_addr);
736 735
         return;
737 736
     }
738
-    if (!dmi_streamHandle)
739
-        dmi_streamHandle = new scv_tr_stream((fixed_basename + "_dmi").c_str(), "TRANSACTOR", m_db);
740
-    if(!dmi_trInvalidateHandle)
741
-        dmi_trInvalidateHandle = new scv_tr_generator<sc_dt::uint64, sc_dt::uint64>("invalidate_dmi_ptr", *dmi_streamHandle,
742
-                                                                                    "start_delay", "end_delay");
737
+    if (!dmi_streamHandle) dmi_streamHandle = new scv_tr_stream((fixed_basename + "_dmi").c_str(), "TRANSACTOR", m_db);
738
+    if (!dmi_trInvalidateHandle)
739
+        dmi_trInvalidateHandle = new scv_tr_generator<sc_dt::uint64, sc_dt::uint64>(
740
+            "invalidate_dmi_ptr", *dmi_streamHandle, "start_delay", "end_delay");
743 741
 
744 742
     scv_tr_handle h = dmi_trInvalidateHandle->begin_transaction(start_addr);
745 743
     bw_port->invalidate_direct_mem_ptr(start_addr, end_addr);

+ 2
- 2
incl/scv4tlm/tlm2_recorder_module.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2017 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ namespace scv4tlm {
35 35
 template <unsigned int BUSWIDTH = 32, typename TYPES = tlm::tlm_base_protocol_types>
36 36
 class tlm2_recorder_module : public sc_core::sc_module, public tlm2_recorder<TYPES> {
37 37
 public:
38
-    SC_HAS_PROCESS(tlm2_recorder_module);
38
+    SC_HAS_PROCESS(tlm2_recorder_module);// NOLINT
39 39
     //! The target socket of the recorder to be bound to the initiator
40 40
     tlm::tlm_target_socket<BUSWIDTH, TYPES, 1> target;
41 41
     //! The initiator to be bound to the target socket

+ 13
- 14
incl/scv4tlm/tlm_gp_data.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2017 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -76,23 +76,22 @@ public:
76 76
         other.set_address(address);
77 77
         other.set_data_length(data_length);
78 78
         other.set_byte_enable_length(byte_enable_length);
79
-        other.set_streaming_width (streaming_width);
79
+        other.set_streaming_width(streaming_width);
80 80
         other.set_gp_option(gp_option);
81 81
         other.set_dmi_allowed(dmi_allowed);
82 82
         other.set_response_status(response_status);
83
-        if(transfer_ownership){
84
-        	other.set_byte_enable_ptr(byte_enable);
85
-        	other.set_data_ptr(data);
86
-        	byte_enable=nullptr;
87
-        	data=nullptr;
83
+        if (transfer_ownership) {
84
+            other.set_byte_enable_ptr(byte_enable);
85
+            other.set_data_ptr(data);
86
+            byte_enable = nullptr;
87
+            data = nullptr;
88 88
         }
89 89
     }
90 90
 
91 91
     //--------------
92 92
     // Destructor
93 93
     //--------------
94
-    virtual ~tlm_gp_data() {
95
-    }
94
+    virtual ~tlm_gp_data() {}
96 95
 
97 96
     std::string get_response_string() const {
98 97
         switch (response_status) {
@@ -114,11 +113,11 @@ public:
114 113
         return "TLM_UNKNOWN_RESPONSE";
115 114
     }
116 115
 
117
-    uint64_t get_data_value(){
118
-    	uint64_t buf=0;
119
-    	//FIXME: this is endianess dependent
120
-    	for(size_t i = 0; i<data_length; i++) buf+=(*(data+i))<<i*8;
121
-    	return buf;
116
+    uint64_t get_data_value() {
117
+        uint64_t buf = 0;
118
+        // FIXME: this is endianess dependent
119
+        for (size_t i = 0; i < data_length; i++) buf += (*(data + i)) << i * 8;
120
+        return buf;
122 121
     }
123 122
     // attributes are public so that scv_extension mechanism works
124 123
     sc_dt::uint64 address{0};

+ 1
- 1
incl/scv4tlm/tlm_gp_data_ext.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2017 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.

+ 1
- 1
incl/scv4tlm/tlm_rec_initiator_socket.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2017 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.

+ 1
- 1
incl/scv4tlm/tlm_rec_target_socket.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2017 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.

+ 3
- 3
incl/scv4tlm/tlm_recording_extension.h View File

@@ -1,5 +1,5 @@
1 1
 /*******************************************************************************
2
- * Copyright 2016 MINRES Technologies GmbH
2
+ * Copyright 2016, 2018 MINRES Technologies GmbH
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -17,8 +17,8 @@
17 17
 #ifndef TLM_RECORDING_EXTENSION_H_
18 18
 #define TLM_RECORDING_EXTENSION_H_
19 19
 
20
-#include <scv.h>
21 20
 #include <array>
21
+#include <scv.h>
22 22
 
23 23
 namespace scv4tlm {
24 24
 
@@ -28,7 +28,7 @@ enum tx_rel {
28 28
     PREDECESSOR_SUCCESSOR /*!< indicates predecessor successor relationship */
29 29
 };
30 30
 //! the string representation of the tx_rel
31
-static std::array<const char*, 2> tx_rel_str = { { "PARENT/CHILD", "PRED/SUCC" } };
31
+static std::array<const char *, 2> tx_rel_str = {{"PARENT/CHILD", "PRED/SUCC"}};
32 32
 /*! \brief cast the tx_rel enum to a string
33 33
  *
34 34
  * \param tc_rel is the relationship enum

+ 37
- 38
incl/tlm/tlm_extensions.h View File

@@ -1,9 +1,18 @@
1
-/*
2
- * tlm_extensions.h
1
+/*******************************************************************************
2
+ * Copyright 2018 MINRES Technologies GmbH
3 3
  *
4
- *  Created on: 12.07.2018
5
- *      Author: eyck
6
- */
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *******************************************************************************/
7 16
 
8 17
 #ifndef SC_COMPONENTS_INCL_TLM_TLM_EXTENSIONS_H_
9 18
 #define SC_COMPONENTS_INCL_TLM_TLM_EXTENSIONS_H_
@@ -12,50 +21,41 @@
12 21
 
13 22
 namespace tlm {
14 23
 
15
-template<typename T>
16
-struct tlm_unmanaged_extension : public tlm_extension<T> {
24
+template <typename T> struct tlm_unmanaged_extension : public tlm_extension<T> {
17 25
     using type = T;
18 26
 
19
-    tlm_extension_base* clone() const override {
20
-        return new type(static_cast<const T&>(*this));
21
-    }
27
+    tlm_extension_base *clone() const override { return new type(static_cast<const T &>(*this)); }
22 28
 
23
-    void copy_from(tlm_extension_base const & other) override {
24
-        this->operator=(static_cast<const type&>(other));
25
-    }
29
+    void copy_from(tlm_extension_base const &other) override { this->operator=(static_cast<const type &>(other)); }
26 30
 
27 31
 protected:
28 32
     tlm_unmanaged_extension(){};
29 33
 };
30 34
 
31
-template<typename T>
32
-struct tlm_managed_extension {
35
+template <typename T> struct tlm_managed_extension {
33 36
 
34 37
     using type = T;
35 38
 
36
-    template<typename... Args>
37
-    static type* alloacte(Args&&... args){
38
-        auto* ret = new(pool::allocate()) type(std::forward<Args>(args)...);
39
-        ret->is_pooled=true;
39
+    template <typename... Args> static type *alloacte(Args &&... args) {
40
+        auto *ret = new (pool::allocate()) type(std::forward<Args>(args)...);
41
+        ret->is_pooled = true;
40 42
         return ret;
41 43
     }
42 44
 
43
-    static type* allocate(){
44
-        auto* ret = new(pool::allocate()) type();
45
-        ret->is_pooled=true;
45
+    static type *allocate() {
46
+        auto *ret = new (pool::allocate()) type();
47
+        ret->is_pooled = true;
46 48
         return ret;
47 49
     }
48 50
 
49
-    tlm_extension_base* clone() const override {
51
+    tlm_extension_base *clone() const {
50 52
         return allocate(); // Maybe static_cast<const T&>(*this)
51 53
     }
52 54
 
53
-    void copy_from(tlm_extension_base const & other) override {
54
-        this->operator=(static_cast<const type&>(other));
55
-    }
55
+    void copy_from(tlm_extension_base const &other) { this->operator=(static_cast<const type &>(other)); }
56 56
 
57
-    void free() override {
58
-        if(is_pooled){
57
+    void free() {
58
+        if (is_pooled) {
59 59
             this->~type();
60 60
             pool::dealllocate(this);
61 61
         } else {
@@ -63,8 +63,8 @@ struct tlm_managed_extension {
63 63
         }
64 64
     }
65 65
     struct pool {
66
-        static void* allocate(){
67
-            if(free_list.size()>0){
66
+        static void *allocate() {
67
+            if (free_list.size() > 0) {
68 68
                 auto ret = free_list.back();
69 69
                 free_list.pop_back();
70 70
                 return ret;
@@ -72,22 +72,21 @@ struct tlm_managed_extension {
72 72
                 return calloc(1, sizeof(type));
73 73
         }
74 74
 
75
-        static void dealllocate(void* p){
76
-            free_list.push_back(p);
77
-        }
75
+        static void dealllocate(void *p) { free_list.push_back(p); }
78 76
 
79 77
     private:
80
-        static std::vector<void*> free_list;
78
+        static std::vector<void *> free_list;
81 79
     };
82 80
 
83 81
 protected:
84
-    tlm_managed_extension():is_pooled(false) {}
85
-    tlm_managed_extension(const tlm_managed_extension&):is_pooled(false) {}
86
-    tlm_managed_extension& operator=(const tlm_managed_extension& other){return *this;}
82
+    tlm_managed_extension()
83
+    : is_pooled(false) {}
84
+    tlm_managed_extension(const tlm_managed_extension &)
85
+    : is_pooled(false) {}
86
+    tlm_managed_extension &operator=(const tlm_managed_extension &other) { return *this; }
87 87
 
88 88
 private:
89 89
     bool is_pooled;
90 90
 };
91
-
92 91
 }
93 92
 #endif /* SC_COMPONENTS_INCL_TLM_TLM_EXTENSIONS_H_ */

+ 50
- 47
incl/tlm/tlm_signal.h View File

@@ -1,9 +1,18 @@
1
-/*
2
- * tlm_signal.h
1
+/*******************************************************************************
2
+ * Copyright 2018 MINRES Technologies GmbH
3 3
  *
4
- *  Created on: 03.07.2018
5
- *      Author: eyck
6
- */
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *******************************************************************************/
7 16
 
8 17
 #ifndef _TLM_TLM_SIGNAL_H_
9 18
 #define _TLM_TLM_SIGNAL_H_
@@ -14,19 +23,17 @@
14 23
 
15 24
 namespace tlm {
16 25
 
17
-template<typename SIG=bool, typename TYPES = tlm_signal_baseprotocol_types<SIG>, int N = 32>
18
-struct tlm_signal:
19
-        public sc_core::sc_module,
20
-        public tlm_signal_fw_transport_if<SIG, TYPES>,
21
-        public tlm_signal_bw_transport_if<SIG, TYPES>,
22
-        sc_core::sc_signal_in_if<SIG>
23
-{
26
+template <typename SIG = bool, typename TYPES = tlm_signal_baseprotocol_types<SIG>, int N = 32>
27
+struct tlm_signal : public sc_core::sc_module,
28
+                    public tlm_signal_fw_transport_if<SIG, TYPES>,
29
+                    public tlm_signal_bw_transport_if<SIG, TYPES>,
30
+                    sc_core::sc_signal_in_if<SIG> {
24 31
     using tlm_signal_type = SIG;
25 32
     using protocol_types = TYPES;
26 33
     using payload_type = typename TYPES::tlm_payload_type;
27 34
     using phase_type = typename TYPES::tlm_phase_type;
28 35
 
29
-    SC_HAS_PROCESS(tlm_signal);
36
+    SC_HAS_PROCESS(tlm_signal);// NOLINT
30 37
 
31 38
     tlm_signal_opt_target_socket<tlm_signal_type, protocol_types, N> in;
32 39
 
@@ -35,40 +42,39 @@ struct tlm_signal:
35 42
     tlm_signal(sc_core::sc_module_name nm)
36 43
     : sc_core::sc_module(nm)
37 44
     , in(sc_core::sc_gen_unique_name("in"))
38
-    , out(sc_core::sc_gen_unique_name("out"))
39
-    {
40
-        in.bind(*(tlm_signal_fw_transport_if<tlm_signal_type, protocol_types>*)this);
41
-        out.bind(*(tlm_signal_bw_transport_if<tlm_signal_type, protocol_types>*)this);
45
+    , out(sc_core::sc_gen_unique_name("out")) {
46
+        in.bind(*(tlm_signal_fw_transport_if<tlm_signal_type, protocol_types> *)this);
47
+        out.bind(*(tlm_signal_bw_transport_if<tlm_signal_type, protocol_types> *)this);
42 48
         SC_METHOD(que_cb);
43
-        sensitive<<que.event();
49
+        sensitive << que.event();
44 50
     }
45 51
 
46
-    void trace( sc_core::sc_trace_file* tf ) const override;
52
+    void trace(sc_core::sc_trace_file *tf) const override;
47 53
 
48
-    const char* kind() const override { return "tlm_signal"; }
54
+    const char *kind() const override { return "tlm_signal"; }
49 55
 
50
-    tlm_sync_enum nb_transport_fw(payload_type&, phase_type&, sc_core::sc_time&) override;
56
+    tlm_sync_enum nb_transport_fw(payload_type &, phase_type &, sc_core::sc_time &) override;
51 57
 
52
-    tlm_sync_enum nb_transport_bw(payload_type&, phase_type&, sc_core::sc_time&) override;
58
+    tlm_sync_enum nb_transport_bw(payload_type &, phase_type &, sc_core::sc_time &) override;
53 59
 
54 60
     // get the value changed event
55
-    const sc_core::sc_event& value_changed_event() const override {return value.value_changed_event();}
61
+    const sc_core::sc_event &value_changed_event() const override { return value.value_changed_event(); }
56 62
     // read the current value
57
-    const SIG& read() const override{ return value.read();}
63
+    const SIG &read() const override { return value.read(); }
58 64
     // get a reference to the current value (for tracing)
59
-    const SIG& get_data_ref() const override {return value.get_data_ref();}
65
+    const SIG &get_data_ref() const override { return value.get_data_ref(); }
60 66
     // was there a value changed event?
61
-    bool event() const override {return false;}
67
+    bool event() const override { return false; }
62 68
 
63
-    const sc_core::sc_event& default_event() const override {return value.default_event();}
69
+    const sc_core::sc_event &default_event() const override { return value.default_event(); }
64 70
 
65
-    const sc_core::sc_event& posedge_event() const override {return value.posedge_event();}
71
+    const sc_core::sc_event &posedge_event() const override { return value.posedge_event(); }
66 72
 
67
-    const sc_core::sc_event& negedge_event() const override {return value.negedge_event();}
73
+    const sc_core::sc_event &negedge_event() const override { return value.negedge_event(); }
68 74
 
69
-    bool posedge() const override {return value.posedge();}
75
+    bool posedge() const override { return value.posedge(); }
70 76
 
71
-    bool negedge() const override {return value.posedge();};
77
+    bool negedge() const override { return value.posedge(); };
72 78
 
73 79
 private:
74 80
     void que_cb();
@@ -76,36 +82,33 @@ private:
76 82
     sc_core::sc_signal<tlm_signal_type> value;
77 83
 };
78 84
 
79
-template<typename SIG , typename TYPES, int N>
80
-void tlm_signal<SIG, TYPES, N>::trace(sc_core::sc_trace_file* tf) const {
85
+template <typename SIG, typename TYPES, int N> void tlm_signal<SIG, TYPES, N>::trace(sc_core::sc_trace_file *tf) const {
81 86
     sc_trace(tf, value, name());
82 87
 }
83 88
 
84
-
85
-template<typename SIG, typename TYPES, int N>
86
-tlm_sync_enum tlm::tlm_signal<SIG, TYPES, N>::nb_transport_fw(payload_type& gp, phase_type& phase, sc_core::sc_time& delay) {
89
+template <typename SIG, typename TYPES, int N>
90
+tlm_sync_enum tlm::tlm_signal<SIG, TYPES, N>::nb_transport_fw(payload_type &gp, phase_type &phase,
91
+                                                              sc_core::sc_time &delay) {
87 92
     que.notify(gp.get_value(), delay);
88
-    auto& p = out.get_base_port();
89
-    for(size_t i=0; i<p.size(); ++i){
93
+    auto &p = out.get_base_port();
94
+    for (size_t i = 0; i < p.size(); ++i) {
90 95
         p.get_interface(i)->nb_transport_fw(gp, phase, delay);
91 96
     }
92 97
     return TLM_COMPLETED;
93 98
 }
94 99
 
95
-template<typename SIG, typename TYPES, int N>
96
-tlm_sync_enum tlm::tlm_signal<SIG, TYPES, N>::nb_transport_bw(payload_type& gp, phase_type& phase, sc_core::sc_time& delay) {
97
-    auto& p = in.get_base_port();
98
-    for(size_t i=0; i<p.size(); ++i){
100
+template <typename SIG, typename TYPES, int N>
101
+tlm_sync_enum tlm::tlm_signal<SIG, TYPES, N>::nb_transport_bw(payload_type &gp, phase_type &phase,
102
+                                                              sc_core::sc_time &delay) {
103
+    auto &p = in.get_base_port();
104
+    for (size_t i = 0; i < p.size(); ++i) {
99 105
         p.get_interface(i)->nb_transport_bw(gp, phase, delay);
100 106
     }
101 107
     return TLM_COMPLETED;
102 108
 }
103 109
 
104
-template<typename SIG, typename TYPES, int N>
105
-void tlm::tlm_signal<SIG, TYPES, N>::que_cb(){
106
-    while(auto oi = que.get_next())
107
-        value.write(oi.get());
110
+template <typename SIG, typename TYPES, int N> void tlm::tlm_signal<SIG, TYPES, N>::que_cb() {
111
+    while (auto oi = que.get_next()) value.write(oi.get());
108 112
 }
109
-
110 113
 }
111 114
 #endif /* _TLM_TLM_SIGNAL_H_ */

+ 34
- 33
incl/tlm/tlm_signal_conv.h View File

@@ -1,30 +1,38 @@
1
-/*
2
- * tlm_signal_conv.h
1
+/*******************************************************************************
2
+ * Copyright 2018 MINRES Technologies GmbH
3 3
  *
4
- *  Created on: 03.10.2018
5
- *      Author: eyck
6
- */
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *******************************************************************************/
7 16
 
8 17
 #ifndef _TLM_TLM_SIGNAL_CONV_H_
9 18
 #define _TLM_TLM_SIGNAL_CONV_H_
10 19
 
11
-#include "tlm_signal_sockets.h"
12 20
 #include "tlm_signal_gp.h"
13
-#include <scc/peq.h>
21
+#include "tlm_signal_sockets.h"
14 22
 #include <deque>
23
+#include <scc/peq.h>
15 24
 
16 25
 namespace tlm {
17 26
 
18
-template<typename TYPE>
19
-struct tlm_signal2sc_signal:
20
-        public sc_core::sc_module,
21
-        public tlm_signal_fw_transport_if<TYPE, tlm_signal_baseprotocol_types<TYPE>> {
27
+template <typename TYPE>
28
+struct tlm_signal2sc_signal : public sc_core::sc_module,
29
+                              public tlm_signal_fw_transport_if<TYPE, tlm_signal_baseprotocol_types<TYPE>> {
22 30
 
23 31
     using protocol_types = tlm_signal_baseprotocol_types<TYPE>;
24 32
     using payload_type = typename protocol_types::tlm_payload_type;
25 33
     using phase_type = typename protocol_types::tlm_phase_type;
26 34
 
27
-    SC_HAS_PROCESS(tlm_signal2sc_signal);
35
+    SC_HAS_PROCESS(tlm_signal2sc_signal);// NOLINT
28 36
 
29 37
     tlm_signal_target_socket<TYPE> t_i;
30 38
 
@@ -33,36 +41,33 @@ struct tlm_signal2sc_signal:
33 41
     tlm_signal2sc_signal(sc_core::sc_module_name nm)
34 42
     : sc_core::sc_module(nm)
35 43
     , NAMED(t_i)
36
-    , NAMED(s_o)
37
-    {
44
+    , NAMED(s_o) {
38 45
         t_i.bind(*this);
39 46
         SC_METHOD(que_cb);
40
-        sensitive<<que.event();
47
+        sensitive << que.event();
41 48
     }
42 49
 
43 50
 private:
44
-    tlm_sync_enum nb_transport_fw(payload_type& gp, phase_type& phase, sc_core::sc_time& delay) {
51
+    tlm_sync_enum nb_transport_fw(payload_type &gp, phase_type &phase, sc_core::sc_time &delay) {
45 52
         que.notify(gp.get_value(), delay);
46 53
         return TLM_COMPLETED;
47 54
     }
48 55
 
49
-    void que_cb(){
50
-        while(auto oi = que.get_next())
51
-            s_o.write(oi.get());
56
+    void que_cb() {
57
+        while (auto oi = que.get_next()) s_o.write(oi.get());
52 58
     }
53 59
     scc::peq<TYPE> que;
54 60
 };
55 61
 
56
-template<typename TYPE>
57
-struct sc_signal2tlm_signal:
58
-        public sc_core::sc_module,
59
-        public tlm_signal_bw_transport_if<TYPE, tlm_signal_baseprotocol_types<TYPE>> {
62
+template <typename TYPE>
63
+struct sc_signal2tlm_signal : public sc_core::sc_module,
64
+                              public tlm_signal_bw_transport_if<TYPE, tlm_signal_baseprotocol_types<TYPE>> {
60 65
 
61 66
     using protocol_types = tlm_signal_baseprotocol_types<TYPE>;
62 67
     using payload_type = typename protocol_types::tlm_payload_type;
63 68
     using phase_type = typename protocol_types::tlm_phase_type;
64 69
 
65
-    SC_HAS_PROCESS(sc_signal2tlm_signal);
70
+    SC_HAS_PROCESS(sc_signal2tlm_signal);// NOLINT
66 71
 
67 72
     sc_core::sc_in<TYPE> s_i;
68 73
 
@@ -71,30 +76,26 @@ struct sc_signal2tlm_signal:
71 76
     sc_signal2tlm_signal(sc_core::sc_module_name nm)
72 77
     : sc_core::sc_module(nm)
73 78
     , NAMED(s_i)
74
-    , NAMED(t_o)
75
-    {
79
+    , NAMED(t_o) {
76 80
         t_o.bind(*this);
77 81
         SC_METHOD(sig_cb);
78
-        sensitive<<s_i;
82
+        sensitive << s_i;
79 83
     }
80 84
 
81 85
 private:
82
-
83
-    tlm_sync_enum nb_transport_bw(payload_type& gp, phase_type& phase, sc_core::sc_time& delay) {
86
+    tlm_sync_enum nb_transport_bw(payload_type &gp, phase_type &phase, sc_core::sc_time &delay) {
84 87
         return TLM_COMPLETED;
85 88
     }
86 89
 
87
-    void sig_cb(){
90
+    void sig_cb() {
88 91
         tlm::tlm_phase phase(tlm::BEGIN_REQ);
89 92
         sc_core::sc_time delay;
90
-        auto* gp = payload_type::create();
93
+        auto *gp = payload_type::create();
91 94
         gp->acquire();
92 95
         gp->set_value(s_i.read());
93 96
         t_o->nb_transport_fw(*gp, phase, delay);
94 97
         gp->release();
95 98
     }
96
-
97 99
 };
98
-
99 100
 }
100 101
 #endif /* _TLM_TLM_SIGNAL_CONV_H_ */

+ 130
- 163
incl/tlm/tlm_signal_gp.h View File

@@ -1,15 +1,24 @@
1
-/*
2
- * tlm_signal.h
1
+/*******************************************************************************
2
+ * Copyright 2018 MINRES Technologies GmbH
3 3
  *
4
- *  Created on: 03.07.2018
5
- *      Author: eyck
6
- */
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *******************************************************************************/
7 16
 
8 17
 #ifndef _TLM_TLM_SIGNAL_GP_H_
9 18
 #define _TLM_TLM_SIGNAL_GP_H_
10 19
 
11
-#include <tlm_core/tlm_2/tlm_generic_payload/tlm_gp.h>
12 20
 #include <deque>
21
+#include <tlm_core/tlm_2/tlm_generic_payload/tlm_gp.h>
13 22
 
14 23
 namespace tlm {
15 24
 
@@ -17,114 +26,88 @@ struct tlm_generic_payload_base;
17 26
 
18 27
 class tlm_base_mm_interface {
19 28
 public:
20
-  virtual void free(tlm_generic_payload_base*) = 0;
21
-  virtual ~tlm_base_mm_interface() {}
29
+    virtual void free(tlm_generic_payload_base *) = 0;
30
+    virtual ~tlm_base_mm_interface() {}
22 31
 };
23 32
 
24 33
 struct tlm_generic_payload_base {
25
-    tlm_generic_payload_base():tlm_generic_payload_base(nullptr){}
34
+    tlm_generic_payload_base()
35
+    : tlm_generic_payload_base(nullptr) {}
26 36
 
27
-    explicit tlm_generic_payload_base(tlm_base_mm_interface* mm)
37
+    explicit tlm_generic_payload_base(tlm_base_mm_interface *mm)
28 38
     : m_extensions(max_num_extensions())
29 39
     , m_mm(mm)
30
-    , m_ref_count(0)
31
-    {};
40
+    , m_ref_count(0){};
32 41
 
33
-    virtual ~tlm_generic_payload_base(){
34
-        for(unsigned int i=0; i<m_extensions.size(); i++)
35
-            if(m_extensions[i]) m_extensions[i]->free();
42
+    virtual ~tlm_generic_payload_base() {
43
+        for (unsigned int i = 0; i < m_extensions.size(); i++)
44
+            if (m_extensions[i]) m_extensions[i]->free();
36 45
     }
37 46
 
38
-    void reset() {
39
-        m_extensions.free_entire_cache();
40
-    }
47
+    void reset() { m_extensions.free_entire_cache(); }
41 48
 
42
-    void acquire() { sc_assert(m_mm != 0); m_ref_count++; }
49
+    void acquire() {
50
+        sc_assert(m_mm != 0);
51
+        m_ref_count++;
52
+    }
43 53
 
44 54
     void release() {
45 55
         sc_assert(m_mm != 0 && m_ref_count > 0);
46
-        if (--m_ref_count==0)
47
-            m_mm->free(this);
56
+        if (--m_ref_count == 0) m_mm->free(this);
48 57
     }
49 58
 
50 59
     int get_ref_count() const { return m_ref_count; }
51 60
 
52
-    void set_mm(tlm_base_mm_interface* mm) { m_mm = mm; }
61
+    void set_mm(tlm_base_mm_interface *mm) { m_mm = mm; }
53 62
     bool has_mm() const { return m_mm != 0; }
54 63
 
55
-    void copy_extensions_from(const tlm_generic_payload_base& other);
64
+    void copy_extensions_from(const tlm_generic_payload_base &other);
56 65
 
57
-    void update_extensions_from(const tlm_generic_payload_base & other);
66
+    void update_extensions_from(const tlm_generic_payload_base &other);
58 67
     // Free all extensions. Useful when reusing a cloned transaction that doesn't have memory manager.
59 68
     // normal and sticky extensions are freed and extension array cleared.
60 69
     void free_all_extensions();
61 70
     // Stick the pointer to an extension into the vector, return the
62 71
     // previous value:
63
-    template <typename T> T* set_extension(T* ext)
64
-    {
65
-        return static_cast<T*>(set_extension(T::ID, ext));
66
-    }
72
+    template <typename T> T *set_extension(T *ext) { return static_cast<T *>(set_extension(T::ID, ext)); }
67 73
 
68 74
     // non-templatized version with manual index:
69
-    tlm_extension_base* set_extension(unsigned int index,
70
-                                      tlm_extension_base* ext);
75
+    tlm_extension_base *set_extension(unsigned int index, tlm_extension_base *ext);
71 76
 
72 77
     // Stick the pointer to an extension into the vector, return the
73 78
     // previous value and schedule its release
74
-    template <typename T> T* set_auto_extension(T* ext)
75
-    {
76
-        return static_cast<T*>(set_auto_extension(T::ID, ext));
77
-    }
79
+    template <typename T> T *set_auto_extension(T *ext) { return static_cast<T *>(set_auto_extension(T::ID, ext)); }
78 80
 
79 81
     // non-templatized version with manual index:
80
-    tlm_extension_base* set_auto_extension(unsigned int index,
81
-                                           tlm_extension_base* ext);
82
+    tlm_extension_base *set_auto_extension(unsigned int index, tlm_extension_base *ext);
82 83
 
83 84
     // Check for an extension, ext will point to 0 if not present
84
-    template <typename T> void get_extension(T*& ext) const
85
-    {
86
-        ext = get_extension<T>();
87
-    }
88
-    template <typename T> T* get_extension() const
89
-    {
90
-        return static_cast<T*>(get_extension(T::ID));
91
-    }
85
+    template <typename T> void get_extension(T *&ext) const { ext = get_extension<T>(); }
86
+    template <typename T> T *get_extension() const { return static_cast<T *>(get_extension(T::ID)); }
92 87
     // Non-templatized version with manual index:
93
-    tlm_extension_base* get_extension(unsigned int index) const;
88
+    tlm_extension_base *get_extension(unsigned int index) const;
94 89
 
95
-    //this call just removes the extension from the txn but does not
90
+    // this call just removes the extension from the txn but does not
96 91
     // call free() or tells the MM to do so
97 92
     // it return false if there was active MM so you are now in an unsafe situation
98 93
     // recommended use: when 100% sure there is no MM
99
-    template <typename T> void clear_extension(const T* ext)
100
-    {
101
-        clear_extension<T>();
102
-    }
94
+    template <typename T> void clear_extension(const T *ext) { clear_extension<T>(); }
103 95
 
104
-    //this call just removes the extension from the txn but does not
96
+    // this call just removes the extension from the txn but does not
105 97
     // call free() or tells the MM to do so
106 98
     // it return false if there was active MM so you are now in an unsafe situation
107 99
     // recommended use: when 100% sure there is no MM
108
-    template <typename T> void clear_extension()
109
-    {
110
-        clear_extension(T::ID);
111
-    }
100
+    template <typename T> void clear_extension() { clear_extension(T::ID); }
112 101
 
113
-    //this call removes the extension from the txn and does
102
+    // this call removes the extension from the txn and does
114 103
     // call free() or tells the MM to do so when the txn is finally done
115 104
     // recommended use: when not sure there is no MM
116
-    template <typename T> void release_extension(T* ext)
117
-    {
118
-        release_extension<T>();
119
-    }
105
+    template <typename T> void release_extension(T *ext) { release_extension<T>(); }
120 106
 
121
-    //this call removes the extension from the txn and does
107
+    // this call removes the extension from the txn and does
122 108
     // call free() or tells the MM to do so when the txn is finally done
123 109
     // recommended use: when not sure there is no MM
124
-    template <typename T> void release_extension()
125
-    {
126
-        release_extension(T::ID);
127
-    }
110
+    template <typename T> void release_extension() { release_extension(T::ID); }
128 111
 
129 112
 private:
130 113
     // Non-templatized version with manual index
@@ -140,24 +123,20 @@ public:
140 123
     // allocated after C++ static construction time.
141 124
     void resize_extensions();
142 125
 
143
-
144 126
 private:
145
-    tlm_array<tlm_extension_base*> m_extensions;
146
-    tlm_base_mm_interface*         m_mm;
147
-    unsigned int                   m_ref_count;
148
-
149
-
127
+    tlm_array<tlm_extension_base *> m_extensions;
128
+    tlm_base_mm_interface *m_mm;
129
+    unsigned int m_ref_count;
150 130
 };
151 131
 
152
-template<typename SIG=bool>
153
-struct tlm_signal_gp: public tlm_generic_payload_base {
132
+template <typename SIG = bool> struct tlm_signal_gp : public tlm_generic_payload_base {
154 133
 
155 134
     tlm_signal_gp();
156 135
 
157
-    explicit tlm_signal_gp(tlm_base_mm_interface* mm);
136
+    explicit tlm_signal_gp(tlm_base_mm_interface *mm);
158 137
 
159
-    tlm_signal_gp(const tlm_signal_gp<SIG>& x) = delete ;
160
-    tlm_signal_gp<SIG>& operator= (const tlm_signal_gp<SIG>& x) = delete;
138
+    tlm_signal_gp(const tlm_signal_gp<SIG> &x) = delete;
139
+    tlm_signal_gp<SIG> &operator=(const tlm_signal_gp<SIG> &x) = delete;
161 140
 
162 141
     //--------------
163 142
     // Destructor
@@ -165,44 +144,44 @@ struct tlm_signal_gp: public tlm_generic_payload_base {
165 144
     virtual ~tlm_signal_gp(){};
166 145
     // non-virtual deep-copying of the object
167 146
 
168
-    void deep_copy_from(const tlm_signal_gp & other);
147
+    void deep_copy_from(const tlm_signal_gp &other);
169 148
 
170
-    tlm_command          get_command() const {return m_command;}
171
-    void                 set_command(const tlm_command command) {m_command = command;}
149
+    tlm_command get_command() const { return m_command; }
150
+    void set_command(const tlm_command command) { m_command = command; }
172 151
 
173
-    SIG                  get_value() const {return m_value;}
174
-    void                 set_value(const SIG value) {m_value = value;}
152
+    SIG get_value() const { return m_value; }
153
+    void set_value(const SIG value) { m_value = value; }
175 154
 
176 155
     // Response status related methods
177
-    bool                 is_response_ok() const {return (m_response_status > 0);}
178
-    bool                 is_response_error() const {return (m_response_status <= 0);}
179
-    tlm_response_status  get_response_status() const {return m_response_status;}
180
-    void                 set_response_status(const tlm_response_status response_status){m_response_status = response_status;}
181
-    std::string          get_response_string() const;
156
+    bool is_response_ok() const { return (m_response_status > 0); }
157
+    bool is_response_error() const { return (m_response_status <= 0); }
158
+    tlm_response_status get_response_status() const { return m_response_status; }
159
+    void set_response_status(const tlm_response_status response_status) { m_response_status = response_status; }
160
+    std::string get_response_string() const;
182 161
 
183 162
     struct gp_mm : public tlm::tlm_base_mm_interface {
184
-        tlm::tlm_signal_gp<SIG>* create(){
185
-            if(pool.size()){
163
+        tlm::tlm_signal_gp<SIG> *create() {
164
+            if (pool.size()) {
186 165
                 auto ret = pool.front();
187 166
                 pool.pop_front();
188 167
                 return ret;
189 168
             } else
190 169
                 return new tlm::tlm_signal_gp<SIG>(this);
191 170
         }
192
-        void free(tlm_generic_payload_base* gp) override {
193
-            auto t = dynamic_cast<tlm::tlm_signal_gp<SIG>*>(gp);
171
+        void free(tlm_generic_payload_base *gp) override {
172
+            auto t = dynamic_cast<tlm::tlm_signal_gp<SIG> *>(gp);
194 173
             t->free_all_extensions();
195 174
             pool.push_back(t);
196 175
         }
197
-        ~gp_mm(){
198
-            for(auto n: pool) delete n;
176
+        ~gp_mm() {
177
+            for (auto n : pool) delete n;
199 178
         }
200
-    private:
201
-        std::deque<tlm::tlm_signal_gp<SIG>*> pool;
202 179
 
180
+    private:
181
+        std::deque<tlm::tlm_signal_gp<SIG> *> pool;
203 182
     };
204