Browse Source

Fixed license header and formatting

Eyck Jentzsch 2 years ago
parent
commit
35379b77b6

+ 58
- 71
incl/json/json-forwards.h View File

@@ -7,28 +7,28 @@
7 7
 // //////////////////////////////////////////////////////////////////////
8 8
 
9 9
 /*
10
-The JsonCpp library's source code, including accompanying documentation, 
10
+The JsonCpp library's source code, including accompanying documentation,
11 11
 tests and demonstration applications, are licensed under the following
12 12
 conditions...
13 13
 
14
-Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim copyright in all 
15
-jurisdictions which recognize such a disclaimer. In such jurisdictions, 
14
+Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim copyright in all
15
+jurisdictions which recognize such a disclaimer. In such jurisdictions,
16 16
 this software is released into the Public Domain.
17 17
 
18 18
 In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
19 19
 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur and
20 20
 The JsonCpp Authors, and is released under the terms of the MIT License (see below).
21 21
 
22
-In jurisdictions which recognize Public Domain property, the user of this 
23
-software may choose to accept it either as 1) Public Domain, 2) under the 
24
-conditions of the MIT License (see below), or 3) under the terms of dual 
22
+In jurisdictions which recognize Public Domain property, the user of this
23
+software may choose to accept it either as 1) Public Domain, 2) under the
24
+conditions of the MIT License (see below), or 3) under the terms of dual
25 25
 Public Domain/MIT License conditions described here, as they choose.
26 26
 
27 27
 The MIT License is about as close to Public Domain as a license can get, and is
28 28
 described in clear, concise terms at:
29 29
 
30 30
    http://en.wikipedia.org/wiki/MIT_License
31
-   
31
+
32 32
 The full text of the MIT License follows:
33 33
 
34 34
 ========================================================================
@@ -69,12 +69,8 @@ license you like.
69 69
 // End of content of file: LICENSE
70 70
 // //////////////////////////////////////////////////////////////////////
71 71
 
72
-
73
-
74
-
75
-
76 72
 #ifndef JSON_FORWARD_AMALGATED_H_INCLUDED
77
-# define JSON_FORWARD_AMALGATED_H_INCLUDED
73
+#define JSON_FORWARD_AMALGATED_H_INCLUDED
78 74
 /// If defined, indicates that the source file is amalgated
79 75
 /// to prevent private header inclusion.
80 76
 #define JSON_IS_AMALGAMATION
@@ -91,8 +87,8 @@ license you like.
91 87
 #ifndef JSON_CONFIG_H_INCLUDED
92 88
 #define JSON_CONFIG_H_INCLUDED
93 89
 #include <stddef.h>
94
-#include <string> //typedef String
95 90
 #include <stdint.h> //typedef int64_t, uint64_t
91
+#include <string>   //typedef String
96 92
 
97 93
 /// If defined, indicates that json library is embedded in CppTL library.
98 94
 //# define JSON_IN_CPPTL 1
@@ -145,21 +141,21 @@ license you like.
145 141
 // #define JSON_NO_INT64 1
146 142
 
147 143
 #if defined(_MSC_VER) // MSVC
148
-#  if _MSC_VER <= 1200 // MSVC 6
149
-    // Microsoft Visual Studio 6 only support conversion from __int64 to double
150
-    // (no conversion from unsigned __int64).
151
-#    define JSON_USE_INT64_DOUBLE_CONVERSION 1
152
-    // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
153
-    // characters in the debug information)
154
-    // All projects I've ever seen with VS6 were using this globally (not bothering
155
-    // with pragma push/pop).
156
-#    pragma warning(disable : 4786)
157
-#  endif // MSVC 6
158
-
159
-#  if _MSC_VER >= 1500 // MSVC 2008
160
-    /// Indicates that the following function is deprecated.
161
-#    define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
162
-#  endif
144
+#if _MSC_VER <= 1200  // MSVC 6
145
+// Microsoft Visual Studio 6 only support conversion from __int64 to double
146
+// (no conversion from unsigned __int64).
147
+#define JSON_USE_INT64_DOUBLE_CONVERSION 1
148
+// Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
149
+// characters in the debug information)
150
+// All projects I've ever seen with VS6 were using this globally (not bothering
151
+// with pragma push/pop).
152
+#pragma warning(disable : 4786)
153
+#endif // MSVC 6
154
+
155
+#if _MSC_VER >= 1500 // MSVC 2008
156
+/// Indicates that the following function is deprecated.
157
+#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
158
+#endif
163 159
 
164 160
 #endif // defined(_MSC_VER)
165 161
 
@@ -167,17 +163,17 @@ license you like.
167 163
 // is intended to override the base-class version.  This makes the code more
168 164
 // managable and fixes a set of common hard-to-find bugs.
169 165
 #if __cplusplus >= 201103L
170
-# define JSONCPP_OVERRIDE override
171
-# define JSONCPP_NOEXCEPT noexcept
166
+#define JSONCPP_OVERRIDE override
167
+#define JSONCPP_NOEXCEPT noexcept
172 168
 #elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900
173
-# define JSONCPP_OVERRIDE override
174
-# define JSONCPP_NOEXCEPT throw()
169
+#define JSONCPP_OVERRIDE override
170
+#define JSONCPP_NOEXCEPT throw()
175 171
 #elif defined(_MSC_VER) && _MSC_VER >= 1900
176
-# define JSONCPP_OVERRIDE override
177
-# define JSONCPP_NOEXCEPT noexcept
172
+#define JSONCPP_OVERRIDE override
173
+#define JSONCPP_NOEXCEPT noexcept
178 174
 #else
179
-# define JSONCPP_OVERRIDE
180
-# define JSONCPP_NOEXCEPT throw()
175
+#define JSONCPP_OVERRIDE
176
+#define JSONCPP_NOEXCEPT throw()
181 177
 #endif
182 178
 
183 179
 #ifndef JSON_HAS_RVALUE_REFERENCES
@@ -189,12 +185,12 @@ license you like.
189 185
 #ifdef __clang__
190 186
 #if __has_feature(cxx_rvalue_references)
191 187
 #define JSON_HAS_RVALUE_REFERENCES 1
192
-#endif  // has_feature
188
+#endif // has_feature
193 189
 
194 190
 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
195 191
 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
196 192
 #define JSON_HAS_RVALUE_REFERENCES 1
197
-#endif  // GXX_EXPERIMENTAL
193
+#endif // GXX_EXPERIMENTAL
198 194
 
199 195
 #endif // __clang__ || __GNUC__
200 196
 
@@ -205,15 +201,15 @@ license you like.
205 201
 #endif
206 202
 
207 203
 #ifdef __clang__
208
-#  if __has_extension(attribute_deprecated_with_message)
209
-#    define JSONCPP_DEPRECATED(message)  __attribute__ ((deprecated(message)))
210
-#  endif
204
+#if __has_extension(attribute_deprecated_with_message)
205
+#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
206
+#endif
211 207
 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
212
-#  if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
213
-#    define JSONCPP_DEPRECATED(message)  __attribute__ ((deprecated(message)))
214
-#  elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
215
-#    define JSONCPP_DEPRECATED(message)  __attribute__((__deprecated__))
216
-#  endif  // GNUC version
208
+#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
209
+#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
210
+#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
211
+#define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
212
+#endif // GNUC version
217 213
 #endif // __clang__ || __GNUC__
218 214
 
219 215
 #if !defined(JSONCPP_DEPRECATED)
@@ -221,16 +217,16 @@ license you like.
221 217
 #endif // if !defined(JSONCPP_DEPRECATED)
222 218
 
223 219
 #if __GNUC__ >= 6
224
-#  define JSON_USE_INT64_DOUBLE_CONVERSION 1
220
+#define JSON_USE_INT64_DOUBLE_CONVERSION 1
225 221
 #endif
226 222
 
227 223
 #if !defined(JSON_IS_AMALGAMATION)
228 224
 
229
-# include "version.h"
225
+#include "version.h"
230 226
 
231
-# if JSONCPP_USING_SECURE_MEMORY
232
-#  include "allocator.h" //typedef Allocator
233
-# endif
227
+#if JSONCPP_USING_SECURE_MEMORY
228
+#include "allocator.h" //typedef Allocator
229
+#endif
234 230
 
235 231
 #endif // if !defined(JSON_IS_AMALGAMATION)
236 232
 
@@ -241,12 +237,12 @@ typedef unsigned int UInt;
241 237
 typedef int LargestInt;
242 238
 typedef unsigned int LargestUInt;
243 239
 #undef JSON_HAS_INT64
244
-#else                 // if defined(JSON_NO_INT64)
240
+#else // if defined(JSON_NO_INT64)
245 241
 // For Microsoft Visual use specific types as long long is not supported
246 242
 #if defined(_MSC_VER) // Microsoft Visual Studio
247 243
 typedef __int64 Int64;
248 244
 typedef unsigned __int64 UInt64;
249
-#else                 // if defined(_MSC_VER) // Other platforms, use long long
245
+#else  // if defined(_MSC_VER) // Other platforms, use long long
250 246
 typedef int64_t Int64;
251 247
 typedef uint64_t UInt64;
252 248
 #endif // if defined(_MSC_VER)
@@ -255,17 +251,17 @@ typedef UInt64 LargestUInt;
255 251
 #define JSON_HAS_INT64
256 252
 #endif // if defined(JSON_NO_INT64)
257 253
 #if JSONCPP_USING_SECURE_MEMORY
258
-#define JSONCPP_STRING        std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
259
-#define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
260
-#define JSONCPP_OSTREAM       std::basic_ostream<char, std::char_traits<char>>
261
-#define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
262
-#define JSONCPP_ISTREAM       std::istream
254
+#define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char>>
255
+#define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char>>
256
+#define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>>
257
+#define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char>>
258
+#define JSONCPP_ISTREAM std::istream
263 259
 #else
264
-#define JSONCPP_STRING        std::string
260
+#define JSONCPP_STRING std::string
265 261
 #define JSONCPP_OSTRINGSTREAM std::ostringstream
266
-#define JSONCPP_OSTREAM       std::ostream
262
+#define JSONCPP_OSTREAM std::ostream
267 263
 #define JSONCPP_ISTRINGSTREAM std::istringstream
268
-#define JSONCPP_ISTREAM       std::istream
264
+#define JSONCPP_ISTREAM std::istream
269 265
 #endif // if JSONCPP_USING_SECURE_MEMORY
270 266
 } // end namespace Json
271 267
 
@@ -275,11 +271,6 @@ typedef UInt64 LargestUInt;
275 271
 // End of content of file: include/json/config.h
276 272
 // //////////////////////////////////////////////////////////////////////
277 273
 
278
-
279
-
280
-
281
-
282
-
283 274
 // //////////////////////////////////////////////////////////////////////
284 275
 // Beginning of content of file: include/json/forwards.h
285 276
 // //////////////////////////////////////////////////////////////////////
@@ -326,8 +317,4 @@ class ValueConstIterator;
326 317
 // End of content of file: include/json/forwards.h
327 318
 // //////////////////////////////////////////////////////////////////////
328 319
 
329
-
330
-
331
-
332
-
333
-#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED
320
+#endif // ifndef JSON_FORWARD_AMALGATED_H_INCLUDED

+ 1155
- 1224
incl/json/json.h
File diff suppressed because it is too large
View File


+ 50
- 34
incl/sysc/configurer.h View File

@@ -1,3 +1,18 @@
1
+/*******************************************************************************
2
+ * Copyright 2017 MINRES Technologies GmbH
3
+ *
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
+ *******************************************************************************/
1 16
 /*
2 17
  * configurer.h
3 18
  *
@@ -8,69 +23,70 @@
8 23
 #ifndef _SYSC_CONFIGURER_H_
9 24
 #define _SYSC_CONFIGURER_H_
10 25
 
11
-#include "utilities.h"
12 26
 #include "report.h"
27
+#include "utilities.h"
13 28
 #include <json/json.h>
14 29
 
15 30
 namespace sysc {
16 31
 
17
-class configurer: public sc_core::sc_module {
32
+class configurer : public sc_core::sc_module {
18 33
 public:
19 34
     using base_type = sc_core::sc_module;
20
-    configurer(const std::string& filename);
35
+    configurer(const std::string &filename);
21 36
 
22
-    void configure(){
23
-        for(auto* o: sc_core::sc_get_top_level_objects(sc_core::sc_curr_simcontext)){
24
-            Json::Value& val = root[o->name()];
25
-            if(!val.isNull()) configure_sc_object(o, val);
37
+    void configure() {
38
+        for (auto *o : sc_core::sc_get_top_level_objects(sc_core::sc_curr_simcontext)) {
39
+            Json::Value &val = root[o->name()];
40
+            if (!val.isNull()) configure_sc_object(o, val);
26 41
         }
27 42
     }
28
-    void dump_hierarchy(sc_core::sc_object* obj=nullptr, std::ostream& os =std::cout){
29
-        if(obj){
30
-            os<<obj->name()<<" of type "<<typeid(*obj).name()<<"\n";
31
-            for(auto* o:obj->get_child_objects())
32
-                dump_hierarchy(o, os);
43
+    void dump_hierarchy(sc_core::sc_object *obj = nullptr, std::ostream &os = std::cout) {
44
+        if (obj) {
45
+            os << obj->name() << " of type " << typeid(*obj).name() << "\n";
46
+            for (auto *o : obj->get_child_objects()) dump_hierarchy(o, os);
33 47
         } else {
34
-            for(auto* o:sc_core::sc_get_top_level_objects(sc_core::sc_curr_simcontext))
35
-                dump_hierarchy(o, os);
48
+            for (auto *o : sc_core::sc_get_top_level_objects(sc_core::sc_curr_simcontext)) dump_hierarchy(o, os);
36 49
         }
37 50
     }
38
-    template<typename T>
39
-    void set_value(const std::string& hier_name, T value){
51
+    template <typename T> void set_value(const std::string &hier_name, T value) {
40 52
         size_t pos = hier_name.find_last_of('.');
41
-        sc_core::sc_module* mod = dynamic_cast<sc_core::sc_module*>(sc_core::sc_find_object(hier_name.substr(0, pos).c_str()));
42
-        if(mod!=nullptr){
43
-            sc_core::sc_attribute<T>* attr = dynamic_cast<sc_core::sc_attribute<T>*>(mod->get_attribute(hier_name.substr(pos+1)));
44
-            if(attr!=nullptr) attr->value=value;
45
-            else LOG(ERROR)<<"Could not set attribute value "<<hier_name;
53
+        sc_core::sc_module *mod =
54
+            dynamic_cast<sc_core::sc_module *>(sc_core::sc_find_object(hier_name.substr(0, pos).c_str()));
55
+        if (mod != nullptr) {
56
+            sc_core::sc_attribute<T> *attr =
57
+                dynamic_cast<sc_core::sc_attribute<T> *>(mod->get_attribute(hier_name.substr(pos + 1)));
58
+            if (attr != nullptr)
59
+                attr->value = value;
60
+            else
61
+                LOG(ERROR) << "Could not set attribute value " << hier_name;
46 62
         }
47 63
     }
48 64
 
49
-    void set_configuration_value(sc_core::sc_attr_base* attr_base, sc_core::sc_module* owner) {
65
+    void set_configuration_value(sc_core::sc_attr_base *attr_base, sc_core::sc_module *owner) {
50 66
         std::string name(owner->name());
51
-        name+=".";
52
-        name+=attr_base->name();
53
-        Json::Value& val = get_value_from_hierarchy(name);
54
-        if(!val.isNull()) set_value(attr_base, val);
67
+        name += ".";
68
+        name += attr_base->name();
69
+        Json::Value &val = get_value_from_hierarchy(name);
70
+        if (!val.isNull()) set_value(attr_base, val);
55 71
     }
56 72
 
57
-    static configurer& instance(){
58
-        configurer* inst = dynamic_cast<configurer*>(sc_core::sc_find_object( "configurer"));
59
-        assert("No configurer instantiated when using it" && inst!=nullptr);
73
+    static configurer &instance() {
74
+        configurer *inst = dynamic_cast<configurer *>(sc_core::sc_find_object("configurer"));
75
+        assert("No configurer instantiated when using it" && inst != nullptr);
60 76
         return *inst;
61 77
     }
78
+
62 79
 protected:
63
-    void configure_sc_object(sc_core::sc_object* obj, Json::Value& hier_val);
80
+    void configure_sc_object(sc_core::sc_object *obj, Json::Value &hier_val);
64 81
 
65
-    void set_value(sc_core::sc_attr_base* attr_base, Json::Value& hier_val);
82
+    void set_value(sc_core::sc_attr_base *attr_base, Json::Value &hier_val);
66 83
 
67
-    Json::Value& get_value_from_hierarchy(const std::string& hier_name);
84
+    Json::Value &get_value_from_hierarchy(const std::string &hier_name);
68 85
 
69
-    Json::Value& get_value_from_hierarchy(const std::string& hier_name, Json::Value& val);
86
+    Json::Value &get_value_from_hierarchy(const std::string &hier_name, Json::Value &val);
70 87
 
71 88
     Json::Value root;
72 89
 };
73 90
 }
74 91
 
75
-
76 92
 #endif /* _SYSC_CONFIGURER_H_ */

