Browse Source

Fixed license header and formatting

pull/6/head
Eyck Jentzsch 2 years ago
parent
commit
35379b77b6

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

@@ -7,28 +7,28 @@
// //////////////////////////////////////////////////////////////////////

/*
The JsonCpp library's source code, including accompanying documentation,
The JsonCpp library's source code, including accompanying documentation,
tests and demonstration applications, are licensed under the following
conditions...

Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim copyright in all
jurisdictions which recognize such a disclaimer. In such jurisdictions,
Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim copyright in all
jurisdictions which recognize such a disclaimer. In such jurisdictions,
this software is released into the Public Domain.

In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur and
The JsonCpp Authors, and is released under the terms of the MIT License (see below).

In jurisdictions which recognize Public Domain property, the user of this
software may choose to accept it either as 1) Public Domain, 2) under the
conditions of the MIT License (see below), or 3) under the terms of dual
In jurisdictions which recognize Public Domain property, the user of this
software may choose to accept it either as 1) Public Domain, 2) under the
conditions of the MIT License (see below), or 3) under the terms of dual
Public Domain/MIT License conditions described here, as they choose.

The MIT License is about as close to Public Domain as a license can get, and is
described in clear, concise terms at:

http://en.wikipedia.org/wiki/MIT_License
The full text of the MIT License follows:

========================================================================
@@ -69,12 +69,8 @@ license you like.
// End of content of file: LICENSE
// //////////////////////////////////////////////////////////////////////





#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED
# define JSON_FORWARD_AMALGATED_H_INCLUDED
#define JSON_FORWARD_AMALGATED_H_INCLUDED
/// If defined, indicates that the source file is amalgated
/// to prevent private header inclusion.
#define JSON_IS_AMALGAMATION
@@ -91,8 +87,8 @@ license you like.
#ifndef JSON_CONFIG_H_INCLUDED
#define JSON_CONFIG_H_INCLUDED
#include <stddef.h>
#include <string> //typedef String
#include <stdint.h> //typedef int64_t, uint64_t
#include <string> //typedef String

/// If defined, indicates that json library is embedded in CppTL library.
//# define JSON_IN_CPPTL 1
@@ -145,21 +141,21 @@ license you like.
// #define JSON_NO_INT64 1

#if defined(_MSC_VER) // MSVC
# if _MSC_VER <= 1200 // MSVC 6
// Microsoft Visual Studio 6 only support conversion from __int64 to double
// (no conversion from unsigned __int64).
# define JSON_USE_INT64_DOUBLE_CONVERSION 1
// Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
// characters in the debug information)
// All projects I've ever seen with VS6 were using this globally (not bothering
// with pragma push/pop).
# pragma warning(disable : 4786)
# endif // MSVC 6
# if _MSC_VER >= 1500 // MSVC 2008
/// Indicates that the following function is deprecated.
# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
# endif
#if _MSC_VER <= 1200 // MSVC 6
// Microsoft Visual Studio 6 only support conversion from __int64 to double
// (no conversion from unsigned __int64).
#define JSON_USE_INT64_DOUBLE_CONVERSION 1
// Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
// characters in the debug information)
// All projects I've ever seen with VS6 were using this globally (not bothering
// with pragma push/pop).
#pragma warning(disable : 4786)
#endif // MSVC 6
#if _MSC_VER >= 1500 // MSVC 2008
/// Indicates that the following function is deprecated.
#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
#endif

#endif // defined(_MSC_VER)

@@ -167,17 +163,17 @@ license you like.
// is intended to override the base-class version. This makes the code more
// managable and fixes a set of common hard-to-find bugs.
#if __cplusplus >= 201103L
# define JSONCPP_OVERRIDE override
# define JSONCPP_NOEXCEPT noexcept
#define JSONCPP_OVERRIDE override
#define JSONCPP_NOEXCEPT noexcept
#elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900
# define JSONCPP_OVERRIDE override
# define JSONCPP_NOEXCEPT throw()
#define JSONCPP_OVERRIDE override
#define JSONCPP_NOEXCEPT throw()
#elif defined(_MSC_VER) && _MSC_VER >= 1900
# define JSONCPP_OVERRIDE override
# define JSONCPP_NOEXCEPT noexcept
#define JSONCPP_OVERRIDE override
#define JSONCPP_NOEXCEPT noexcept
#else
# define JSONCPP_OVERRIDE
# define JSONCPP_NOEXCEPT throw()
#define JSONCPP_OVERRIDE
#define JSONCPP_NOEXCEPT throw()
#endif

#ifndef JSON_HAS_RVALUE_REFERENCES
@@ -189,12 +185,12 @@ license you like.
#ifdef __clang__
#if __has_feature(cxx_rvalue_references)
#define JSON_HAS_RVALUE_REFERENCES 1
#endif // has_feature
#endif // has_feature

#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
#define JSON_HAS_RVALUE_REFERENCES 1
#endif // GXX_EXPERIMENTAL
#endif // GXX_EXPERIMENTAL

#endif // __clang__ || __GNUC__

@@ -205,15 +201,15 @@ license you like.
#endif

#ifdef __clang__
# if __has_extension(attribute_deprecated_with_message)
# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
# endif
#if __has_extension(attribute_deprecated_with_message)
#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
#endif
#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
# elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
# define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
# endif // GNUC version
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
#define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
#endif // GNUC version
#endif // __clang__ || __GNUC__

#if !defined(JSONCPP_DEPRECATED)
@@ -221,16 +217,16 @@ license you like.
#endif // if !defined(JSONCPP_DEPRECATED)

#if __GNUC__ >= 6
# define JSON_USE_INT64_DOUBLE_CONVERSION 1
#define JSON_USE_INT64_DOUBLE_CONVERSION 1
#endif

#if !defined(JSON_IS_AMALGAMATION)

# include "version.h"
#include "version.h"

# if JSONCPP_USING_SECURE_MEMORY
# include "allocator.h" //typedef Allocator
# endif
#if JSONCPP_USING_SECURE_MEMORY
#include "allocator.h" //typedef Allocator
#endif

#endif // if !defined(JSON_IS_AMALGAMATION)

@@ -241,12 +237,12 @@ typedef unsigned int UInt;
typedef int LargestInt;
typedef unsigned int LargestUInt;
#undef JSON_HAS_INT64
#else // if defined(JSON_NO_INT64)
#else // if defined(JSON_NO_INT64)
// For Microsoft Visual use specific types as long long is not supported
#if defined(_MSC_VER) // Microsoft Visual Studio
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
#else // if defined(_MSC_VER) // Other platforms, use long long
#else // if defined(_MSC_VER) // Other platforms, use long long
typedef int64_t Int64;
typedef uint64_t UInt64;
#endif // if defined(_MSC_VER)
@@ -255,17 +251,17 @@ typedef UInt64 LargestUInt;
#define JSON_HAS_INT64
#endif // if defined(JSON_NO_INT64)
#if JSONCPP_USING_SECURE_MEMORY
#define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
#define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
#define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>>
#define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
#define JSONCPP_ISTREAM std::istream
#define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char>>
#define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char>>
#define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>>
#define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char>>
#define JSONCPP_ISTREAM std::istream
#else
#define JSONCPP_STRING std::string
#define JSONCPP_STRING std::string
#define JSONCPP_OSTRINGSTREAM std::ostringstream
#define JSONCPP_OSTREAM std::ostream
#define JSONCPP_OSTREAM std::ostream
#define JSONCPP_ISTRINGSTREAM std::istringstream
#define JSONCPP_ISTREAM std::istream
#define JSONCPP_ISTREAM std::istream
#endif // if JSONCPP_USING_SECURE_MEMORY
} // end namespace Json

@@ -275,11 +271,6 @@ typedef UInt64 LargestUInt;
// End of content of file: include/json/config.h
// //////////////////////////////////////////////////////////////////////






// //////////////////////////////////////////////////////////////////////
// Beginning of content of file: include/json/forwards.h
// //////////////////////////////////////////////////////////////////////
@@ -326,8 +317,4 @@ class ValueConstIterator;
// End of content of file: include/json/forwards.h
// //////////////////////////////////////////////////////////////////////





#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED
#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 @@
/*******************************************************************************
* Copyright 2017 MINRES Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/*
* configurer.h
*
@@ -8,69 +23,70 @@
#ifndef _SYSC_CONFIGURER_H_
#define _SYSC_CONFIGURER_H_

#include "utilities.h"
#include "report.h"
#include "utilities.h"
#include <json/json.h>

namespace sysc {

class configurer: public sc_core::sc_module {
class configurer : public sc_core::sc_module {
public:
using base_type = sc_core::sc_module;
configurer(const std::string& filename);
configurer(const std::string &filename);

void configure(){
for(auto* o: sc_core::sc_get_top_level_objects(sc_core::sc_curr_simcontext)){
Json::Value& val = root[o->name()];
if(!val.isNull()) configure_sc_object(o, val);
void configure() {
for (auto *o : sc_core::sc_get_top_level_objects(sc_core::sc_curr_simcontext)) {
Json::Value &val = root[o->name()];
if (!val.isNull()) configure_sc_object(o, val);
}
}
void dump_hierarchy(sc_core::sc_object* obj=nullptr, std::ostream& os =std::cout){
if(obj){
os<<obj->name()<<" of type "<<typeid(*obj).name()<<"\n";
for(auto* o:obj->get_child_objects())
dump_hierarchy(o, os);
void dump_hierarchy(sc_core::sc_object *obj = nullptr, std::ostream &os = std::cout) {
if (obj) {
os << obj->name() << " of type " << typeid(*obj).name() << "\n";
for (auto *o : obj->get_child_objects()) dump_hierarchy(o, os);
} else {
for(auto* o:sc_core::sc_get_top_level_objects(sc_core::sc_curr_simcontext))
dump_hierarchy(o, os);
for (auto *o : sc_core::sc_get_top_level_objects(sc_core::sc_curr_simcontext)) dump_hierarchy(o, os);
}
}
template<typename T>
void set_value(const std::string& hier_name, T value){
template <typename T> void set_value(const std::string &hier_name, T value) {
size_t pos = hier_name.find_last_of('.');
sc_core::sc_module* mod = dynamic_cast<sc_core::sc_module*>(sc_core::sc_find_object(hier_name.substr(0, pos).c_str()));
if(mod!=nullptr){
sc_core::sc_attribute<T>* attr = dynamic_cast<sc_core::sc_attribute<T>*>(mod->get_attribute(hier_name.substr(pos+1)));
if(attr!=nullptr) attr->value=value;
else LOG(ERROR)<<"Could not set attribute value "<<hier_name;
sc_core::sc_module *mod =
dynamic_cast<sc_core::sc_module *>(sc_core::sc_find_object(hier_name.substr(0, pos).c_str()));
if (mod != nullptr) {
sc_core::sc_attribute<T> *attr =
dynamic_cast<sc_core::sc_attribute<T> *>(mod->get_attribute(hier_name.substr(pos + 1)));
if (attr != nullptr)
attr->value = value;
else
LOG(ERROR) << "Could not set attribute value " << hier_name;
}
}

void set_configuration_value(sc_core::sc_attr_base* attr_base, sc_core::sc_module* owner) {
void set_configuration_value(sc_core::sc_attr_base *attr_base, sc_core::sc_module *owner) {
std::string name(owner->name());
name+=".";
name+=attr_base->name();
Json::Value& val = get_value_from_hierarchy(name);
if(!val.isNull()) set_value(attr_base, val);
name += ".";
name += attr_base->name();
Json::Value &val = get_value_from_hierarchy(name);
if (!val.isNull()) set_value(attr_base, val);
}

static configurer& instance(){
configurer* inst = dynamic_cast<configurer*>(sc_core::sc_find_object( "configurer"));
assert("No configurer instantiated when using it" && inst!=nullptr);
static configurer &instance() {
configurer *inst = dynamic_cast<configurer *>(sc_core::sc_find_object("configurer"));
assert("No configurer instantiated when using it" && inst != nullptr);
return *inst;
}

protected:
void configure_sc_object(sc_core::sc_object* obj, Json::Value& hier_val);
void configure_sc_object(sc_core::sc_object *obj, Json::Value &hier_val);

void set_value(sc_core::sc_attr_base* attr_base, Json::Value& hier_val);
void set_value(sc_core::sc_attr_base *attr_base, Json::Value &hier_val);

Json::Value& get_value_from_hierarchy(const std::string& hier_name);
Json::Value &get_value_from_hierarchy(const std::string &hier_name);

Json::Value& get_value_from_hierarchy(const std::string& hier_name, Json::Value& val);
Json::Value &get_value_from_hierarchy(const std::string &hier_name, Json::Value &val);

Json::Value root;
};
}


#endif /* _SYSC_CONFIGURER_H_ */

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

