update plugins to read YAML file

This commit is contained in:
Eyck Jentzsch 2023-09-30 22:10:24 +02:00
parent b7f023756e
commit b97853ff5a
7 changed files with 171 additions and 175 deletions

View File

@ -53,13 +53,9 @@ if(WITH_TCC)
list(APPEND LIB_SOURCES ${TCC_GEN_SOURCES}) list(APPEND LIB_SOURCES ${TCC_GEN_SOURCES})
endif() endif()
if(TARGET RapidJSON OR TARGET RapidJSON::RapidJSON) if(TARGET yaml-cpp::yaml-cpp)
list(APPEND LIB_SOURCES list(APPEND LIB_SOURCES
src/iss/plugin/cycle_estimate.cpp src/iss/plugin/cycle_estimate.cpp
)
endif()
if(TARGET jsoncpp::jsoncpp)
list(APPEND LIB_SOURCES
src/iss/plugin/instruction_count.cpp src/iss/plugin/instruction_count.cpp
) )
endif() endif()
@ -84,11 +80,9 @@ if(NOT (DBT_CORE_DEFS STREQUAL DBT_CORE_DEFS-NOTFOUND))
endif() endif()
target_link_libraries(${PROJECT_NAME} PUBLIC elfio::elfio softfloat scc-util Boost::coroutine) target_link_libraries(${PROJECT_NAME} PUBLIC elfio::elfio softfloat scc-util Boost::coroutine)
if(TARGET jsoncpp::jsoncpp) if(TARGET yaml-cpp::yaml-cpp)
target_link_libraries(${PROJECT_NAME} PUBLIC jsoncpp::jsoncpp) target_compile_definitions(${PROJECT_NAME} PUBLIC WITH_PLUGINS)
endif() target_link_libraries(${PROJECT_NAME} PUBLIC yaml-cpp::yaml-cpp)
if(TARGET RapidJSON)
target_link_libraries(${PROJECT_NAME} PUBLIC RapidJSON)
endif() endif()
if(WITH_LLVM) if(WITH_LLVM)

View File