+ 24
- 10
incl/sysc/ext_attribute.h View File

@@ -1,3 +1,18 @@
1
+/*******************************************************************************
2
+ * Copyright 2017 MINRES Technologies GmbH
3
+ *
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
+ *******************************************************************************/
1 16
 /*
2 17
  * atrribute_mixin.h
3 18
  *
@@ -12,30 +27,29 @@
12 27
 #include "utilities.h"
13 28
 
14 29
 namespace sysc {
15
-template <typename T>
16
-class ext_attribute: public sc_core::sc_attribute<T> {
30
+template <typename T> class ext_attribute : public sc_core::sc_attribute<T> {
17 31
 public:
18 32
     using base_type = sc_core::sc_attribute<T>;
19 33
 
20
-    ext_attribute( const std::string& name_, sc_core::sc_module* owner)
21
-    : base_type(name_), owner(owner)
22
-    {
34
+    ext_attribute(const std::string &name_, sc_core::sc_module *owner)
35
+    : base_type(name_)
36
+    , owner(owner) {
23 37
         owner->add_attribute(*this);
24 38
         configurer::instance().set_configuration_value(this, owner);
25 39
     }
26 40
 
27
-    ext_attribute( const std::string& name_, const T& value_, sc_core::sc_module* owner)
28
-    : base_type(name_, value_), owner(owner)
29
-    {
41
+    ext_attribute(const std::string &name_, const T &value_, sc_core::sc_module *owner)
42
+    : base_type(name_, value_)
43
+    , owner(owner) {
30 44
         owner->add_attribute(*this);
31 45
         configurer::instance().set_configuration_value(this, owner);
32 46
     }
33 47
 
34
-    ext_attribute( const ext_attribute<T>& a ) = delete;
48
+    ext_attribute(const ext_attribute<T> &a) = delete;
35 49
 
36 50
     ~ext_attribute() = default;
37 51
 
38
-    const sc_core::sc_module* owner;
52
+    const sc_core::sc_module *owner;
39 53
 };
40 54
 };
41 55
 

+ 12
- 14
incl/sysc/memory.h View File

@@ -26,11 +26,11 @@
26 26
 // Needed for the simple_target_socket
27 27
 #define SC_INCLUDE_DYNAMIC_PROCESSES
28 28
 
29
-#include "utilities.h"
30
-#include "target_mixin.h"
31 29
 #include "report.h"
32
-#include <util/sparse_array.h>
30
+#include "target_mixin.h"
31
+#include "utilities.h"
33 32
 #include <tlm.h>
33
+#include <util/sparse_array.h>
34 34
 
35 35
 namespace sysc {
36 36
 
@@ -39,7 +39,6 @@ namespace sysc {
39 39
 template <unsigned long long SIZE, unsigned BUSWIDTH = 32, bool LOG_ACCESS = false>
40 40
 class memory : public sc_core::sc_module {
41 41
 public:
42
-
43 42
     sysc::target_mixin<tlm::tlm_target_socket<BUSWIDTH>> target;
44 43
 
45 44
     memory(const sc_core::sc_module_name &nm);
@@ -60,9 +59,8 @@ memory<SIZE, BUSWIDTH, LOG_ACCESS>::memory(const sc_core::sc_module_name &nm)
60 59
     target.register_b_transport([=](tlm::tlm_generic_payload &gp, sc_core::sc_time &delay) -> void {
61 60
         auto count = this->handle_operation(gp);
62 61
     });
63
-    target.register_transport_dbg([this](tlm::tlm_generic_payload &gp) -> unsigned {
64
-        return this->handle_operation(gp);
65
-    });
62
+    target.register_transport_dbg(
63
+        [this](tlm::tlm_generic_payload &gp) -> unsigned { return this->handle_operation(gp); });
66 64
     target.register_get_direct_mem_ptr([this](tlm::tlm_generic_payload &gp, tlm::tlm_dmi &dmi_data) -> bool {
67 65
         return this->handle_dmi(gp, dmi_data);
68 66
     });
@@ -98,8 +96,8 @@ int memory<SIZE, BUSWIDTH, LOG_ACCESS>::handle_operation(tlm::tlm_generic_payloa
98 96
             LOG(WARNING) << (cmd == tlm::TLM_READ_COMMAND ? "read" : "write") << " access to addr 0x" << std::hex << adr
99 97
                          << std::dec;
100 98
     }
101
-    if (cmd == tlm::TLM_READ_COMMAND){
102
-        if(mem.is_allocated(adr)){
99
+    if (cmd == tlm::TLM_READ_COMMAND) {
100
+        if (mem.is_allocated(adr)) {
103 101
             const auto &p = mem(adr / mem.page_size);
104 102
             auto offs = adr & mem.page_addr_mask;
105 103
             std::copy(p.data() + offs, p.data() + offs + len, ptr);
@@ -107,7 +105,7 @@ int memory<SIZE, BUSWIDTH, LOG_ACCESS>::handle_operation(tlm::tlm_generic_payloa
107 105
             // no allocated page so return randomized data
108 106
             for (size_t i = 0; i < len; i++) ptr[i] = rand() % 256;
109 107
         }
110
-    }else if (cmd == tlm::TLM_WRITE_COMMAND){
108
+    } else if (cmd == tlm::TLM_WRITE_COMMAND) {
111 109
         auto &p = mem(adr / mem.page_size);
112 110
         auto offs = adr & mem.page_addr_mask;
113 111
         std::copy(ptr, ptr + len, p.data() + offs);
@@ -117,12 +115,12 @@ int memory<SIZE, BUSWIDTH, LOG_ACCESS>::handle_operation(tlm::tlm_generic_payloa
117 115
     return len;
118 116
 }
119 117
 
120
-template<unsigned long long SIZE, unsigned BUSWIDTH, bool LOG_ACCESS>
121
-inline bool memory<SIZE, BUSWIDTH, LOG_ACCESS>::handle_dmi(tlm::tlm_generic_payload& gp, tlm::tlm_dmi& dmi_data) {
118
+template <unsigned long long SIZE, unsigned BUSWIDTH, bool LOG_ACCESS>
119
+inline bool memory<SIZE, BUSWIDTH, LOG_ACCESS>::handle_dmi(tlm::tlm_generic_payload &gp, tlm::tlm_dmi &dmi_data) {
122 120
     auto &p = mem(gp.get_address() / mem.page_size);
123 121
     dmi_data.set_start_address(gp.get_address() & ~mem.page_addr_mask);
124
-    //TODO: fix to provide the correct end address
125
-    dmi_data.set_end_address(dmi_data.get_start_address()+mem.page_size-1);
122
+    // TODO: fix to provide the correct end address
123
+    dmi_data.set_end_address(dmi_data.get_start_address() + mem.page_size - 1);
126 124
     dmi_data.set_dmi_ptr(p.data());
127 125
     dmi_data.set_granted_access(tlm::tlm_dmi::DMI_ACCESS_READ_WRITE);
128 126
     return true;

+ 9
- 10
incl/sysc/register.h View File

@@ -98,12 +98,11 @@ struct sc_register : public sc_core::sc_object, public resource_access_if, publi
98 98
      * @return
99 99
      */
