Compare commits
5 Commits
d43b35949e
...
hotfix/lat
Author | SHA1 | Date | |
---|---|---|---|
66dc28c239 | |||
40470445f4 | |||
ea3ff3c0cd | |||
c941890901 | |||
b7c0fb2b1c |
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
project("tgfs" VERSION 1.0.0)
|
project("riscv" VERSION 1.0.0)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ add_subdirectory(softfloat)
|
|||||||
|
|
||||||
# library files
|
# library files
|
||||||
FILE(GLOB RiscVSCHeaders ${CMAKE_CURRENT_SOURCE_DIR}/incl/sysc/*.h ${CMAKE_CURRENT_SOURCE_DIR}/incl/sysc/*/*.h)
|
FILE(GLOB RiscVSCHeaders ${CMAKE_CURRENT_SOURCE_DIR}/incl/sysc/*.h ${CMAKE_CURRENT_SOURCE_DIR}/incl/sysc/*/*.h)
|
||||||
set(LIB_HEADERS tgfscVSCHeaders} )
|
set(LIB_HEADERS ${RiscVSCHeaders} )
|
||||||
set(LIB_SOURCES
|
set(LIB_SOURCES
|
||||||
src/iss/tgf_b.cpp
|
src/iss/tgf_b.cpp
|
||||||
src/iss/tgf_c.cpp
|
src/iss/tgf_c.cpp
|
||||||
@@ -49,55 +49,56 @@ set(LIB_SOURCES ${LIB_SOURCES}
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Define the library
|
# Define the library
|
||||||
add_library(tgfs SHARED ${LIB_SOURCES})
|
add_library(riscv SHARED ${LIB_SOURCES})
|
||||||
target_compile_options(tgfs PRIVATE -Wno-shift-count-overflow)
|
target_compile_options(riscv PRIVATE -Wno-shift-count-overflow)
|
||||||
target_include_directories(tgfs PUBLIC incl)
|
target_include_directories(riscv PUBLIC incl ../external/elfio)
|
||||||
target_link_libraries(tgfs PUBLIC softfloat scc-util)
|
target_link_libraries(riscv PUBLIC softfloat scc-util jsoncpp)
|
||||||
target_link_libraries(tgfs PUBLIC -Wl,--whole-archive dbt-core -Wl,--no-whole-archive)
|
target_link_libraries(riscv PUBLIC -Wl,--whole-archive dbt-core -Wl,--no-whole-archive)
|
||||||
set_target_properties(tgfs PROPERTIES
|
set_target_properties(riscv PROPERTIES
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
FRAMEWORK FALSE
|
FRAMEWORK FALSE
|
||||||
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
|
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
|
||||||
)
|
)
|
||||||
|
|
||||||
if(SystemC_FOUND)
|
if(SystemC_FOUND)
|
||||||
add_library(tgfs_sc src/sysc/core_complex.cpp)
|
add_library(riscv_sc src/sysc/core_complex.cpp)
|
||||||
target_compile_definitions(tgfs_sc PUBLIC WITH_SYSTEMC)
|
target_compile_definitions(riscv_sc PUBLIC WITH_SYSTEMC)
|
||||||
target_include_directories(tgfs_sc PUBLIC ../incl ${SystemC_INCLUDE_DIRS} ${CCI_INCLUDE_DIRS})
|
target_include_directories(riscv_sc PUBLIC ../incl ${SystemC_INCLUDE_DIRS} ${CCI_INCLUDE_DIRS})
|
||||||
|
|
||||||
if(SCV_FOUND)
|
if(SCV_FOUND)
|
||||||
target_compile_definitions(tgfs_sc PUBLIC WITH_SCV)
|
target_compile_definitions(riscv_sc PUBLIC WITH_SCV)
|
||||||
target_include_directories(tgfs_sc PUBLIC ${SCV_INCLUDE_DIRS})
|
target_include_directories(riscv_sc PUBLIC ${SCV_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(tgfs_sc PUBLIC tgfs scc )
|
target_link_libraries(riscv_sc PUBLIC riscv scc )
|
||||||
if(WITH_LLVM)
|
if(WITH_LLVM)
|
||||||
target_link_libraries(tgfs_sc PUBLIC ${llvm_libs})
|
target_link_libraries(riscv_sc PUBLIC ${llvm_libs})
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(tgfs_sc PUBLIC ${Boost_LIBRARIES} )
|
target_link_libraries(riscv_sc PUBLIC ${Boost_LIBRARIES} )
|
||||||
set_target_properties(tgfs_sc PROPERTIES
|
set_target_properties(riscv_sc PROPERTIES
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
FRAMEWORK FALSE
|
FRAMEWORK FALSE
|
||||||
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
|
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project("tgfs-sim")
|
project("riscv-sim")
|
||||||
add_executable(tgfs-sim src/main.cpp)
|
add_executable(riscv-sim src/main.cpp)
|
||||||
# This sets the include directory for the reference project. This is the -I flag in gcc.
|
# This sets the include directory for the reference project. This is the -I flag in gcc.
|
||||||
|
target_include_directories(riscv-sim PRIVATE ../external/libGIS)
|
||||||
if(WITH_LLVM)
|
if(WITH_LLVM)
|
||||||
target_compile_definitions(tgfs-sim PRIVATE WITH_LLVM)
|
target_compile_definitions(riscv-sim PRIVATE WITH_LLVM)
|
||||||
target_link_libraries(tgfs-sim PUBLIC ${llvm_libs})
|
target_link_libraries(riscv-sim PUBLIC ${llvm_libs})
|
||||||
endif()
|
endif()
|
||||||
# Links the target exe against the libraries
|
# Links the target exe against the libraries
|
||||||
target_link_libraries(tgfs-sim tgfs)
|
target_link_libraries(riscv-sim riscv)
|
||||||
target_link_libraries(tgfs-sim jsoncpp)
|
target_link_libraries(riscv-sim jsoncpp)
|
||||||
target_link_libraries(tgfs-sim ${Boost_LIBRARIES} )
|
target_link_libraries(riscv-sim external)
|
||||||
|
target_link_libraries(riscv-sim ${Boost_LIBRARIES} )
|
||||||
if (Tcmalloc_FOUND)
|
if (Tcmalloc_FOUND)
|
||||||
target_link_libraries(tgfs-sim ${Tcmalloc_LIBRARIES})
|
target_link_libraries(riscv-sim ${Tcmalloc_LIBRARIES})
|
||||||
endif(Tcmalloc_FOUND)
|
endif(Tcmalloc_FOUND)
|
||||||
|
|
||||||
install(TARGETS tgfs tgfs-sim
|
install(TARGETS riscv riscv-sim
|
||||||
EXPORT ${PROJECT_NAME}Targets # for downstream dependencies
|
EXPORT ${PROJECT_NAME}Targets # for downstream dependencies
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries
|
||||||
@@ -119,4 +120,4 @@ install(TARGETS tgfs tgfs-sim
|
|||||||
# CMAKE PACKAGING (for other CMake projects to use this one easily)
|
# CMAKE PACKAGING (for other CMake projects to use this one easily)
|
||||||
# _____________________________________________________________________________
|
# _____________________________________________________________________________
|
||||||
|
|
||||||
#include(PackageConfigurator)
|
#include(PackageConfigurator)
|
||||||
|
@@ -302,7 +302,7 @@ public:
|
|||||||
|
|
||||||
void write_mstatus(T val) {
|
void write_mstatus(T val) {
|
||||||
auto mask = get_mask();
|
auto mask = get_mask();
|
||||||
auto new_val = (mstatus.st.value & ~mask) | (val & mask);
|
auto new_val = (mstatus.backing.val & ~mask) | (val & mask);
|
||||||
mstatus = new_val;
|
mstatus = new_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,10 +33,10 @@
|
|||||||
#ifndef _SYSC_SIFIVE_FE310_H_
|
#ifndef _SYSC_SIFIVE_FE310_H_
|
||||||
#define _SYSC_SIFIVE_FE310_H_
|
#define _SYSC_SIFIVE_FE310_H_
|
||||||
|
|
||||||
#include "scc/initiator_mixin.h"
|
#include <tlm/scc/scv/tlm_rec_initiator_socket.h>
|
||||||
|
#include "tlm/scc/initiator_mixin.h"
|
||||||
#include "scc/traceable.h"
|
#include "scc/traceable.h"
|
||||||
#include "scc/utilities.h"
|
#include "scc/utilities.h"
|
||||||
#include "scv4tlm/tlm_rec_initiator_socket.h"
|
|
||||||
#include <cci_configuration>
|
#include <cci_configuration>
|
||||||
#include <tlm>
|
#include <tlm>
|
||||||
#include <tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h>
|
#include <tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h>
|
||||||
@@ -75,7 +75,7 @@ class core_wrapper;
|
|||||||
|
|
||||||
class core_complex : public sc_core::sc_module, public scc::traceable {
|
class core_complex : public sc_core::sc_module, public scc::traceable {
|
||||||
public:
|
public:
|
||||||
scc::initiator_mixin<scv4tlm::tlm_rec_initiator_socket<32>> initiator{"intor"};
|
tlm::scc::initiator_mixin<tlm::scc::scv::tlm_rec_initiator_socket<32>> initiator{"intor"};
|
||||||
|
|
||||||
sc_core::sc_in<sc_core::sc_time> clk_i{"clk_i"};
|
sc_core::sc_in<sc_core::sc_time> clk_i{"clk_i"};
|
||||||
|
|
||||||
|
@@ -331,7 +331,7 @@ void core_complex::disass_output(uint64_t pc, const std::string instr_str) {
|
|||||||
tr_handle.record_attribute("PC", pc);
|
tr_handle.record_attribute("PC", pc);
|
||||||
tr_handle.record_attribute("INSTR", instr_str);
|
tr_handle.record_attribute("INSTR", instr_str);
|
||||||
tr_handle.record_attribute("MODE", lvl[cpu->get_mode()]);
|
tr_handle.record_attribute("MODE", lvl[cpu->get_mode()]);
|
||||||
tr_handle.record_attribute("MSTATUS", cpu->get_state().mstatus.st.value);
|
tr_handle.record_attribute("MSTATUS", cpu->get_state().mstatus.backing.val);
|
||||||
tr_handle.record_attribute("LTIME_START", quantum_keeper.get_current_time().value() / 1000);
|
tr_handle.record_attribute("LTIME_START", quantum_keeper.get_current_time().value() / 1000);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -388,7 +388,7 @@ bool core_complex::read_mem(uint64_t addr, unsigned length, uint8_t *const data,
|
|||||||
if (is_fetch && tr_handle.is_active()) {
|
if (is_fetch && tr_handle.is_active()) {
|
||||||
tr_handle.end_transaction();
|
tr_handle.end_transaction();
|
||||||
}
|
}
|
||||||
auto preExt = new scv4tlm::tlm_recording_extension(tr_handle, this);
|
auto preExt = new tlm::scc::scv4tlm::tlm_recording_extension(tr_handle, this);
|
||||||
gp.set_extension(preExt);
|
gp.set_extension(preExt);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -434,7 +434,7 @@ bool core_complex::write_mem(uint64_t addr, unsigned length, const uint8_t *cons
|
|||||||
sc_time delay{quantum_keeper.get_local_time()};
|
sc_time delay{quantum_keeper.get_local_time()};
|
||||||
#ifdef WITH_SCV
|
#ifdef WITH_SCV
|
||||||
if (m_db != nullptr && tr_handle.is_valid()) {
|
if (m_db != nullptr && tr_handle.is_valid()) {
|
||||||
auto preExt = new scv4tlm::tlm_recording_extension(tr_handle, this);
|
auto preExt = new tlm::scc::scv4tlm::tlm_recording_extension(tr_handle, this);
|
||||||
gp.set_extension(preExt);
|
gp.set_extension(preExt);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user