@ -1,297 +1,297 @@
RV32I: RV32I:
- LUI: LUI:
encoding: 0b00000000000000000000000000110111 encoding: 0b00000000000000000000000000110111
mask: 0b00000000000000000000000001111111 mask: 0b00000000000000000000000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- AUIPC: AUIPC:
encoding: 0b00000000000000000000000000010111 encoding: 0b00000000000000000000000000010111
mask: 0b00000000000000000000000001111111 mask: 0b00000000000000000000000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- JAL: JAL:
encoding: 0b00000000000000000000000001101111 encoding: 0b00000000000000000000000001101111
mask: 0b00000000000000000000000001111111 mask: 0b00000000000000000000000001111111
size: 32 size: 32
branch: true branch: true
delay: 1 delay: 1
- JALR: JALR:
encoding: 0b00000000000000000000000001100111 encoding: 0b00000000000000000000000001100111
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: true branch: true
delay: 1 delay: [1,1]
- BEQ: BEQ:
encoding: 0b00000000000000000000000001100011 encoding: 0b00000000000000000000000001100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: true branch: true
delay: 1 delay: [1,1]
- BNE: BNE:
encoding: 0b00000000000000000001000001100011 encoding: 0b00000000000000000001000001100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: true branch: true
delay: 1 delay: [1,1]
- BLT: BLT:
encoding: 0b00000000000000000100000001100011 encoding: 0b00000000000000000100000001100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: true branch: true
delay: 1 delay: [1,1]
- BGE: BGE:
encoding: 0b00000000000000000101000001100011 encoding: 0b00000000000000000101000001100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: true branch: true
delay: 1 delay: [1,1]
- BLTU: BLTU:
encoding: 0b00000000000000000110000001100011 encoding: 0b00000000000000000110000001100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: true branch: true
delay: 1 delay: [1,1]
- BGEU: BGEU:
encoding: 0b00000000000000000111000001100011 encoding: 0b00000000000000000111000001100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: true branch: true
delay: 1 delay: [1,1]
- LB: LB:
encoding: 0b00000000000000000000000000000011 encoding: 0b00000000000000000000000000000011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- LH: LH:
encoding: 0b00000000000000000001000000000011 encoding: 0b00000000000000000001000000000011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- LW: LW:
encoding: 0b00000000000000000010000000000011 encoding: 0b00000000000000000010000000000011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- LBU: LBU:
encoding: 0b00000000000000000100000000000011 encoding: 0b00000000000000000100000000000011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- LHU: LHU:
encoding: 0b00000000000000000101000000000011 encoding: 0b00000000000000000101000000000011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SB: SB:
encoding: 0b00000000000000000000000000100011 encoding: 0b00000000000000000000000000100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SH: SH:
encoding: 0b00000000000000000001000000100011 encoding: 0b00000000000000000001000000100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SW: SW:
encoding: 0b00000000000000000010000000100011 encoding: 0b00000000000000000010000000100011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- ADDI: ADDI:
encoding: 0b00000000000000000000000000010011 encoding: 0b00000000000000000000000000010011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SLTI: SLTI:
encoding: 0b00000000000000000010000000010011 encoding: 0b00000000000000000010000000010011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SLTIU: SLTIU:
encoding: 0b00000000000000000011000000010011 encoding: 0b00000000000000000011000000010011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- XORI: XORI:
encoding: 0b00000000000000000100000000010011 encoding: 0b00000000000000000100000000010011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- ORI: ORI:
encoding: 0b00000000000000000110000000010011 encoding: 0b00000000000000000110000000010011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- ANDI: ANDI:
encoding: 0b00000000000000000111000000010011 encoding: 0b00000000000000000111000000010011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SLLI: SLLI:
encoding: 0b00000000000000000001000000010011 encoding: 0b00000000000000000001000000010011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SRLI: SRLI:
encoding: 0b00000000000000000101000000010011 encoding: 0b00000000000000000101000000010011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SRAI: SRAI:
encoding: 0b01000000000000000101000000010011 encoding: 0b01000000000000000101000000010011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- ADD: ADD:
encoding: 0b00000000000000000000000000110011 encoding: 0b00000000000000000000000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SUB: SUB:
encoding: 0b01000000000000000000000000110011 encoding: 0b01000000000000000000000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SLL: SLL:
encoding: 0b00000000000000000001000000110011 encoding: 0b00000000000000000001000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SLT: SLT:
encoding: 0b00000000000000000010000000110011 encoding: 0b00000000000000000010000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SLTU: SLTU:
encoding: 0b00000000000000000011000000110011 encoding: 0b00000000000000000011000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- XOR: XOR:
encoding: 0b00000000000000000100000000110011 encoding: 0b00000000000000000100000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SRL: SRL:
encoding: 0b00000000000000000101000000110011 encoding: 0b00000000000000000101000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- SRA: SRA:
encoding: 0b01000000000000000101000000110011 encoding: 0b01000000000000000101000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- OR: OR:
encoding: 0b00000000000000000110000000110011 encoding: 0b00000000000000000110000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- AND: AND:
encoding: 0b00000000000000000111000000110011 encoding: 0b00000000000000000111000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- FENCE: FENCE:
encoding: 0b00000000000000000000000000001111 encoding: 0b00000000000000000000000000001111
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- ECALL: ECALL:
encoding: 0b00000000000000000000000001110011 encoding: 0b00000000000000000000000001110011
mask: 0b11111111111111111111111111111111 mask: 0b11111111111111111111111111111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- EBREAK: EBREAK:
encoding: 0b00000000000100000000000001110011 encoding: 0b00000000000100000000000001110011
mask: 0b11111111111111111111111111111111 mask: 0b11111111111111111111111111111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- MRET: MRET:
encoding: 0b00110000001000000000000001110011 encoding: 0b00110000001000000000000001110011
mask: 0b11111111111111111111111111111111 mask: 0b11111111111111111111111111111111
attributes: [[name:no_cont]] attributes: [[name:no_cont]]
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- WFI: WFI:
encoding: 0b00010000010100000000000001110011 encoding: 0b00010000010100000000000001110011
mask: 0b11111111111111111111111111111111 mask: 0b11111111111111111111111111111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
Zicsr: Zicsr:
- CSRRW: CSRRW:
encoding: 0b00000000000000000001000001110011 encoding: 0b00000000000000000001000001110011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- CSRRS: CSRRS:
encoding: 0b00000000000000000010000001110011 encoding: 0b00000000000000000010000001110011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- CSRRC: CSRRC:
encoding: 0b00000000000000000011000001110011 encoding: 0b00000000000000000011000001110011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- CSRRWI: CSRRWI:
encoding: 0b00000000000000000101000001110011 encoding: 0b00000000000000000101000001110011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- CSRRSI: CSRRSI:
encoding: 0b00000000000000000110000001110011 encoding: 0b00000000000000000110000001110011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- CSRRCI: CSRRCI:
encoding: 0b00000000000000000111000001110011 encoding: 0b00000000000000000111000001110011
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
Zifencei: Zifencei:
- FENCE_I: FENCE_I:
encoding: 0b00000000000000000001000000001111 encoding: 0b00000000000000000001000000001111
mask: 0b00000000000000000111000001111111 mask: 0b00000000000000000111000001111111
attributes: [[name:flush]] attributes: [[name:flush]]
@ -299,218 +299,231 @@ Zifencei:
branch: false branch: false
delay: 1 delay: 1
RV32M: RV32M:
- MUL: MUL:
encoding: 0b00000010000000000000000000110011 encoding: 0b00000010000000000000000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- MULH: MULH:
encoding: 0b00000010000000000001000000110011 encoding: 0b00000010000000000001000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- MULHSU: MULHSU:
encoding: 0b00000010000000000010000000110011 encoding: 0b00000010000000000010000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- MULHU: MULHU:
encoding: 0b00000010000000000011000000110011 encoding: 0b00000010000000000011000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- DIV: DIV:
encoding: 0b00000010000000000100000000110011 encoding: 0b00000010000000000100000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- DIVU: DIVU:
encoding: 0b00000010000000000101000000110011 encoding: 0b00000010000000000101000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- REM: REM:
encoding: 0b00000010000000000110000000110011 encoding: 0b00000010000000000110000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
- REMU: REMU:
encoding: 0b00000010000000000111000000110011 encoding: 0b00000010000000000111000000110011
mask: 0b11111110000000000111000001111111 mask: 0b11111110000000000111000001111111
size: 32 size: 32
branch: false branch: false
delay: 1 delay: 1
RV32IC: RV32IC:
- CADDI4SPN: C__ADDI4SPN:
encoding: 0b0000000000000000 encoding: 0b0000000000000000
mask: 0b1110000000000011 mask: 0b1110000000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CLW: C__LW:
encoding: 0b0100000000000000 encoding: 0b0100000000000000
mask: 0b1110000000000011 mask: 0b1110000000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CSW: C__SW:
encoding: 0b1100000000000000 encoding: 0b1100000000000000
mask: 0b1110000000000011 mask: 0b1110000000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CADDI: C__ADDI:
encoding: 0b0000000000000001 encoding: 0b0000000000000001
mask: 0b1110000000000011 mask: 0b1110000000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CNOP: C__NOP:
encoding: 0b0000000000000001 encoding: 0b0000000000000001
mask: 0b1110111110000011 mask: 0b1110111110000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CJAL: C__JAL:
encoding: 0b0010000000000001 encoding: 0b0010000000000001
mask: 0b1110000000000011 mask: 0b1110000000000011
size: 16 size: 16
branch: true branch: true
delay: 1 delay: 1
- CLI: C__LI:
encoding: 0b0100000000000001 encoding: 0b0100000000000001
mask: 0b1110000000000011 mask: 0b1110000000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CLUI: C__LUI:
encoding: 0b0110000000000001 encoding: 0b0110000000000001
mask: 0b1110000000000011 mask: 0b1110000000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CADDI16SP: C__ADDI16SP:
encoding: 0b0110000100000001 encoding: 0b0110000100000001
mask: 0b1110111110000011 mask: 0b1110111110000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CSRLI: __reserved_clui:
encoding: 0b0110000000000001
mask: 0b1111000001111111
size: 16
branch: false
delay: 1
C__SRLI:
encoding: 0b1000000000000001 encoding: 0b1000000000000001
mask: 0b1111110000000011 mask: 0b1111110000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CSRAI: C__SRAI:
encoding: 0b1000010000000001 encoding: 0b1000010000000001
mask: 0b1111110000000011 mask: 0b1111110000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CANDI: C__ANDI:
encoding: 0b1000100000000001 encoding: 0b1000100000000001
mask: 0b1110110000000011 mask: 0b1110110000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CSUB: C__SUB:
encoding: 0b1000110000000001 encoding: 0b1000110000000001
mask: 0b1111110001100011 mask: 0b1111110001100011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CXOR: C__XOR:
encoding: 0b1000110000100001 encoding: 0b1000110000100001
mask: 0b1111110001100011 mask: 0b1111110001100011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- COR: C__OR:
encoding: 0b1000110001000001 encoding: 0b1000110001000001
mask: 0b1111110001100011 mask: 0b1111110001100011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CAND: C__AND:
encoding: 0b1000110001100001 encoding: 0b1000110001100001
mask: 0b1111110001100011 mask: 0b1111110001100011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CJ: C__J:
encoding: 0b1010000000000001 encoding: 0b1010000000000001
mask: 0b1110000000000011 mask: 0b1110000000000011
size: 16 size: 16
branch: true branch: true
delay: 1 delay: 1
- CBEQZ: C__BEQZ:
encoding: 0b1100000000000001 encoding: 0b1100000000000001
mask: 0b1110000000000011 mask: 0b1110000000000011
size: 16 size: 16
branch: true branch: true
delay: 1 delay: [1,1]
- CBNEZ: C__BNEZ:
encoding: 0b1110000000000001 encoding: 0b1110000000000001
mask: 0b1110000000000011 mask: 0b1110000000000011
size: 16 size: 16
branch: true branch: true
delay: 1 delay: [1,1]
- CSLLI: C__SLLI:
encoding: 0b0000000000000010 encoding: 0b0000000000000010
mask: 0b1111000000000011 mask: 0b1111000000000011
attributes: [[name:enable, value:1]]
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CLWSP: C__LWSP:
encoding: 0b0100000000000010 encoding: 0b0100000000000010
mask: 0b1110000000000011 mask: 0b1110000000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CMV: C__MV:
encoding: 0b1000000000000010 encoding: 0b1000000000000010
mask: 0b1111000000000011 mask: 0b1111000000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CJR: C__JR:
encoding: 0b1000000000000010 encoding: 0b1000000000000010
mask: 0b1111000001111111 mask: 0b1111000001111111
size: 16 size: 16
branch: true branch: true
delay: 1 delay: 1
- CADD: __reserved_cmv:
encoding: 0b1000000000000010
mask: 0b1111111111111111
size: 16
branch: false
delay: 1
C__ADD:
encoding: 0b1001000000000010 encoding: 0b1001000000000010
mask: 0b1111000000000011 mask: 0b1111000000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CJALR: C__JALR:
encoding: 0b1001000000000010 encoding: 0b1001000000000010
mask: 0b1111000001111111 mask: 0b1111000001111111
size: 16 size: 16
branch: true branch: true
delay: 1 delay: 1
- CEBREAK: C__EBREAK:
encoding: 0b1001000000000010 encoding: 0b1001000000000010
mask: 0b1111111111111111 mask: 0b1111111111111111
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- CSWSP: C__SWSP:
encoding: 0b1100000000000010 encoding: 0b1100000000000010
mask: 0b1110000000000011 mask: 0b1110000000000011
size: 16 size: 16
branch: false branch: false
delay: 1 delay: 1
- DII: DII:
encoding: 0b0000000000000000 encoding: 0b0000000000000000
mask: 0b1111111111111111 mask: 0b1111111111111111
size: 16 size: 16