100 100
     bool write(const uint8_t *data, size_t length, uint64_t offset) override {
101
-        assert("Access out of range" && offset+length <= sizeof(DATATYPE));
101
+        assert("Access out of range" && offset + length <= sizeof(DATATYPE));
102 102
         auto temp(storage);
103
-        auto beg = reinterpret_cast<uint8_t*>(&temp)+offset;
104
-        std::copy(data, data+length, beg);
105
-        if (wr_cb)
106
-            return wr_cb(*this, temp);
103
+        auto beg = reinterpret_cast<uint8_t *>(&temp) + offset;
104
+        std::copy(data, data + length, beg);
105
+        if (wr_cb) return wr_cb(*this, temp);
107 106
         storage = (temp & wrmask) | (storage & ~wrmask);
108 107
         return true;
109 108
     }
@@ -115,14 +114,14 @@ struct sc_register : public sc_core::sc_object, public resource_access_if, publi
115 114
      * @return
116 115
      */
117 116
     bool read(uint8_t *data, size_t length, uint64_t offset) const override {
118
-        assert("Access out of range" && offset+length <= sizeof(DATATYPE));
117
+        assert("Access out of range" && offset + length <= sizeof(DATATYPE));
119 118
         auto temp(storage);
120 119
         if (rd_cb) {
121
-            if(!rd_cb(*this, temp)) return false;
120
+            if (!rd_cb(*this, temp)) return false;
122 121
         } else
123
-            temp&= rdmask;
124
-        auto beg = reinterpret_cast<uint8_t*>(&temp)+offset;
125
-        std::copy(beg, beg+length, data);
122
+            temp &= rdmask;
123
+        auto beg = reinterpret_cast<uint8_t *>(&temp) + offset;
124
+        std::copy(beg, beg + length, data);
126 125
         return true;
127 126
     }