@@ -1,3 +1,18 @@
/*******************************************************************************
* Copyright 2017 MINRES Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/*
* atrribute_mixin.h
*
@@ -12,30 +27,29 @@
#include "utilities.h"

namespace sysc {
template <typename T>
class ext_attribute: public sc_core::sc_attribute<T> {
template <typename T> class ext_attribute : public sc_core::sc_attribute<T> {
public:
using base_type = sc_core::sc_attribute<T>;

ext_attribute( const std::string& name_, sc_core::sc_module* owner)
: base_type(name_), owner(owner)
{
ext_attribute(const std::string &name_, sc_core::sc_module *owner)
: base_type(name_)
, owner(owner) {
owner->add_attribute(*this);
configurer::instance().set_configuration_value(this, owner);
}

ext_attribute( const std::string& name_, const T& value_, sc_core::sc_module* owner)
: base_type(name_, value_), owner(owner)
{
ext_attribute(const std::string &name_, const T &value_, sc_core::sc_module *owner)
: base_type(name_, value_)
, owner(owner) {
owner->add_attribute(*this);
configurer::instance().set_configuration_value(this, owner);
}

ext_attribute( const ext_attribute<T>& a ) = delete;
ext_attribute(const ext_attribute<T> &a) = delete;

~ext_attribute() = default;

const sc_core::sc_module* owner;
const sc_core::sc_module *owner;
};
};


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

@@ -26,11 +26,11 @@
// Needed for the simple_target_socket
#define SC_INCLUDE_DYNAMIC_PROCESSES

#include "utilities.h"
#include "target_mixin.h"
#include "report.h"
#include <util/sparse_array.h>
#include "target_mixin.h"
#include "utilities.h"
#include <tlm.h>
#include <util/sparse_array.h>

namespace sysc {

@@ -39,7 +39,6 @@ namespace sysc {
template <unsigned long long SIZE, unsigned BUSWIDTH = 32, bool LOG_ACCESS = false>
class memory : public sc_core::sc_module {
public:

sysc::target_mixin<tlm::tlm_target_socket<BUSWIDTH>> target;

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)
target.register_b_transport([=](tlm::tlm_generic_payload &gp, sc_core::sc_time &delay) -> void {
auto count = this->handle_operation(gp);
});
target.register_transport_dbg([this](tlm::tlm_generic_payload &gp) -> unsigned {
return this->handle_operation(gp);
});
target.register_transport_dbg(
[this](tlm::tlm_generic_payload &gp) -> unsigned { return this->handle_operation(gp); });
target.register_get_direct_mem_ptr([this](tlm::tlm_generic_payload &gp, tlm::tlm_dmi &dmi_data) -> bool {
return this->handle_dmi(gp, dmi_data);
});
@@ -98,8 +96,8 @@ int memory<SIZE, BUSWIDTH, LOG_ACCESS>::handle_operation(tlm::tlm_generic_payloa
LOG(WARNING) << (cmd == tlm::TLM_READ_COMMAND ? "read" : "write") << " access to addr 0x" << std::hex << adr
<< std::dec;
}
if (cmd == tlm::TLM_READ_COMMAND){
if(mem.is_allocated(adr)){
if (cmd == tlm::TLM_READ_COMMAND) {
if (mem.is_allocated(adr)) {
const auto &p = mem(adr / mem.page_size);
auto offs = adr & mem.page_addr_mask;
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
// no allocated page so return randomized data
for (size_t i = 0; i < len; i++) ptr[i] = rand() % 256;
}
}else if (cmd == tlm::TLM_WRITE_COMMAND){
} else if (cmd == tlm::TLM_WRITE_COMMAND) {
auto &p = mem(adr / mem.page_size);
auto offs = adr & mem.page_addr_mask;
std::copy(ptr, ptr + len, p.data() + offs);
@@ -117,12 +115,12 @@ int memory<SIZE, BUSWIDTH, LOG_ACCESS>::handle_operation(tlm::tlm_generic_payloa
return len;
}

template<unsigned long long SIZE, unsigned BUSWIDTH, bool LOG_ACCESS>
inline bool memory<SIZE, BUSWIDTH, LOG_ACCESS>::handle_dmi(tlm::tlm_generic_payload& gp, tlm::tlm_dmi& dmi_data) {
template <unsigned long long SIZE, unsigned BUSWIDTH, bool LOG_ACCESS>
inline bool memory<SIZE, BUSWIDTH, LOG_ACCESS>::handle_dmi(tlm::tlm_generic_payload &gp, tlm::tlm_dmi &dmi_data) {
auto &p = mem(gp.get_address() / mem.page_size);
dmi_data.set_start_address(gp.get_address() & ~mem.page_addr_mask);
//TODO: fix to provide the correct end address
dmi_data.set_end_address(dmi_data.get_start_address()+mem.page_size-1);
// TODO: fix to provide the correct end address
dmi_data.set_end_address(dmi_data.get_start_address() + mem.page_size - 1);
dmi_data.set_dmi_ptr(p.data());
dmi_data.set_granted_access(tlm::tlm_dmi::DMI_ACCESS_READ_WRITE);
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
* @return
*/
bool write(const uint8_t *data, size_t length, uint64_t offset) override {
assert("Access out of range" && offset+length <= sizeof(DATATYPE));
assert("Access out of range" && offset + length <= sizeof(DATATYPE));
auto temp(storage);
auto beg = reinterpret_cast<uint8_t*>(&temp)+offset;
std::copy(data, data+length, beg);
if (wr_cb)
return wr_cb(*this, temp);
auto beg = reinterpret_cast<uint8_t *>(&temp) + offset;
std::copy(data, data + length, beg);
if (wr_cb) return wr_cb(*this, temp);
storage = (temp & wrmask) | (storage & ~wrmask);
return true;
}
@@ -115,14 +114,14 @@ struct sc_register : public sc_core::sc_object, public resource_access_if, publi
* @return
*/
bool read(uint8_t *data, size_t length, uint64_t offset) const override {
assert("Access out of range" && offset+length <= sizeof(DATATYPE));
assert("Access out of range" && offset + length <= sizeof(DATATYPE));
auto temp(storage);
if (rd_cb) {
if(!rd_cb(*this, temp)) return false;
if (!rd_cb(*this, temp)) return false;
} else
temp&= rdmask;
auto beg = reinterpret_cast<uint8_t*>(&temp)+offset;
std::copy(beg, beg+length, data);
temp &= rdmask;
auto beg = reinterpret_cast<uint8_t *>(&temp) + offset;
std::copy(beg, beg + length, data);
return true;
}
/**

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

@@ -62,9 +62,9 @@ public:
if (this->print_time()) this->os << "- " << log::now_time();
if (this->print_severity()) {
this->os << " " << std::setw(7) << std::left << this->to_string(level);
//if (strlen(category))
// if (strlen(category))
// this->os << "[" << std::setw(10) << category<<"]";
//else
// else
// this->os << " ";
this->os << std::right;
}
@@ -75,8 +75,7 @@ public:
};
};

template<typename CATEGORY = log::SystemC>
class FILELOG_DECLSPEC Logger : public Log<log::Output2FILE<CATEGORY>> {
template <typename CATEGORY = log::SystemC> class FILELOG_DECLSPEC Logger : public Log<log::Output2FILE<CATEGORY>> {
public:
/**
*
@@ -95,14 +94,15 @@ public:
#undef LOG
#endif
#define LOG(LEVEL) \
if (logging::LEVEL <= logging::Log<logging::Output2FILE<logging::SystemC>>::reporting_level() && LOG_OUTPUT(SystemC)::stream()) \
sysc::Log<logging::Output2FILE<logging::SystemC>>().get(logging::LEVEL, "SystemC")
if (logging::LEVEL <= logging::Log<logging::Output2FILE<logging::SystemC>>::reporting_level() && \
LOG_OUTPUT(SystemC)::stream()) \
sysc::Log<logging::Output2FILE<logging::SystemC>>().get(logging::LEVEL, "SystemC")

#ifdef CLOG
#undef CLOG
#endif
#define CLOG(LEVEL, CATEGORY) \
if (logging::LEVEL <= LOGGER(CATEGORY)::reporting_level() && LOG_OUTPUT(CATEGORY)::stream()) \
sysc::Log<logging::Output2FILE<logging::CATEGORY>>().get(logging::LEVEL, #CATEGORY)
#define CLOG(LEVEL, CATEGORY) \
if (logging::LEVEL <= LOGGER(CATEGORY)::reporting_level() && LOG_OUTPUT(CATEGORY)::stream()) \
sysc::Log<logging::Output2FILE<logging::CATEGORY>>().get(logging::LEVEL, #CATEGORY)

#endif /* _SYSC_REPORT_H_ */

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

