From 7e45a252184c5abf0e7e66812bd8b22fa36feece Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 5 Jul 2023 08:28:42 +0200 Subject: [PATCH 1/3] adds a instr yaml for TGC --- TGC_C_instr.yaml | 537 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 537 insertions(+) create mode 100644 TGC_C_instr.yaml diff --git a/TGC_C_instr.yaml b/TGC_C_instr.yaml new file mode 100644 index 0000000..c82876f --- /dev/null +++ b/TGC_C_instr.yaml @@ -0,0 +1,537 @@ + +RV32I: + - LUI: + encoding: 0b00000000000000000000000000110111 + mask: 0b00000000000000000000000001111111 + size: 32 + branch: false + delay: 1 + - AUIPC: + encoding: 0b00000000000000000000000000010111 + mask: 0b00000000000000000000000001111111 + size: 32 + branch: false + delay: 1 + - JAL: + encoding: 0b00000000000000000000000001101111 + mask: 0b00000000000000000000000001111111 + attributes: [[name:no_cont]] + size: 32 + branch: true + delay: 1 + - JALR: + encoding: 0b00000000000000000000000001100111 + mask: 0b00000000000000000111000001111111 + attributes: [[name:no_cont]] + size: 32 + branch: true + delay: 1 + - BEQ: + encoding: 0b00000000000000000000000001100011 + mask: 0b00000000000000000111000001111111 + attributes: [[name:no_cont], [name:cond]] + size: 32 + branch: true + delay: [1,1] + - BNE: + encoding: 0b00000000000000000001000001100011 + mask: 0b00000000000000000111000001111111 + attributes: [[name:no_cont], [name:cond]] + size: 32 + branch: true + delay: [1,1] + - BLT: + encoding: 0b00000000000000000100000001100011 + mask: 0b00000000000000000111000001111111 + attributes: [[name:no_cont], [name:cond]] + size: 32 + branch: true + delay: [1,1] + - BGE: + encoding: 0b00000000000000000101000001100011 + mask: 0b00000000000000000111000001111111 + attributes: [[name:no_cont], [name:cond]] + size: 32 + branch: true + delay: [1,1] + - BLTU: + encoding: 0b00000000000000000110000001100011 + mask: 0b00000000000000000111000001111111 + attributes: [[name:no_cont], [name:cond]] + size: 32 + branch: true + delay: [1,1] + - BGEU: + encoding: 0b00000000000000000111000001100011 + mask: 0b00000000000000000111000001111111 + attributes: [[name:no_cont], [name:cond]] + size: 32 + branch: true + delay: [1,1] + - LB: + encoding: 0b00000000000000000000000000000011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - LH: + encoding: 0b00000000000000000001000000000011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - LW: + encoding: 0b00000000000000000010000000000011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - LBU: + encoding: 0b00000000000000000100000000000011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - LHU: + encoding: 0b00000000000000000101000000000011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SB: + encoding: 0b00000000000000000000000000100011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SH: + encoding: 0b00000000000000000001000000100011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SW: + encoding: 0b00000000000000000010000000100011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - ADDI: + encoding: 0b00000000000000000000000000010011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SLTI: + encoding: 0b00000000000000000010000000010011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SLTIU: + encoding: 0b00000000000000000011000000010011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - XORI: + encoding: 0b00000000000000000100000000010011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - ORI: + encoding: 0b00000000000000000110000000010011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - ANDI: + encoding: 0b00000000000000000111000000010011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SLLI: + encoding: 0b00000000000000000001000000010011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SRLI: + encoding: 0b00000000000000000101000000010011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SRAI: + encoding: 0b01000000000000000101000000010011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - ADD: + encoding: 0b00000000000000000000000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SUB: + encoding: 0b01000000000000000000000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SLL: + encoding: 0b00000000000000000001000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SLT: + encoding: 0b00000000000000000010000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SLTU: + encoding: 0b00000000000000000011000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - XOR: + encoding: 0b00000000000000000100000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SRL: + encoding: 0b00000000000000000101000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - SRA: + encoding: 0b01000000000000000101000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - OR: + encoding: 0b00000000000000000110000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - AND: + encoding: 0b00000000000000000111000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - FENCE: + encoding: 0b00000000000000000000000000001111 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - ECALL: + encoding: 0b00000000000000000000000001110011 + mask: 0b11111111111111111111111111111111 + attributes: [[name:no_cont]] + size: 32 + branch: false + delay: 1 + - EBREAK: + encoding: 0b00000000000100000000000001110011 + mask: 0b11111111111111111111111111111111 + attributes: [[name:no_cont]] + size: 32 + branch: false + delay: 1 + - MRET: + encoding: 0b00110000001000000000000001110011 + mask: 0b11111111111111111111111111111111 + attributes: [[name:no_cont]] + size: 32 + branch: false + delay: 1 + - WFI: + encoding: 0b00010000010100000000000001110011 + mask: 0b11111111111111111111111111111111 + size: 32 + branch: false + delay: 1 +Zicsr: + - CSRRW: + encoding: 0b00000000000000000001000001110011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - CSRRS: + encoding: 0b00000000000000000010000001110011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - CSRRC: + encoding: 0b00000000000000000011000001110011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - CSRRWI: + encoding: 0b00000000000000000101000001110011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - CSRRSI: + encoding: 0b00000000000000000110000001110011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 + - CSRRCI: + encoding: 0b00000000000000000111000001110011 + mask: 0b00000000000000000111000001111111 + size: 32 + branch: false + delay: 1 +Zifencei: + - FENCE_I: + encoding: 0b00000000000000000001000000001111 + mask: 0b00000000000000000111000001111111 + attributes: [[name:flush]] + size: 32 + branch: false + delay: 1 +RV32M: + - MUL: + encoding: 0b00000010000000000000000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - MULH: + encoding: 0b00000010000000000001000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - MULHSU: + encoding: 0b00000010000000000010000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - MULHU: + encoding: 0b00000010000000000011000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - DIV: + encoding: 0b00000010000000000100000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - DIVU: + encoding: 0b00000010000000000101000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - REM: + encoding: 0b00000010000000000110000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 + - REMU: + encoding: 0b00000010000000000111000000110011 + mask: 0b11111110000000000111000001111111 + size: 32 + branch: false + delay: 1 +RV32IC: + - CADDI4SPN: + encoding: 0b0000000000000000 + mask: 0b1110000000000011 + size: 16 + branch: false + delay: 1 + - CLW: + encoding: 0b0100000000000000 + mask: 0b1110000000000011 + size: 16 + branch: false + delay: 1 + - CSW: + encoding: 0b1100000000000000 + mask: 0b1110000000000011 + size: 16 + branch: false + delay: 1 + - CADDI: + encoding: 0b0000000000000001 + mask: 0b1110000000000011 + size: 16 + branch: false + delay: 1 + - CNOP: + encoding: 0b0000000000000001 + mask: 0b1110111110000011 + size: 16 + branch: false + delay: 1 + - CJAL: + encoding: 0b0010000000000001 + mask: 0b1110000000000011 + attributes: [[name:no_cont]] + size: 16 + branch: true + delay: 1 + - CLI: + encoding: 0b0100000000000001 + mask: 0b1110000000000011 + size: 16 + branch: false + delay: 1 + - CLUI: + encoding: 0b0110000000000001 + mask: 0b1110000000000011 + size: 16 + branch: false + delay: 1 + - CADDI16SP: + encoding: 0b0110000100000001 + mask: 0b1110111110000011 + size: 16 + branch: false + delay: 1 + - CSRLI: + encoding: 0b1000000000000001 + mask: 0b1111110000000011 + size: 16 + branch: false + delay: 1 + - CSRAI: + encoding: 0b1000010000000001 + mask: 0b1111110000000011 + size: 16 + branch: false + delay: 1 + - CANDI: + encoding: 0b1000100000000001 + mask: 0b1110110000000011 + size: 16 + branch: false + delay: 1 + - CSUB: + encoding: 0b1000110000000001 + mask: 0b1111110001100011 + size: 16 + branch: false + delay: 1 + - CXOR: + encoding: 0b1000110000100001 + mask: 0b1111110001100011 + size: 16 + branch: false + delay: 1 + - COR: + encoding: 0b1000110001000001 + mask: 0b1111110001100011 + size: 16 + branch: false + delay: 1 + - CAND: + encoding: 0b1000110001100001 + mask: 0b1111110001100011 + size: 16 + branch: false + delay: 1 + - CJ: + encoding: 0b1010000000000001 + mask: 0b1110000000000011 + attributes: [[name:no_cont]] + size: 16 + branch: true + delay: 1 + - CBEQZ: + encoding: 0b1100000000000001 + mask: 0b1110000000000011 + attributes: [[name:no_cont], [name:cond]] + size: 16 + branch: true + delay: [1,1] + - CBNEZ: + encoding: 0b1110000000000001 + mask: 0b1110000000000011 + attributes: [[name:no_cont], [name:cond]] + size: 16 + branch: true + delay: [1,1] + - CSLLI: + encoding: 0b0000000000000010 + mask: 0b1111000000000011 + size: 16 + branch: false + delay: 1 + - CLWSP: + encoding: 0b0100000000000010 + mask: 0b1110000000000011 + size: 16 + branch: false + delay: 1 + - CMV: + encoding: 0b1000000000000010 + mask: 0b1111000000000011 + size: 16 + branch: false + delay: 1 + - CJR: + encoding: 0b1000000000000010 + mask: 0b1111000001111111 + attributes: [[name:no_cont]] + size: 16 + branch: true + delay: 1 + - CADD: + encoding: 0b1001000000000010 + mask: 0b1111000000000011 + size: 16 + branch: false + delay: 1 + - CJALR: + encoding: 0b1001000000000010 + mask: 0b1111000001111111 + attributes: [[name:no_cont]] + size: 16 + branch: true + delay: 1 + - CEBREAK: + encoding: 0b1001000000000010 + mask: 0b1111111111111111 + attributes: [[name:no_cont]] + size: 16 + branch: false + delay: 1 + - CSWSP: + encoding: 0b1100000000000010 + mask: 0b1110000000000011 + size: 16 + branch: false + delay: 1 + - DII: + encoding: 0b0000000000000000 + mask: 0b1111111111111111 + attributes: [[name:no_cont]] + size: 16 + branch: false + delay: 1 + From a32c83e1be3e65d73e2b8a346db721a891401acf Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 5 Jul 2023 08:32:05 +0200 Subject: [PATCH 2/3] fixes CLI handling of plugin paramters in ISS --- CMakeLists.txt | 14 +++++++++----- src/main.cpp | 16 ++++++++++------ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c5d2d5..2a36dad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,11 +40,15 @@ set(LIB_SOURCES if(TARGET ${CORE_NAME}_cpp) list(APPEND LIB_SOURCES ${${CORE_NAME}_OUTPUT_FILES}) else() - FILE(GLOB GEN_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/src-gen/iss/arch/*.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src-gen/vm/interp/vm_*.cpp - ) - list(APPEND LIB_SOURCES ${GEN_SOURCES}) + FILE(GLOB GEN_ISS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src-gen/iss/arch/*.cpp) + FILE(GLOB GEN_VM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src-gen/vm/interp/vm_*.cpp) + list(APPEND LIB_SOURCES ${GEN_ISS_SOURCES} ${GEN_VM_SOURCES}) + foreach(FILEPATH ${GEN_ISS_SOURCES}) + get_filename_component(CORE ${FILEPATH} NAME_WE) + string(TOUPPER ${CORE} CORE) + list(APPEND LIB_DEFINES CORE_${CORE}) + endforeach() + message("Defines are ${LIB_DEFINES}") endif() if(TARGET RapidJSON OR TARGET RapidJSON::RapidJSON) diff --git a/src/main.cpp b/src/main.cpp index a3999ad..5aeb3f8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,6 +31,8 @@ *******************************************************************************/ #include +#include +#include #include "iss/factory.h" #include @@ -170,27 +172,29 @@ int main(int argc, char *argv[]) { if (clim.count("plugin")) { for (std::string const& opt_val : clim["plugin"].as>()) { std::string plugin_name=opt_val; - std::string filename{"cycles.txt"}; + std::string arg{""}; std::size_t found = opt_val.find('='); if (found != std::string::npos) { plugin_name = opt_val.substr(0, found); - filename = opt_val.substr(found + 1, opt_val.size()); + arg = opt_val.substr(found + 1, opt_val.size()); } if (plugin_name == "ic") { - auto *ic_plugin = new iss::plugin::instruction_count(filename); + auto *ic_plugin = new iss::plugin::instruction_count(arg); vm->register_plugin(*ic_plugin); plugin_list.push_back(ic_plugin); } else if (plugin_name == "ce") { - auto *ce_plugin = new iss::plugin::cycle_estimate(filename); + auto *ce_plugin = new iss::plugin::cycle_estimate(arg); vm->register_plugin(*ce_plugin); plugin_list.push_back(ce_plugin); } else if (plugin_name == "pctrace") { - auto *plugin = new iss::plugin::pctrace(filename); + auto *plugin = new iss::plugin::pctrace(arg); vm->register_plugin(*plugin); plugin_list.push_back(plugin); } else { #ifndef WIN32 - std::array a{{filename.c_str()}}; + std::vector a{}; + if(arg.length()) + a.push_back({arg.c_str()}); iss::plugin::loader l(plugin_name, {{"initPlugin"}}); auto* plugin = l.call_function("initPlugin", a.size(), a.data()); if(plugin){ From 2b094c31620e5108a35e45d81582d56e8f2c9153 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 6 Jul 2023 10:39:59 +0200 Subject: [PATCH 3/3] removes trace compass nature --- .project | 1 - 1 file changed, 1 deletion(-) diff --git a/.project b/.project index 84a8200..395ef36 100644 --- a/.project +++ b/.project @@ -23,6 +23,5 @@ org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.eclipse.linuxtools.tmf.project.nature