128 127
     /**

+ 9
- 9
incl/sysc/report.h View File

@@ -62,9 +62,9 @@ public:
62 62
         if (this->print_time()) this->os << "- " << log::now_time();
63 63
         if (this->print_severity()) {
64 64
             this->os << " " << std::setw(7) << std::left << this->to_string(level);
65
-            //if (strlen(category))
65
+            // if (strlen(category))
66 66
             //    this->os << "[" << std::setw(10) << category<<"]";
67
-            //else
67
+            // else
68 68
             //    this->os << "            ";
69 69
             this->os << std::right;
70 70
         }
@@ -75,8 +75,7 @@ public:
75 75
     };
76 76
 };
77 77
 
78
-template<typename CATEGORY = log::SystemC>
79
-class FILELOG_DECLSPEC Logger : public Log<log::Output2FILE<CATEGORY>> {
78
+template <typename CATEGORY = log::SystemC> class FILELOG_DECLSPEC Logger : public Log<log::Output2FILE<CATEGORY>> {
80 79
 public:
81 80
     /**
82 81
      *
@@ -95,14 +94,15 @@ public:
95 94
 #undef LOG
96 95
 #endif
97 96
 #define LOG(LEVEL)                                                                                                     \
98
-    if (logging::LEVEL <= logging::Log<logging::Output2FILE<logging::SystemC>>::reporting_level() && LOG_OUTPUT(SystemC)::stream())  \
99
-        sysc::Log<logging::Output2FILE<logging::SystemC>>().get(logging::LEVEL, "SystemC")
97
+    if (logging::LEVEL <= logging::Log<logging::Output2FILE<logging::SystemC>>::reporting_level() &&                   \
98
+        LOG_OUTPUT(SystemC)::stream())                                                                                 \
99
+    sysc::Log<logging::Output2FILE<logging::SystemC>>().get(logging::LEVEL, "SystemC")
100 100
 
101 101
 #ifdef CLOG
102 102
 #undef CLOG
103 103
 #endif
104
-#define CLOG(LEVEL, CATEGORY)                                                                    \
105
-    if (logging::LEVEL <= LOGGER(CATEGORY)::reporting_level() && LOG_OUTPUT(CATEGORY)::stream()) \
106
-        sysc::Log<logging::Output2FILE<logging::CATEGORY>>().get(logging::LEVEL, #CATEGORY)
104
+#define CLOG(LEVEL, CATEGORY)                                                                                          \
105
+    if (logging::LEVEL <= LOGGER(CATEGORY)::reporting_level() && LOG_OUTPUT(CATEGORY)::stream())                       \
106
+    sysc::Log<logging::Output2FILE<logging::CATEGORY>>().get(logging::LEVEL, #CATEGORY)
107 107
 
108 108
 #endif /* _SYSC_REPORT_H_ */