View File

@ -9,8 +9,8 @@
} }
instrGroups instrGroups
}%><%getInstructionGroups().each{name, instrList -> %> }%><%getInstructionGroups().each{name, instrList -> %>
${name}: <% instrList.findAll{!it.instruction.name.startsWith("__")}.each { %> ${name}: <% instrList.each { %>
- ${it.instruction.name}: ${it.instruction.name}:
encoding: ${it.encoding} encoding: ${it.encoding}
mask: ${it.mask}<%if(it.attributes.size) {%> mask: ${it.mask}<%if(it.attributes.size) {%>
attributes: ${it.attributes}<%}%> attributes: ${it.attributes}<%}%>

View File

@ -33,18 +33,12 @@
******************************************************************************/ ******************************************************************************/
#include "cycle_estimate.h" #include "cycle_estimate.h"
#include <yaml-cpp/yaml.h>
#include <iss/arch_if.h> #include <iss/arch_if.h>
#include <util/logging.h> #include <util/logging.h>
#include <rapidjson/document.h>
#include <rapidjson/istreamwrapper.h>
#include <rapidjson/writer.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/ostreamwrapper.h>
#include <rapidjson/error/en.h>
#include <fstream> #include <fstream>
using namespace rapidjson;
using namespace std; using namespace std;
iss::plugin::cycle_estimate::cycle_estimate(string const& config_file_name) iss::plugin::cycle_estimate::cycle_estimate(string const& config_file_name)
@ -61,40 +55,31 @@ bool iss::plugin::cycle_estimate::registration(const char* const version, vm_if&
if(!instr_if) return false; if(!instr_if) return false;
const string core_name = instr_if->core_type_name(); const string core_name = instr_if->core_type_name();
if (config_file_name.length() > 0) { if (config_file_name.length() > 0) {
ifstream is(config_file_name); std::ifstream is(config_file_name);
if (is.is_open()) { if (is.is_open()) {
try { try {
IStreamWrapper isw(is); auto root = YAML::LoadAll(is);
Document d; if(root.size()!=1) {
ParseResult ok = d.ParseStream(isw); LOG(ERR) << "Too many rro nodes in YAML file " << config_file_name;
if(ok) { }
Value& val = d[core_name.c_str()]; for (auto p : root[0]) {
if(val.IsArray()){ auto isa_subset = p.first;
delays.reserve(val.Size()); auto instructions = p.second;
for (auto it = val.Begin(); it != val.End(); ++it) { for (auto const& instr : instructions) {
auto& name = (*it)["name"]; instr_desc res;
auto& size = (*it)["size"]; res.is_branch = instr.second["branch"].as<bool>();
auto& delay = (*it)["delay"]; auto delay = instr.second["delay"];
auto& branch = (*it)["branch"]; if(delay.IsSequence()) {
if(delay.IsArray()) { res.not_taken = delay[0].as<uint64_t>();
auto dt = delay[0].Get<unsigned>(); res.taken = delay[1].as<uint64_t>();
auto dnt = delay[1].Get<unsigned>(); } else {
delays.push_back(instr_desc{size.Get<unsigned>(), dt, dnt, branch.Get<bool>()}); res.not_taken = delay.as<uint64_t>();
} else if(delay.Is<unsigned>()) { res.taken = res.not_taken;
auto d = delay.Get<unsigned>(); }
delays.push_back(instr_desc{size.Get<unsigned>(), d, d, branch.Get<bool>()}); delays.push_back(std::move(res));
} else }
throw runtime_error("JSON parse error"); }
} } catch (YAML::ParserException &e) {
} else {
LOG(ERR)<<"plugin cycle_estimate: could not find an entry for "<<core_name<<" in JSON file"<<endl;
return false;
}
} else {
LOG(ERR)<<"plugin cycle_estimate: could not parse in JSON file at "<< ok.Offset()<<": "<<GetParseError_En(ok.Code())<<endl;
return false;
}
} catch (runtime_error &e) {
LOG(ERR) << "Could not parse input file " << config_file_name << ", reason: " << e.what(); LOG(ERR) << "Could not parse input file " << config_file_name << ", reason: " << e.what();
return false; return false;
} }

View File

@ -34,6 +34,7 @@
#include "instruction_count.h" #include "instruction_count.h"
#include <iss/instrumentation_if.h> #include <iss/instrumentation_if.h>
#include <yaml-cpp/yaml.h>
#include <iss/arch_if.h> #include <iss/arch_if.h>
#include <util/logging.h> #include <util/logging.h>
@ -44,8 +45,30 @@ iss::plugin::instruction_count::instruction_count(std::string config_file_name)
std::ifstream is(config_file_name); std::ifstream is(config_file_name);
if (is.is_open()) { if (is.is_open()) {
try { try {
is >> root; auto root = YAML::LoadAll(is);
} catch (Json::RuntimeError &e) { if(root.size()!=1) {
LOG(ERR) << "Too many rro nodes in YAML file " << config_file_name;
}
for (auto p : root[0]) {
auto isa_subset = p.first;
auto instructions = p.second;
for (auto const& instr : instructions) {
instr_delay res;
res.instr_name = instr.first.as<std::string>();
res.size = instr.second["encoding"].as<std::string>().size()-2; // not counting 0b
auto delay = instr.second["delay"];
if(delay.IsSequence()) {
res.not_taken_delay = delay[0].as<uint64_t>();
res.taken_delay = delay[1].as<uint64_t>();
} else {
res.not_taken_delay = delay.as<uint64_t>();
res.taken_delay = res.not_taken_delay;
}
delays.push_back(std::move(res));
}
}
rep_counts.resize(delays.size());
} catch (YAML::ParserException &e) {
LOG(ERR) << "Could not parse input file " << config_file_name << ", reason: " << e.what(); LOG(ERR) << "Could not parse input file " << config_file_name << ", reason: " << e.what();
} }
} else { } else {
@ -57,7 +80,7 @@ iss::plugin::instruction_count::instruction_count(std::string config_file_name)
iss::plugin::instruction_count::~instruction_count() { iss::plugin::instruction_count::~instruction_count() {
size_t idx=0; size_t idx=0;
for(auto it:delays){ for(auto it:delays){
if(rep_counts[idx]>0) if(rep_counts[idx]>0 && it.instr_name.find("__"!=0))
LOG(INFO)<<it.instr_name<<";"<<rep_counts[idx]; LOG(INFO)<<it.instr_name<<";"<<rep_counts[idx];
idx++; idx++;
} }
@ -66,27 +89,6 @@ iss::plugin::instruction_count::~instruction_count() {
bool iss::plugin::instruction_count::registration(const char* const version, vm_if& vm) { bool iss::plugin::instruction_count::registration(const char* const version, vm_if& vm) {
auto instr_if = vm.get_arch()->get_instrumentation_if(); auto instr_if = vm.get_arch()->get_instrumentation_if();
if(!instr_if) return false; if(!instr_if) return false;
const std::string core_name = instr_if->core_type_name();
Json::Value &val = root[core_name];
if(!val.isNull() && val.isArray()){
delays.reserve(val.size());
for(auto it:val){
auto name = it["name"];
auto size = it["size"];
auto delay = it["delay"];
if(!name.isString() || !size.isUInt() || !(delay.isUInt() || delay.isArray())) throw std::runtime_error("JSON parse error");
if(delay.isUInt()){
const instr_delay entry{name.asCString(), size.asUInt(), delay.asUInt(), 0};
delays.push_back(entry);
} else {
const instr_delay entry{name.asCString(), size.asUInt(), delay[0].asUInt(), delay[1].asUInt()};
delays.push_back(entry);
}
}
rep_counts.resize(delays.size());
} else {
LOG(ERR)<<"plugin instruction_count: could not find an entry for "<<core_name<<" in JSON file"<<std::endl;
}
return true; return true;
} }

View File

@ -36,8 +36,8 @@
#define _ISS_PLUGIN_INSTRUCTION_COUNTER_H_ #define _ISS_PLUGIN_INSTRUCTION_COUNTER_H_
#include <iss/vm_plugin.h> #include <iss/vm_plugin.h>
#include <json/json.h>
#include <string> #include <string>
#include <vector>
namespace iss { namespace iss {
namespace plugin { namespace plugin {
@ -72,7 +72,6 @@ public:
void callback(instr_info_t) override; void callback(instr_info_t) override;
private: private:
Json::Value root;
std::vector<instr_delay> delays; std::vector<instr_delay> delays;
std::vector<uint64_t> rep_counts; std::vector<uint64_t> rep_counts;
}; };

View File

@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {
("mem,m", po::value<std::string>(), "the memory input file") ("mem,m", po::value<std::string>(), "the memory input file")
("plugin,p", po::value<std::vector<std::string>>(), "plugin to activate") ("plugin,p", po::value<std::vector<std::string>>(), "plugin to activate")
("backend", po::value<std::string>()->default_value("interp"), "the ISS backend to use, options are: interp, tcc") ("backend", po::value<std::string>()->default_value("interp"), "the ISS backend to use, options are: interp, tcc")
("isa", po::value<std::string>()->default_value("tgc5c"), "isa to use for simulation"); ("isa", po::value<std::string>()->default_value("tgc5c"), "core or isa name to use for simulation, use '?' to get list");
// clang-format on // clang-format on
auto parsed = po::command_line_parser(argc, argv).options(desc).allow_unregistered().run(); auto parsed = po::command_line_parser(argc, argv).options(desc).allow_unregistered().run();
try { try {
@ -124,7 +124,7 @@ int main(int argc, char *argv[]) {
std::tie(cpu, vm) = f.create(isa_opt+"|"+clim["backend"].as<std::string>(), clim["gdb-port"].as<unsigned>()); std::tie(cpu, vm) = f.create(isa_opt+"|"+clim["backend"].as<std::string>(), clim["gdb-port"].as<unsigned>());
} else { } else {
auto base_isa = isa_opt.substr(0, 5); auto base_isa = isa_opt.substr(0, 5);
if(base_isa=="tgc_d" || base_isa=="tgc_e") { if(base_isa=="tgc5d" || base_isa=="tgc5e") {
isa_opt += "|mu_p_clic_pmp|"+clim["backend"].as<std::string>(); isa_opt += "|mu_p_clic_pmp|"+clim["backend"].as<std::string>();
} else { } else {
isa_opt += "|m_p|"+clim["backend"].as<std::string>(); isa_opt += "|m_p|"+clim["backend"].as<std::string>();
@ -148,6 +148,7 @@ int main(int argc, char *argv[]) {
plugin_name = opt_val.substr(0, found); plugin_name = opt_val.substr(0, found);
arg = opt_val.substr(found + 1, opt_val.size()); arg = opt_val.substr(found + 1, opt_val.size());
} }
#if defined(WITH_PLUGINS)
if (plugin_name == "ic") { if (plugin_name == "ic") {
auto *ic_plugin = new iss::plugin::instruction_count(arg); auto *ic_plugin = new iss::plugin::instruction_count(arg);
vm->register_plugin(*ic_plugin); vm->register_plugin(*ic_plugin);
@ -156,8 +157,10 @@ int main(int argc, char *argv[]) {
auto *ce_plugin = new iss::plugin::cycle_estimate(arg); auto *ce_plugin = new iss::plugin::cycle_estimate(arg);
vm->register_plugin(*ce_plugin); vm->register_plugin(*ce_plugin);
plugin_list.push_back(ce_plugin); plugin_list.push_back(ce_plugin);
}else { } else
#ifndef WIN32 #endif
{
#if !defined(WIN32)
std::vector<char const*> a{}; std::vector<char const*> a{};
if(arg.length()) if(arg.length())
a.push_back({arg.c_str()}); a.push_back({arg.c_str()});