@@ -47,9 +47,7 @@ struct resetable {
for (auto res : resources) res->reset();
_in_reset = false;
}
bool in_reset(){
return _in_reset;
}
bool in_reset() { return _in_reset; }
/**
*
* @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
*/
inline sc_core::sc_time operator"" _fs(unsigned long long val) { return sc_core::sc_time(double(val), sc_core::SC_FS); }

inline constexpr uint64_t operator"" _kB(unsigned long long val) { return val * 1<<10; }
inline constexpr uint64_t operator"" _MB(unsigned long long val) { return val * 1<<20; }
inline constexpr uint64_t operator"" _GB(unsigned long long val) { return val * 1<<30; }
inline constexpr uint64_t operator"" _kB(unsigned long long val) { return val * 1 << 10; }
inline constexpr uint64_t operator"" _MB(unsigned long long val) { return val * 1 << 20; }
inline constexpr uint64_t operator"" _GB(unsigned long long val) { return val * 1 << 30; }

#endif /* _SYSC_UTILITIES_H_ */

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

@@ -1,36 +1,18 @@
/*******************************************************************************
* Copyright (C) 2017, MINRES Technologies GmbH
* All rights reserved.
* Copyright 2017 MINRES Technologies GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* http://www.apache.org/licenses/LICENSE-2.0
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* Contributors:
* eyck@minres.com - initial API and implementation
******************************************************************************/
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#ifndef _ASSERT_H_
#define _ASSERT_H_

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