+ 1
- 3
incl/sysc/resetable.h View File

@@ -47,9 +47,7 @@ struct resetable {
47 47
         for (auto res : resources) res->reset();
48 48
         _in_reset = false;
49 49
     }
50
-    bool in_reset(){
51
-        return _in_reset;
52
-    }
50
+    bool in_reset() { return _in_reset; }
53 51
     /**
54 52
      *
55 53
      * @param res

+ 3
- 3
incl/sysc/utilities.h View File

@@ -151,8 +151,8 @@ inline sc_core::sc_time operator"" _fs(long double val) { return sc_core::sc_tim
151 151
  */
152 152
 inline sc_core::sc_time operator"" _fs(unsigned long long val) { return sc_core::sc_time(double(val), sc_core::SC_FS); }
153 153
 
154
-inline constexpr uint64_t operator"" _kB(unsigned long long val) { return val * 1<<10; }
155
-inline constexpr uint64_t operator"" _MB(unsigned long long val) { return val * 1<<20; }
156
-inline constexpr uint64_t operator"" _GB(unsigned long long val) { return val * 1<<30; }
154
+inline constexpr uint64_t operator"" _kB(unsigned long long val) { return val * 1 << 10; }
155
+inline constexpr uint64_t operator"" _MB(unsigned long long val) { return val * 1 << 20; }
156
+inline constexpr uint64_t operator"" _GB(unsigned long long val) { return val * 1 << 30; }
157 157
 
158 158
 #endif /* _SYSC_UTILITIES_H_ */

+ 11
- 29
incl/util/assert.h View File

@@ -1,36 +1,18 @@
1 1
 /*******************************************************************************
2
- * Copyright (C) 2017, MINRES Technologies GmbH
3
- * All rights reserved.
2
+ * Copyright 2017 MINRES Technologies GmbH
4 3
  *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
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 7
  *
8
- * 1. Redistributions of source code must retain the above copyright notice,
9
- *    this list of conditions and the following disclaimer.
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
10 9
  *
11
- * 2. Redistributions in binary form must reproduce the above copyright notice,
12
- *    this list of conditions and the following disclaimer in the documentation
13
- *    and/or other materials provided with the distribution.
14
- *
15
- * 3. Neither the name of the copyright holder nor the names of its contributors
16
- *    may be used to endorse or promote products derived from this software
17
- *    without specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
- * POSSIBILITY OF SUCH DAMAGE.
30
- *
31
- * Contributors:
32
- *       eyck@minres.com - initial API and implementation
33
- ******************************************************************************/
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
+ *******************************************************************************/
34 16
 
35 17
 #ifndef _ASSERT_H_
36 18
 #define _ASSERT_H_

+ 11
- 29
incl/util/ities.h View File

