Skip to content

Commit

Permalink
add scv-tr to build system
Browse files Browse the repository at this point in the history
  • Loading branch information
eyck committed Jul 21, 2021
1 parent ccc39e9 commit f26bfa9
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 1,360 deletions.
20 changes: 12 additions & 8 deletions src/sysc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,12 @@ set(LIB_SOURCES
tlm/scc/pe/parallel_pe.cpp
)

if(SCV_FOUND )
if(ZLIB_FOUND)
set(LIB_SOURCES ${LIB_SOURCES} scc/scv/scv_tr_compressed.cpp)
endif(ZLIB_FOUND)
if(ENABLE_SQLITE)
set(LIB_SOURCES ${LIB_SOURCES} scc/scv/scv_tr_binary.cpp)
set(LIB_SOURCES ${LIB_SOURCES} scc/scv/scv_tr_sqlite.cpp scc/scv/sqlite3.c )
endif()
if(ZLIB_FOUND)
set(LIB_SOURCES ${LIB_SOURCES} scc/scv/scv_tr_compressed.cpp)
endif(ZLIB_FOUND)
if(ENABLE_SQLITE)
set(LIB_SOURCES ${LIB_SOURCES} scc/scv/scv_tr_binary.cpp)
set(LIB_SOURCES ${LIB_SOURCES} scc/scv/scv_tr_sqlite.cpp scc/scv/sqlite3.c )
endif()
if(CCI_FOUND)
set(LIB_SOURCES ${LIB_SOURCES}
Expand Down Expand Up @@ -106,6 +104,12 @@ if(SCV_FOUND)
if(ENABLE_SQLITE)
target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_SQLITE)
endif()
else()
message("Building SCC with SCV-TR support")
target_link_libraries (${PROJECT_NAME} PUBLIC scv-tr)
if(ENABLE_SQLITE)
target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_SQLITE)
endif()
endif()

if(CLANG_TIDY_EXE)
Expand Down
10 changes: 3 additions & 7 deletions src/sysc/scc/tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@

#include "scc/report.h"
#include "scc/utilities.h"
#ifdef WITH_SCV
#include "scv/scv_tr_db.h"
#ifdef WITH_SCV
#include <scv.h>
#else
#include <scv-tr.h>
#endif
#include <cstring>
#include <iostream>
Expand All @@ -37,16 +39,13 @@ using namespace scc;

tracer::tracer(std::string const&& name, file_type type, bool enable)
: tracer_base(sc_core::sc_module_name(sc_core::sc_gen_unique_name("tracer")))
#ifdef WITH_SCV
, txdb(nullptr)
#endif
{
if(enable) {
trf = sc_create_vcd_trace_file(name.c_str());
trf->set_time_unit(1, SC_PS);
owned = true;
}
#ifdef WITH_SCV
if(type != NONE) {
std::stringstream ss;
ss << name;
Expand All @@ -73,7 +72,6 @@ tracer::tracer(std::string const&& name, file_type type, bool enable)
txdb = new scv_tr_db(ss.str().c_str());
scv_tr_db::set_default_db(txdb);
}
#endif
}

void tracer::end_of_elaboration() {
Expand All @@ -83,7 +81,5 @@ void tracer::end_of_elaboration() {
}

tracer::~tracer() {
#ifdef WITH_SCV
delete txdb;
#endif
}
7 changes: 2 additions & 5 deletions src/sysc/scc/tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
#define _SCC_TRACER_H_

#include "tracer_base.h"
#ifdef WITH_SCV
class scv_tr_db;
#endif
#include <string>
#include <vector>

class scv_tr_db;

namespace sc_core {
class sc_object;
class sc_trace_file;
Expand Down Expand Up @@ -71,9 +70,7 @@ class tracer : public tracer_base {

protected:
void end_of_elaboration() override;
#ifdef WITH_SCV
scv_tr_db* txdb;
#endif
};

} /* namespace scc */
Expand Down
2 changes: 0 additions & 2 deletions src/sysc/scc_sysc.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "scc/tracer_base.h"
#include "scc/utilities.h"
#include "scc/value_registry.h"
#ifdef WITH_SCV
#include "scc/scv/scv_tr_db.h"
#include "scc/scv/sqlite3.h"
#include "tlm/scc/scv/tlm_recorder.h"
Expand All @@ -47,7 +46,6 @@
#include "tlm/scc/scv/tlm_rec_target_socket.h"
#include "tlm/scc/scv/tlm_recording_extension.h"
#include "tlm/scc/scv/tlm_extension_recording_registry.h"
#endif

#include "tlm/scc/initiator_mixin.h"
#include "tlm/scc/tlm2_pv_av.h"
Expand Down
4 changes: 4 additions & 0 deletions src/sysc/tlm/scc/scv/tlm_extension_recording_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
#ifndef TLM_RECORDER_REGISTRY_H_
#define TLM_RECORDER_REGISTRY_H_

#ifdef WITH_SCV
#include <scv.h>
#else
#include <scv-tr.h>
#endif
#include <tlm>

namespace tlm {
Expand Down
4 changes: 4 additions & 0 deletions src/sysc/tlm/scc/scv/tlm_gp_data_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
#ifndef TLM_GP_DATA_EXT_H_
#define TLM_GP_DATA_EXT_H_

#ifdef WITH_SCV
#include <scv.h>
#else
#include <scv-tr.h>
#endif
#include <tlm/scc/scv/tlm_gp_data.h>

template <> class scv_extensions<tlm::tlm_command> : public scv_enum_base<tlm::tlm_command> {
Expand Down
13 changes: 1 addition & 12 deletions src/sysc/tlm/scc/scv/tlm_rec_initiator_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#ifndef TLM_REC_INITIATOR_SOCKET_H_
#define TLM_REC_INITIATOR_SOCKET_H_

#ifdef WITH_SCV
#include <tlm/scc/scv/tlm_recorder.h>
#endif
#include <tlm>

namespace tlm {
Expand All @@ -31,14 +29,6 @@ template <unsigned int BUSWIDTH = 32, typename TYPES = tlm::tlm_base_protocol_ty
sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND
#endif
>
#ifndef WITH_SCV
using tlm_rec_initiator_socket = tlm::tlm_initiator_socket<BUSWIDTH, TYPES, N
#if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
,
POL
#endif
>;
#else
class tlm_rec_initiator_socket : public tlm::tlm_initiator_socket<BUSWIDTH, TYPES, N
#if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
,
Expand Down Expand Up @@ -132,8 +122,7 @@ class tlm_rec_initiator_socket : public tlm::tlm_initiator_socket<BUSWIDTH, TYPE
sc_core::sc_port<tlm::tlm_bw_transport_if<TYPES>> bw_port;
scv::tlm_recorder<TYPES> recorder;
};
#endif
} // namespace scv4tlm
} // namespace scv
} // namespace scc
} // namespace tlm