@@ -1,36 +1,18 @@
/*******************************************************************************
* Copyright (C) 2017, MINRES Technologies GmbH
* All rights reserved.
* Copyright 2017 MINRES Technologies GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* http://www.apache.org/licenses/LICENSE-2.0
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* Contributors:
* eyck@minres.com - initial API and implementation
******************************************************************************/
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#ifndef _UTIL_ITIES_H_
#define _UTIL_ITIES_H_

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

@@ -1,36 +1,18 @@
/*******************************************************************************
* Copyright (C) 2017, MINRES Technologies GmbH
* All rights reserved.
* Copyright 2017 MINRES Technologies GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* http://www.apache.org/licenses/LICENSE-2.0
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* Contributors:
* eyck@minres.com - initial API and implementation
******************************************************************************/
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#ifndef _UTIL_LOGGING_H_
#define _UTIL_LOGGING_H_
@@ -81,7 +63,7 @@ public:
if (print_time()) os << "- " << now_time();
if (print_severity()) {
os << " " << to_string(level);
//if (strlen(category)) os << "[" << category<<"]";
// if (strlen(category)) os << "[" << category<<"]";
os << ": ";
}
get_last_log_level() = level;
@@ -159,14 +141,14 @@ class DEFAULT {};
#define LOG_OUTPUT(CATEGORY) logging::Output2FILE<logging::CATEGORY>