@@ -1,36 +1,18 @@
1 1
 /*******************************************************************************
2
- * Copyright (C) 2017, MINRES Technologies GmbH
3
- * All rights reserved.
2
+ * Copyright 2017 MINRES Technologies GmbH
4 3
  *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
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 7
  *
8
- * 1. Redistributions of source code must retain the above copyright notice,
9
- *    this list of conditions and the following disclaimer.
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
10 9
  *
11
- * 2. Redistributions in binary form must reproduce the above copyright notice,
12
- *    this list of conditions and the following disclaimer in the documentation
13
- *    and/or other materials provided with the distribution.
14
- *
15
- * 3. Neither the name of the copyright holder nor the names of its contributors
16
- *    may be used to endorse or promote products derived from this software
17
- *    without specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
- * POSSIBILITY OF SUCH DAMAGE.
30
- *
31
- * Contributors:
32
- *       eyck@minres.com - initial API and implementation
33
- ******************************************************************************/
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
+ *******************************************************************************/
34 16
 
35 17
 #ifndef _UTIL_ITIES_H_
36 18
 #define _UTIL_ITIES_H_

+ 18
- 36
incl/util/logging.h View File

@@ -1,36 +1,18 @@
1 1
 /*******************************************************************************
2
- * Copyright (C) 2017, MINRES Technologies GmbH
3
- * All rights reserved.
2
+ * Copyright 2017 MINRES Technologies GmbH
4 3
  *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
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 7
  *
8
- * 1. Redistributions of source code must retain the above copyright notice,
9
- *    this list of conditions and the following disclaimer.
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
10 9
  *
11
- * 2. Redistributions in binary form must reproduce the above copyright notice,
12
- *    this list of conditions and the following disclaimer in the documentation
13
- *    and/or other materials provided with the distribution.
14
- *
15
- * 3. Neither the name of the copyright holder nor the names of its contributors
16
- *    may be used to endorse or promote products derived from this software
17
- *    without specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
- * POSSIBILITY OF SUCH DAMAGE.
30
- *
31
- * Contributors:
32
- *       eyck@minres.com - initial API and implementation
33
- ******************************************************************************/
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
+ *******************************************************************************/
34 16
 
35 17
 #ifndef _UTIL_LOGGING_H_
36 18
 #define _UTIL_LOGGING_H_
@@ -81,7 +63,7 @@ public:
81 63
         if (print_time()) os << "- " << now_time();
82 64
         if (print_severity()) {
83 65
             os << " " << to_string(level);
84
-            //if (strlen(category)) os << "[" << category<<"]";
66
+            // if (strlen(category)) os << "[" << category<<"]";
85 67
             os << ": ";
86 68
         }
87 69
         get_last_log_level() = level;
@@ -159,14 +141,14 @@ class DEFAULT {};
159 141
 #define LOG_OUTPUT(CATEGORY) logging::Output2FILE<logging::CATEGORY>
160 142
 
161 143
 #ifndef LOG
162
-#define LOG(LEVEL)                                                                             \
163
-    if (logging::LEVEL <= LOGGER(DEFAULT)::reporting_level() && LOG_OUTPUT(DEFAULT)::stream()) \
164
-        LOGGER(DEFAULT)().get(logging::LEVEL)
144
+#define LOG(LEVEL)                                                                                                     \
145
+    if (logging::LEVEL <= LOGGER(DEFAULT)::reporting_level() && LOG_OUTPUT(DEFAULT)::stream())                         \
146
+    LOGGER(DEFAULT)().get(logging::LEVEL)
165 147
 #endif
166 148
 #ifndef CLOG