Expand Down
13 changes: 1 addition & 12 deletions src/sysc/tlm/scc/scv/tlm_rec_target_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#ifndef TLM_REC_TARGET_SOCKET_H_
#define TLM_REC_TARGET_SOCKET_H_

#ifdef WITH_SCV
#include <tlm/scc/scv/tlm_recorder.h>
#endif
#include <tlm>

namespace tlm {
Expand All @@ -31,14 +29,6 @@ template <unsigned int BUSWIDTH = 32, typename TYPES = tlm::tlm_base_protocol_ty
sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND
#endif
>
#ifndef WITH_SCV
using tlm_rec_target_socket = tlm::tlm_target_socket<BUSWIDTH, TYPES, N
#if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
,
POL
#endif
>;
#else
class tlm_rec_target_socket : public tlm::tlm_target_socket<BUSWIDTH, TYPES, N
#if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
,
Expand Down Expand Up @@ -125,8 +115,7 @@ class tlm_rec_target_socket : public tlm::tlm_target_socket<BUSWIDTH, TYPES, N
sc_core::sc_port<fw_interface_type> fw_port;
scv::tlm_recorder<TYPES> recorder;
};
#endif
} // namespace scv4tlm
} // namespace scv
} // namespace scc
} // namespace tlm

Expand Down
8 changes: 6 additions & 2 deletions src/sysc/tlm/scc/scv/tlm_recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
#include <array>
#include <unordered_map>
#include <regex>
#ifdef WITH_SCV
#include <scv.h>
#else
#include <scv-tr.h>
#endif
#include <string>
#include <tlm/scc/tlm_mm.h>
#include <tlm>
Expand Down Expand Up @@ -263,8 +267,8 @@ public virtual tlm::tlm_bw_transport_if<TYPES> {
std::array<scv_tr_generator<std::string, std::string>*, 2> nb_trHandle{{nullptr, nullptr}};
//! transaction generator handle for non-blocking transactions with annotated delays
std::array<scv_tr_generator<>*, 2> nb_trTimedHandle{{nullptr, nullptr}};
map<uint64, scv_tr_handle> nbtx_req_handle_map;
map<uint64, scv_tr_handle> nbtx_last_req_handle_map;
std::map<uint64, scv_tr_handle> nbtx_req_handle_map;
std::map<uint64, scv_tr_handle> nbtx_last_req_handle_map;

//! dmi transaction recording stream handle
scv_tr_stream* dmi_streamHandle{nullptr};
Expand Down
4 changes: 4 additions & 0 deletions src/sysc/tlm/scc/scv/tlm_recording_extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
#define _SCV4TLM_TLM_RECORDING_EXTENSION_H_

#include <array>
#ifdef WITH_SCV
#include <scv.h>
#else
#include <scv-tr.h>
#endif
#include <tlm>

namespace tlm {
Expand Down
2 changes: 1 addition & 1 deletion third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ install(TARGETS jsoncpp
# build tlm-interfaces
###############################################################################
add_subdirectory(axi_chi)
add_subdirectory(scv-tr)
2 changes: 1 addition & 1 deletion third_party/scv-tr/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ add_library(${PROJECT_NAME}
scv/scv_util.cpp
)

target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/scv)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${PROJECT_NAME} PUBLIC $ENV{SYSTEMC_HOME}/include)
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include "scv/scv_util.h"
#include "scv/scv_debug.h"
#include "scv/scv_expression.h"
//#include "scv/scv_expression.h"
#include "scv/scv_introspection.h"
#include "scv/scv_report.h"
#include "scv/scv_object_if.h"
Expand Down

0 comments on commit f26bfa9

Please sign in to comment.