#ifndef LOG
#define LOG(LEVEL) \
if (logging::LEVEL <= LOGGER(DEFAULT)::reporting_level() && LOG_OUTPUT(DEFAULT)::stream()) \
LOGGER(DEFAULT)().get(logging::LEVEL)
#define LOG(LEVEL) \
if (logging::LEVEL <= LOGGER(DEFAULT)::reporting_level() && LOG_OUTPUT(DEFAULT)::stream()) \
LOGGER(DEFAULT)().get(logging::LEVEL)
#endif
#ifndef CLOG
#define CLOG(LEVEL, CATEGORY) \
if (logging::LEVEL <= LOGGER(CATEGORY)::reporting_level() && LOG_OUTPUT(CATEGORY)::stream()) \
LOGGER(CATEGORY)().get(logging::LEVEL, #CATEGORY)
#define CLOG(LEVEL, CATEGORY) \
if (logging::LEVEL <= LOGGER(CATEGORY)::reporting_level() && LOG_OUTPUT(CATEGORY)::stream()) \
LOGGER(CATEGORY)().get(logging::LEVEL, #CATEGORY)
#endif
#if defined(WIN32)


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

@@ -1,36 +1,18 @@
/*******************************************************************************
* Copyright (C) 2017, MINRES Technologies GmbH
* All rights reserved.
* Copyright 2017 MINRES Technologies GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* http://www.apache.org/licenses/LICENSE-2.0
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* Contributors:
* eyck@minres.com - initial API and implementation
******************************************************************************/
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#ifndef _RANGE_LUT_H_
#define _RANGE_LUT_H_

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

@@ -1,36 +1,18 @@
/*******************************************************************************
* Copyright (C) 2017, MINRES Technologies GmbH
* All rights reserved.
* Copyright 2017 MINRES Technologies GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* http://www.apache.org/licenses/LICENSE-2.0
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* Contributors:
* eyck@minres.com - initial API and implementation
******************************************************************************/
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#ifndef _SPARSE_ARRAY_H_
#define _SPARSE_ARRAY_H_
@@ -49,7 +31,7 @@ template <typename T, uint64_t SIZE, int lower_width = 24> struct sparse_array {

const uint64_t page_size = (1 << lower_width);

const unsigned page_count=1+SIZE/page_size;
const unsigned page_count = 1 + SIZE / page_size;

const uint64_t page_addr_width = lower_width;

@@ -74,7 +56,7 @@ template <typename T, uint64_t SIZE, int lower_width = 24> struct sparse_array {
return *(arr[page_nr]);
}

bool is_allocated(uint32_t addr){
bool is_allocated(uint32_t addr) {
assert(addr < SIZE);
T nr = addr >> lower_width;
return arr[nr] != nullptr;

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

@@ -1,36 +1,18 @@
/*******************************************************************************
* Copyright (C) 2017, MINRES Technologies GmbH
* All rights reserved.
* Copyright 2017 MINRES Technologies GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* http://www.apache.org/licenses/LICENSE-2.0
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* Contributors:
* eyck@minres.com - initial API and implementation
******************************************************************************/
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
#ifndef _THREAD_SYNCRONIZER_H_
#define _THREAD_SYNCRONIZER_H_


+ 53
- 35
src/configurer.cpp View File

@@ -1,3 +1,18 @@
/*******************************************************************************
* Copyright 2017 MINRES Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/*
* configurer.cpp
*
@@ -5,48 +20,51 @@
* Author: eyck
*/

#include <istream>
#include <sysc/configurer.h>
#include <sysc/report.h>
#include <istream>


sysc::configurer::configurer(const std::string& filename):base_type(sc_core::sc_module_name("configurer")) {
if(filename.length()>0){
sysc::configurer::configurer(const std::string &filename)
: base_type(sc_core::sc_module_name("configurer")) {
if (filename.length() > 0) {
std::ifstream is(filename);
if(is.is_open()){
if (is.is_open()) {
try {
is>>root;
}catch(Json::RuntimeError& e){
LOG(ERROR)<<"Could not parse input file "<<filename<<", reason: "<<e.what();
is >> root;
} catch (Json::RuntimeError &e) {
LOG(ERROR) << "Could not parse input file " << filename << ", reason: " << e.what();
}
} else {
LOG(ERROR)<<"Could not open input file "<<filename;
LOG(ERROR) << "Could not open input file " << filename;
}
}
}

void sysc::configurer::configure_sc_object(sc_core::sc_object* obj, Json::Value& hier_val) {
sc_core::sc_attr_base* ab = dynamic_cast<sc_core::sc_attr_base*>(obj);
if(ab!=nullptr){
void sysc::configurer::configure_sc_object(sc_core::sc_object *obj, Json::Value &hier_val) {
sc_core::sc_attr_base *ab = dynamic_cast<sc_core::sc_attr_base *>(obj);
if (ab != nullptr) {

}else{
sc_core::sc_module* mod=dynamic_cast<sc_core::sc_module*>(obj);
if(mod!=nullptr){
for(auto* o: mod->get_child_objects()){
Json::Value& val = root[o->basename()];
if(!val.isNull()) configure_sc_object(o, val);
} else {
sc_core::sc_module *mod = dynamic_cast<sc_core::sc_module *>(obj);
if (mod != nullptr) {
for (auto *o : mod->get_child_objects()) {
Json::Value &val = root[o->basename()];
if (!val.isNull()) configure_sc_object(o, val);
}
}
}
}

#define CHECK_N_ASSIGN(TYPE, ATTR, VAL) {\
auto* a = dynamic_cast<sc_core::sc_attribute<TYPE>*>(ATTR); \
if(a!=nullptr) { a->value=VAL; return; } \
}
#define CHECK_N_ASSIGN(TYPE, ATTR, VAL) \
{ \
auto *a = dynamic_cast<sc_core::sc_attribute<TYPE> *>(ATTR); \
if (a != nullptr) { \
a->value = VAL; \
return; \
} \
}

void sysc::configurer::set_value(sc_core::sc_attr_base* attr_base, Json::Value& hier_val) {
void sysc::configurer::set_value(sc_core::sc_attr_base *attr_base, Json::Value &hier_val) {
CHECK_N_ASSIGN(int, attr_base, hier_val.asInt());
CHECK_N_ASSIGN(unsigned, attr_base, hier_val.asUInt());
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&
CHECK_N_ASSIGN(float, attr_base, hier_val.asFloat());
CHECK_N_ASSIGN(double, attr_base, hier_val.asDouble());
CHECK_N_ASSIGN(std::string, attr_base, hier_val.asString());
CHECK_N_ASSIGN(char*, attr_base, strdup(hier_val.asCString()));
CHECK_N_ASSIGN(char *, attr_base, strdup(hier_val.asCString()));
CHECK_N_ASSIGN(bool, attr_base, hier_val.asBool());
}

Json::Value& sysc::configurer::get_value_from_hierarchy(const std::string& hier_name) {
size_t npos= hier_name.find_first_of('.');
Json::Value& val = root[hier_name.substr(0, npos)];
if(val.isNull() || npos==hier_name.size()) return val;
return get_value_from_hierarchy(hier_name.substr(npos+1, hier_name.size()), val);
Json::Value &sysc::configurer::get_value_from_hierarchy(const std::string &hier_name) {
size_t npos = hier_name.find_first_of('.');
Json::Value &val = root[hier_name.substr(0, npos)];
if (val.isNull() || npos == hier_name.size()) return val;
return get_value_from_hierarchy(hier_name.substr(npos + 1, hier_name.size()), val);
}

Json::Value& sysc::configurer::get_value_from_hierarchy(const std::string& hier_name, Json::Value& value) {
size_t npos= hier_name.find_first_of('.');
Json::Value& val = value[hier_name.substr(0, npos)];
if(val.isNull() || npos==hier_name.size()) return val;
return get_value_from_hierarchy(hier_name.substr(npos+1, hier_name.size()), val);
Json::Value &sysc::configurer::get_value_from_hierarchy(const std::string &hier_name, Json::Value &value) {
size_t npos = hier_name.find_first_of('.');
Json::Value &val = value[hier_name.substr(0, npos)];
if (val.isNull() || npos == hier_name.size()) return val;
return get_value_from_hierarchy(hier_name.substr(npos + 1, hier_name.size()), val);
}

+ 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 @@
/*******************************************************************************
* Copyright 2017 MINRES Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/*
* report.cpp
*
@@ -68,8 +83,10 @@ static const std::string compose_message(const sc_report &rep) {
static void report_handler(const sc_report &rep, const sc_actions &actions) {
const logging::log_level map[] = {logging::INFO, logging::WARNING, logging::ERROR, logging::FATAL};
if (actions & SC_DISPLAY)
if (map[rep.get_severity()] <= logging::Log<logging::Output2FILE<logging::SystemC>>::reporting_level() && logging::Output2FILE<logging::SystemC>::stream())
sysc::Log<logging::Output2FILE<logging::SystemC>>().get(map[rep.get_severity()], "SystemC")<< compose_message(rep);
if (map[rep.get_severity()] <= logging::Log<logging::Output2FILE<logging::SystemC>>::reporting_level() &&
logging::Output2FILE<logging::SystemC>::stream())
sysc::Log<logging::Output2FILE<logging::SystemC>>().get(map[rep.get_severity()], "SystemC")
<< compose_message(rep);
// if ( (actions & SC_LOG) && log_file_name ) {
// if ( !log_stream ) log_stream = new ::std::ofstream(log_file_name);
// // ios::trunc
@@ -81,7 +98,4 @@ static void report_handler(const sc_report &rep, const sc_actions &actions) {
if (actions & SC_THROW) throw rep;
}

void sysc::init_logging() {
sc_report_handler::set_handler(report_handler);
}

void sysc::init_logging() { sc_report_handler::set_handler(report_handler); }

+ 15
- 0
src/sc_logic_7.cpp View File

@@ -1,3 +1,18 @@
/*******************************************************************************
* Copyright 2017 MINRES Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/*
* sc_logic_7.cpp
*

+ 15
- 0
src/tracer.cpp View File

@@ -1,3 +1,18 @@
/*******************************************************************************
* Copyright 2017 MINRES Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/*
* tracer.cpp
*

+ 17
- 2
src/utilities.cpp View File

@@ -1,3 +1,18 @@
/*******************************************************************************
* Copyright 2017 MINRES Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/*
* utilities.cpp
*
@@ -8,11 +23,11 @@

namespace sc_core {
void sc_trace(sc_trace_file *tf, const sc_time &t, const std::string &name) {
sc_trace(tf, reinterpret_cast<const sc_core::sc_time::value_type*>(&t), name);
sc_trace(tf, reinterpret_cast<const sc_core::sc_time::value_type *>(&t), name);
}

void sc_trace(sc_trace_file *tf, const sc_time &t, const char *name) {
sc_trace(tf, reinterpret_cast<const sc_core::sc_time::value_type*>(&t), name);
sc_trace(tf, reinterpret_cast<const sc_core::sc_time::value_type *>(&t), name);
}

template <> void sc_trace(sc_trace_file *tf, const sc_in<sc_time> &port, const std::string &name) {

Loading…
Cancel
Save