167
-#define CLOG(LEVEL, CATEGORY)                                                                    \
168
-    if (logging::LEVEL <= LOGGER(CATEGORY)::reporting_level() && LOG_OUTPUT(CATEGORY)::stream()) \
169
-        LOGGER(CATEGORY)().get(logging::LEVEL, #CATEGORY)
149
+#define CLOG(LEVEL, CATEGORY)                                                                                          \
150
+    if (logging::LEVEL <= LOGGER(CATEGORY)::reporting_level() && LOG_OUTPUT(CATEGORY)::stream())                       \
151
+    LOGGER(CATEGORY)().get(logging::LEVEL, #CATEGORY)
170 152
 #endif
171 153
 #if defined(WIN32)
172 154
 

+ 11
- 29
incl/util/range_lut.h View File

@@ -1,36 +1,18 @@
1 1
 /*******************************************************************************
2
- * Copyright (C) 2017, MINRES Technologies GmbH
3
- * All rights reserved.
2
+ * Copyright 2017 MINRES Technologies GmbH
4 3
  *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
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 7
  *
8
- * 1. Redistributions of source code must retain the above copyright notice,
9
- *    this list of conditions and the following disclaimer.
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
10 9
  *
11
- * 2. Redistributions in binary form must reproduce the above copyright notice,
12
- *    this list of conditions and the following disclaimer in the documentation
13
- *    and/or other materials provided with the distribution.
14
- *
15
- * 3. Neither the name of the copyright holder nor the names of its contributors
16
- *    may be used to endorse or promote products derived from this software
17
- *    without specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
- * POSSIBILITY OF SUCH DAMAGE.
30
- *
31
- * Contributors:
32
- *       eyck@minres.com - initial API and implementation
33
- ******************************************************************************/
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
+ *******************************************************************************/
34 16
 
35 17
 #ifndef _RANGE_LUT_H_
36 18
 #define _RANGE_LUT_H_

+ 13
- 31
incl/util/sparse_array.h View File

@@ -1,36 +1,18 @@
1 1
 /*******************************************************************************
2
- * Copyright (C) 2017, MINRES Technologies GmbH
3
- * All rights reserved.
2
+ * Copyright 2017 MINRES Technologies GmbH
4 3
  *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
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 7
  *
8
- * 1. Redistributions of source code must retain the above copyright notice,
9
- *    this list of conditions and the following disclaimer.
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
10 9
  *
11
- * 2. Redistributions in binary form must reproduce the above copyright notice,
12
- *    this list of conditions and the following disclaimer in the documentation
13
- *    and/or other materials provided with the distribution.
14
- *
15
- * 3. Neither the name of the copyright holder nor the names of its contributors
16
- *    may be used to endorse or promote products derived from this software
17
- *    without specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
- * POSSIBILITY OF SUCH DAMAGE.
30
- *
31
- * Contributors:
32
- *       eyck@minres.com - initial API and implementation
33
- ******************************************************************************/
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
+ *******************************************************************************/
34 16
 
35 17
 #ifndef _SPARSE_ARRAY_H_
36 18
 #define _SPARSE_ARRAY_H_
@@ -49,7 +31,7 @@ template <typename T, uint64_t SIZE, int lower_width = 24> struct sparse_array {
49 31
 
50 32
     const uint64_t page_size = (1 << lower_width);
51 33
 
52
-    const unsigned page_count=1+SIZE/page_size;
34
+    const unsigned page_count = 1 + SIZE / page_size;
53 35
 
54 36
     const uint64_t page_addr_width = lower_width;
55 37
 
@@ -74,7 +56,7 @@ template <typename T, uint64_t SIZE, int lower_width = 24> struct sparse_array {
74 56
         return *(arr[page_nr]);
75 57
     }
76 58
 
77
-    bool is_allocated(uint32_t addr){
59
+    bool is_allocated(uint32_t addr) {
78 60
         assert(addr < SIZE);
79 61
         T nr = addr >> lower_width;
80 62
         return arr[nr] != nullptr;

+ 11
- 29
incl/util/thread_syncronizer.h View File

@@ -1,36 +1,18 @@
1 1
 /*******************************************************************************
2
- * Copyright (C) 2017, MINRES Technologies GmbH
3
- * All rights reserved.
2
+ * Copyright 2017 MINRES Technologies GmbH
4 3
  *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
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 7
  *
8
- * 1. Redistributions of source code must retain the above copyright notice,
9
- *    this list of conditions and the following disclaimer.
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
10 9
  *
11
- * 2. Redistributions in binary form must reproduce the above copyright notice,
12
- *    this list of conditions and the following disclaimer in the documentation
13
- *    and/or other materials provided with the distribution.
14
- *
15
- * 3. Neither the name of the copyright holder nor the names of its contributors
16
- *    may be used to endorse or promote products derived from this software
17
- *    without specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
- * POSSIBILITY OF SUCH DAMAGE.
30
- *
31
- * Contributors:
32
- *       eyck@minres.com - initial API and implementation
33
- ******************************************************************************/
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
+ *******************************************************************************/
34 16
 #ifndef _THREAD_SYNCRONIZER_H_
35 17
 #define _THREAD_SYNCRONIZER_H_
36 18
 

+ 53
- 35
src/configurer.cpp View File

@@ -1,3 +1,18 @@
1
+/*******************************************************************************
2
+ * Copyright 2017 MINRES Technologies GmbH
3
+ *
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
+ *******************************************************************************/
1 16
 /*
2 17
  * configurer.cpp
3 18
  *
@@ -5,48 +20,51 @@
5 20
  *      Author: eyck
6 21
  */
7 22
 
8
-
23
+#include <istream>
9 24
 #include <sysc/configurer.h>
10 25
 #include <sysc/report.h>
11
-#include <istream>
12
-
13 26
 
14
-sysc::configurer::configurer(const std::string& filename):base_type(sc_core::sc_module_name("configurer")) {
15
-    if(filename.length()>0){
27
+sysc::configurer::configurer(const std::string &filename)
28
+: base_type(sc_core::sc_module_name("configurer")) {
29
+    if (filename.length() > 0) {
16 30
         std::ifstream is(filename);
17
-        if(is.is_open()){
31
+        if (is.is_open()) {
18 32
             try {
19
-                is>>root;
20
-            }catch(Json::RuntimeError& e){
21
-                LOG(ERROR)<<"Could not parse input file "<<filename<<", reason: "<<e.what();
33
+                is >> root;
34
+            } catch (Json::RuntimeError &e) {
35
+                LOG(ERROR) << "Could not parse input file " << filename << ", reason: " << e.what();
22 36
             }
23 37
         } else {
24
-            LOG(ERROR)<<"Could not open input file "<<filename;
38
+            LOG(ERROR) << "Could not open input file " << filename;
25 39
         }
26 40
     }
27 41
 }
28 42
 
29
-void sysc::configurer::configure_sc_object(sc_core::sc_object* obj, Json::Value& hier_val) {
30
-    sc_core::sc_attr_base* ab = dynamic_cast<sc_core::sc_attr_base*>(obj);
31
-    if(ab!=nullptr){
43
+void sysc::configurer::configure_sc_object(sc_core::sc_object *obj, Json::Value &hier_val) {
44
+    sc_core::sc_attr_base *ab = dynamic_cast<sc_core::sc_attr_base *>(obj);
45
+    if (ab != nullptr) {
32 46
 
33
-    }else{
34
-        sc_core::sc_module* mod=dynamic_cast<sc_core::sc_module*>(obj);
35
-        if(mod!=nullptr){
36
-            for(auto* o: mod->get_child_objects()){
37
-                Json::Value& val = root[o->basename()];
38
-                if(!val.isNull()) configure_sc_object(o, val);
47
+    } else {
48
+        sc_core::sc_module *mod = dynamic_cast<sc_core::sc_module *>(obj);
49
+        if (mod != nullptr) {
50
+            for (auto *o : mod->get_child_objects()) {
51
+                Json::Value &val = root[o->basename()];
52
+                if (!val.isNull()) configure_sc_object(o, val);
39 53
             }
40 54
         }
41 55
     }
42 56
 }
43 57
 
44
-#define CHECK_N_ASSIGN(TYPE, ATTR, VAL) {\
45
-    auto* a = dynamic_cast<sc_core::sc_attribute<TYPE>*>(ATTR); \
46
-    if(a!=nullptr) { a->value=VAL; return; } \
47
-}
58
+#define CHECK_N_ASSIGN(TYPE, ATTR, VAL)                                                                                \
59
+    {                                                                                                                  \
60
+        auto *a = dynamic_cast<sc_core::sc_attribute<TYPE> *>(ATTR);                                                   \
61
+        if (a != nullptr) {                                                                                            \
62
+            a->value = VAL;                                                                                            \
63
+            return;                                                                                                    \
64
+        }                                                                                                              \
65
+    }
48 66
 
49
-void sysc::configurer::set_value(sc_core::sc_attr_base* attr_base, Json::Value& hier_val) {
67
+void sysc::configurer::set_value(sc_core::sc_attr_base *attr_base, Json::Value &hier_val) {
50 68
     CHECK_N_ASSIGN(int, attr_base, hier_val.asInt());
51 69
     CHECK_N_ASSIGN(unsigned, attr_base, hier_val.asUInt());
52 70
     CHECK_N_ASSIGN(int64_t, attr_base, hier_val.asInt64());
@@ -55,20 +73,20 @@ void sysc::configurer::set_value(sc_core::sc_attr_base* attr_base, Json::Value&
55 73
     CHECK_N_ASSIGN(float, attr_base, hier_val.asFloat());
56 74
     CHECK_N_ASSIGN(double, attr_base, hier_val.asDouble());
57 75
     CHECK_N_ASSIGN(std::string, attr_base, hier_val.asString());
58
-    CHECK_N_ASSIGN(char*, attr_base, strdup(hier_val.asCString()));
76
+    CHECK_N_ASSIGN(char *, attr_base, strdup(hier_val.asCString()));
59 77
     CHECK_N_ASSIGN(bool, attr_base, hier_val.asBool());
60 78
 }
61 79
 
62
-Json::Value& sysc::configurer::get_value_from_hierarchy(const std::string& hier_name) {
63
-    size_t npos= hier_name.find_first_of('.');
64
-    Json::Value& val = root[hier_name.substr(0, npos)];
65
-    if(val.isNull() || npos==hier_name.size()) return val;
66
-    return get_value_from_hierarchy(hier_name.substr(npos+1, hier_name.size()), val);
80
+Json::Value &sysc::configurer::get_value_from_hierarchy(const std::string &hier_name) {
81
+    size_t npos = hier_name.find_first_of('.');
82
+    Json::Value &val = root[hier_name.substr(0, npos)];
83
+    if (val.isNull() || npos == hier_name.size()) return val;
84
+    return get_value_from_hierarchy(hier_name.substr(npos + 1, hier_name.size()), val);
67 85
 }
68 86
 
69
-Json::Value& sysc::configurer::get_value_from_hierarchy(const std::string& hier_name, Json::Value& value) {
70
-    size_t npos= hier_name.find_first_of('.');
71
-    Json::Value& val = value[hier_name.substr(0, npos)];
72
-    if(val.isNull() || npos==hier_name.size()) return val;
73
-    return get_value_from_hierarchy(hier_name.substr(npos+1, hier_name.size()), val);
87
+Json::Value &sysc::configurer::get_value_from_hierarchy(const std::string &hier_name, Json::Value &value) {
88
+    size_t npos = hier_name.find_first_of('.');
89
+    Json::Value &val = value[hier_name.substr(0, npos)];
90
+    if (val.isNull() || npos == hier_name.size()) return val;
91
+    return get_value_from_hierarchy(hier_name.substr(npos + 1, hier_name.size()), val);
74 92
 }

+ 3690
- 4128
src/jsoncpp.cpp
File diff suppressed because it is too large
View File


+ 20
- 6
src/report.cpp View File

@@ -1,3 +1,18 @@
1
+/*******************************************************************************
2
+ * Copyright 2017 MINRES Technologies GmbH
3
+ *
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
+ *******************************************************************************/
1 16
 /*
2 17
  * report.cpp
3 18
  *
@@ -68,8 +83,10 @@ static const std::string compose_message(const sc_report &rep) {
68 83
 static void report_handler(const sc_report &rep, const sc_actions &actions) {
69 84
     const logging::log_level map[] = {logging::INFO, logging::WARNING, logging::ERROR, logging::FATAL};
70 85
     if (actions & SC_DISPLAY)
71
-       if (map[rep.get_severity()] <= logging::Log<logging::Output2FILE<logging::SystemC>>::reporting_level() && logging::Output2FILE<logging::SystemC>::stream())
72
-            sysc::Log<logging::Output2FILE<logging::SystemC>>().get(map[rep.get_severity()], "SystemC")<< compose_message(rep);
86
+        if (map[rep.get_severity()] <= logging::Log<logging::Output2FILE<logging::SystemC>>::reporting_level() &&
87
+            logging::Output2FILE<logging::SystemC>::stream())
88
+            sysc::Log<logging::Output2FILE<logging::SystemC>>().get(map[rep.get_severity()], "SystemC")
89
+                << compose_message(rep);
73 90
     //    if ( (actions & SC_LOG) && log_file_name ) {
74 91
     //        if ( !log_stream ) log_stream = new ::std::ofstream(log_file_name);
75 92
     //        // ios::trunc
@@ -81,7 +98,4 @@ static void report_handler(const sc_report &rep, const sc_actions &actions) {
81 98
     if (actions & SC_THROW) throw rep;
82 99
 }
83 100
 
84
-void sysc::init_logging() {
85
-    sc_report_handler::set_handler(report_handler);
86
-}
87
-
101
+void sysc::init_logging() { sc_report_handler::set_handler(report_handler); }

+ 15
- 0
src/sc_logic_7.cpp View File

@@ -1,3 +1,18 @@
1
+/*******************************************************************************
2
+ * Copyright 2017 MINRES Technologies GmbH
3
+ *
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
+ *******************************************************************************/
1 16
 /*
2 17
  * sc_logic_7.cpp
3 18
  *

+ 15
- 0
src/tracer.cpp View File

@@ -1,3 +1,18 @@
1
+/*******************************************************************************
2
+ * Copyright 2017 MINRES Technologies GmbH
3
+ *
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
+ *******************************************************************************/
1 16
 /*
2 17
  * tracer.cpp
3 18
  *

+ 17
- 2
src/utilities.cpp View File

@@ -1,3 +1,18 @@
1
+/*******************************************************************************
2
+ * Copyright 2017 MINRES Technologies GmbH
3
+ *
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
+ *******************************************************************************/
1 16
 /*
2 17
  * utilities.cpp
3 18
  *
@@ -8,11 +23,11 @@
8 23
 
9 24
 namespace sc_core {
10 25
 void sc_trace(sc_trace_file *tf, const sc_time &t, const std::string &name) {
11
-    sc_trace(tf, reinterpret_cast<const sc_core::sc_time::value_type*>(&t), name);
26
+    sc_trace(tf, reinterpret_cast<const sc_core::sc_time::value_type *>(&t), name);
12 27
 }
13 28
 
14 29
 void sc_trace(sc_trace_file *tf, const sc_time &t, const char *name) {
15
-    sc_trace(tf, reinterpret_cast<const sc_core::sc_time::value_type*>(&t), name);
30
+    sc_trace(tf, reinterpret_cast<const sc_core::sc_time::value_type *>(&t), name);
16 31
 }
17 32
 
18 33
 template <> void sc_trace(sc_trace_file *tf, const sc_in<sc_time> &port, const std::string &name) {