diff --git a/ArchImpl/CMakeLists.txt b/ArchImpl/CMakeLists.txt index 54494790e7..ae497633b8 100644 --- a/ArchImpl/CMakeLists.txt +++ b/ArchImpl/CMakeLists.txt @@ -42,3 +42,4 @@ ADD_SUBDIRECTORY(RV32IMACFD) ADD_SUBDIRECTORY(RV64IMACFD) ADD_SUBDIRECTORY(RV32IMACFDXCoreV) ADD_SUBDIRECTORY(RV32IMAFDXCoreVHwlp) +ADD_SUBDIRECTORY(RV32IMAFDXCoreVHwlpV0) diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/CMakeLists.txt b/ArchImpl/RV32IMAFDXCoreVHwlpV0/CMakeLists.txt new file mode 100644 index 0000000000..00a0b54372 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/CMakeLists.txt @@ -0,0 +1,42 @@ +# Generated on Fri, 17 Nov 2023 19:17:42 +0100. +# +# This file contains the CMake build info for the RV32IMAFDXCoreVHwlpV0 core architecture. + +PROJECT(RV32IMAFDXCoreVHwlpV0) + +SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../../include/jit/etiss/jit") + +ADD_LIBRARY(${PROJECT_NAME} SHARED + RV32IMAFDXCoreVHwlpV0Arch.cpp + RV32IMAFDXCoreVHwlpV0ArchLib.cpp + RV32IMAFDXCoreVHwlpV0ArchSpecificImp.cpp + RV32IMAFDXCoreVHwlpV0Instr.cpp + RV32IMAFDXCoreVHwlpV0_RV32IInstr.cpp + RV32IMAFDXCoreVHwlpV0_RV32MInstr.cpp + RV32IMAFDXCoreVHwlpV0_RV32FInstr.cpp + RV32IMAFDXCoreVHwlpV0_RV32DInstr.cpp + RV32IMAFDXCoreVHwlpV0_ZifenceiInstr.cpp + RV32IMAFDXCoreVHwlpV0_XCoreVSimdInstr.cpp + RV32IMAFDXCoreVHwlpV0_XCoreVBitmanipInstr.cpp + RV32IMAFDXCoreVHwlpV0_XCoreVAluInstr.cpp + RV32IMAFDXCoreVHwlpV0_XCoreVBranchImmediateInstr.cpp + RV32IMAFDXCoreVHwlpV0_XCoreVMemInstr.cpp + RV32IMAFDXCoreVHwlpV0_XCoreVMacInstr.cpp + RV32IMAFDXCoreVHwlpV0_XCoreVHwlpV0Instr.cpp + RV32IMAFDXCoreVHwlpV0_tum_csrInstr.cpp + RV32IMAFDXCoreVHwlpV0_tum_retInstr.cpp + RV32IMAFDXCoreVHwlpV0_RV32AInstr.cpp + RV32IMAFDXCoreVHwlpV0_tum_rvaInstr.cpp + RV32IMAFDXCoreVHwlpV0_tum_semihostingInstr.cpp +) + +add_custom_command( + TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Funcs.h" + "${ETISS_BINARY_DIR}/include/jit/Arch/${PROJECT_NAME}" +) +INSTALL(FILES "${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Funcs.h" DESTINATION "include/jit/Arch/${PROJECT_NAME}") + +ETISSPluginArch(${PROJECT_NAME}) \ No newline at end of file diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0.h b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0.h new file mode 100644 index 0000000000..2da03ba179 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0.h @@ -0,0 +1,77 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the registers for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#ifndef ETISS_RV32IMAFDXCoreVHwlpV0Arch_RV32IMAFDXCoreVHwlpV0_H_ +#define ETISS_RV32IMAFDXCoreVHwlpV0Arch_RV32IMAFDXCoreVHwlpV0_H_ +#include +#include "etiss/jit/CPU.h" + +#ifdef __cplusplus +extern "C" { +#endif +#pragma pack(push, 1) +struct RV32IMAFDXCoreVHwlpV0 { + ETISS_CPU cpu; // original cpu struct must be defined as the first field of the new structure. this allows to cast X * to ETISS_CPU * and vice vers + etiss_uint32 ZERO; + etiss_uint32 RA; + etiss_uint32 SP; + etiss_uint32 GP; + etiss_uint32 TP; + etiss_uint32 T0; + etiss_uint32 T1; + etiss_uint32 T2; + etiss_uint32 S0; + etiss_uint32 S1; + etiss_uint32 A0; + etiss_uint32 A1; + etiss_uint32 A2; + etiss_uint32 A3; + etiss_uint32 A4; + etiss_uint32 A5; + etiss_uint32 A6; + etiss_uint32 A7; + etiss_uint32 S2; + etiss_uint32 S3; + etiss_uint32 S4; + etiss_uint32 S5; + etiss_uint32 S6; + etiss_uint32 S7; + etiss_uint32 S8; + etiss_uint32 S9; + etiss_uint32 S10; + etiss_uint32 S11; + etiss_uint32 T3; + etiss_uint32 T4; + etiss_uint32 T5; + etiss_uint32 T6; + etiss_uint32 *X[32]; + etiss_uint32 ins_X[32]; + etiss_uint32 FENCE[8]; + etiss_uint8 RES[8]; + etiss_uint8 PRIV; + etiss_uint32 DPC; + etiss_uint32 FCSR; + etiss_uint32 lpstart_0; + etiss_uint32 lpend_0; + etiss_uint32 lpcount_0; + etiss_uint32 lpstart_1; + etiss_uint32 lpend_1; + etiss_uint32 lpcount_1; + etiss_uint32 MSTATUS; + etiss_uint32 MIE; + etiss_uint32 MIP; + etiss_uint32 *CSR[4096]; + etiss_uint32 ins_CSR[4096]; + etiss_uint64 F[32]; + etiss_uint32 RES_ADDR; +}; + +#pragma pack(pop) // undo changes +typedef struct RV32IMAFDXCoreVHwlpV0 RV32IMAFDXCoreVHwlpV0; // convenient use of X instead of struct X in generated C code +#ifdef __cplusplus +} // extern "C" +#endif +#endif diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Arch.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Arch.cpp new file mode 100644 index 0000000000..8b4cad3852 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Arch.cpp @@ -0,0 +1,278 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the architecture class for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +/********************************************************************************************************************************* + +* Modification guidelines: + + 1. The initial value of SP register should be initialized by ctr0.S/board.S. If not, it could be initialized + through utility class etiss::VirtualStruct::Field. + + 2. Debug mode print out all assignment results. GDB in 8 is prefered. + + 3. Manually copy the content in bracket ["return ETISS_RETURNCODE_CPUFINISHED; \n"] to terminating instruction, + otherwise the emulation can not be ended. + + 4. If subset of encoding error occurs, it means the format of the encoding in the input model was not appropriate + + 5. If the PC register points to wrong address, please notice that some assembly may cause branch operation + implicitly such as "MOV Rd Rn" in ARMv6-M + + 6. If a variable is the result of dynamic slicing such as, var_1 = var_2, the size would be + calculated during process (if possible), otherwise it is assumed to be the register size. Problems may occur when + var_1 encounters bit manipulation such as "~" due to bit expansion. To change the nml model with explicit slicing + e.g var_1 = val_2<3..0> or avoid bit manipulation for dynamic sliced variable. Otherwise, you have to manually + correct it. + + 7. Implementation dependent functionalities such as exception handling should be manully added. Corresponding interfaces + are provided in RV32IMAFDXCoreVHwlpV0ArchSpecificImp.h + + 8. RV32IMAFDXCoreVHwlpV0GDBCore.h provides the GDBCore class to support gdb flavor debugging feature, modify iy if in need. + + *********************************************************************************************************************************/ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +#define RV32IMAFDXCoreVHwlpV0_DEBUG_CALL 0 +using namespace etiss ; +using namespace etiss::instr ; + +RV32IMAFDXCoreVHwlpV0Arch::RV32IMAFDXCoreVHwlpV0Arch():CPUArch("RV32IMAFDXCoreVHwlpV0") +{ + headers_.insert("Arch/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0.h"); +} + +const std::set & RV32IMAFDXCoreVHwlpV0Arch::getListenerSupportedRegisters() +{ + return listenerSupportedRegisters_; +} + +ETISS_CPU * RV32IMAFDXCoreVHwlpV0Arch::newCPU() +{ + ETISS_CPU * ret = (ETISS_CPU *) new RV32IMAFDXCoreVHwlpV0() ; + resetCPU (ret, 0); + return ret; +} + +void RV32IMAFDXCoreVHwlpV0Arch::resetCPU(ETISS_CPU * cpu,etiss::uint64 * startpointer) +{ + memset (cpu, 0, sizeof(RV32IMAFDXCoreVHwlpV0)); + RV32IMAFDXCoreVHwlpV0 * rv32imafdxcorevhwlpv0cpu = (RV32IMAFDXCoreVHwlpV0 *) cpu; + + if (startpointer) cpu->instructionPointer = *startpointer & ~((etiss::uint64)0x1); + else cpu->instructionPointer = 0x0; // reference to manual + cpu->nextPc = cpu->instructionPointer; + cpu->mode = 1; + cpu->cpuTime_ps = 0; + cpu->cpuCycleTime_ps = 31250; + + + for (int i = 0; i < 32; ++i) { + rv32imafdxcorevhwlpv0cpu->ins_X[i] = 0; + rv32imafdxcorevhwlpv0cpu->X[i] = &rv32imafdxcorevhwlpv0cpu->ins_X[i]; + } + for (int i = 0; i < 4096; ++i) { + rv32imafdxcorevhwlpv0cpu->ins_CSR[i] = 0; + rv32imafdxcorevhwlpv0cpu->CSR[i] = &rv32imafdxcorevhwlpv0cpu->ins_CSR[i]; + } + + rv32imafdxcorevhwlpv0cpu->ZERO = 0; + rv32imafdxcorevhwlpv0cpu->RA = 0; + rv32imafdxcorevhwlpv0cpu->SP = 0; + rv32imafdxcorevhwlpv0cpu->GP = 0; + rv32imafdxcorevhwlpv0cpu->TP = 0; + rv32imafdxcorevhwlpv0cpu->T0 = 0; + rv32imafdxcorevhwlpv0cpu->T1 = 0; + rv32imafdxcorevhwlpv0cpu->T2 = 0; + rv32imafdxcorevhwlpv0cpu->S0 = 0; + rv32imafdxcorevhwlpv0cpu->S1 = 0; + rv32imafdxcorevhwlpv0cpu->A0 = 0; + rv32imafdxcorevhwlpv0cpu->A1 = 0; + rv32imafdxcorevhwlpv0cpu->A2 = 0; + rv32imafdxcorevhwlpv0cpu->A3 = 0; + rv32imafdxcorevhwlpv0cpu->A4 = 0; + rv32imafdxcorevhwlpv0cpu->A5 = 0; + rv32imafdxcorevhwlpv0cpu->A6 = 0; + rv32imafdxcorevhwlpv0cpu->A7 = 0; + rv32imafdxcorevhwlpv0cpu->S2 = 0; + rv32imafdxcorevhwlpv0cpu->S3 = 0; + rv32imafdxcorevhwlpv0cpu->S4 = 0; + rv32imafdxcorevhwlpv0cpu->S5 = 0; + rv32imafdxcorevhwlpv0cpu->S6 = 0; + rv32imafdxcorevhwlpv0cpu->S7 = 0; + rv32imafdxcorevhwlpv0cpu->S8 = 0; + rv32imafdxcorevhwlpv0cpu->S9 = 0; + rv32imafdxcorevhwlpv0cpu->S10 = 0; + rv32imafdxcorevhwlpv0cpu->S11 = 0; + rv32imafdxcorevhwlpv0cpu->T3 = 0; + rv32imafdxcorevhwlpv0cpu->T4 = 0; + rv32imafdxcorevhwlpv0cpu->T5 = 0; + rv32imafdxcorevhwlpv0cpu->T6 = 0; + for (int i = 0; i < 8; ++i) { + rv32imafdxcorevhwlpv0cpu->FENCE[i] = 0; + } + for (int i = 0; i < 8; ++i) { + rv32imafdxcorevhwlpv0cpu->RES[i] = 0; + } + rv32imafdxcorevhwlpv0cpu->PRIV = 0; + rv32imafdxcorevhwlpv0cpu->DPC = 0; + rv32imafdxcorevhwlpv0cpu->FCSR = 0; + rv32imafdxcorevhwlpv0cpu->lpstart_0 = 0; + rv32imafdxcorevhwlpv0cpu->lpend_0 = 0; + rv32imafdxcorevhwlpv0cpu->lpcount_0 = 0; + rv32imafdxcorevhwlpv0cpu->lpstart_1 = 0; + rv32imafdxcorevhwlpv0cpu->lpend_1 = 0; + rv32imafdxcorevhwlpv0cpu->lpcount_1 = 0; + rv32imafdxcorevhwlpv0cpu->MSTATUS = 0; + rv32imafdxcorevhwlpv0cpu->MIE = 0; + rv32imafdxcorevhwlpv0cpu->MIP = 0; + for (int i = 0; i < 32; ++i) { + rv32imafdxcorevhwlpv0cpu->F[i] = 0; + } + rv32imafdxcorevhwlpv0cpu->RES_ADDR = 0; + + rv32imafdxcorevhwlpv0cpu->X[0] = &rv32imafdxcorevhwlpv0cpu->ZERO; + rv32imafdxcorevhwlpv0cpu->X[1] = &rv32imafdxcorevhwlpv0cpu->RA; + rv32imafdxcorevhwlpv0cpu->X[2] = &rv32imafdxcorevhwlpv0cpu->SP; + rv32imafdxcorevhwlpv0cpu->X[3] = &rv32imafdxcorevhwlpv0cpu->GP; + rv32imafdxcorevhwlpv0cpu->X[4] = &rv32imafdxcorevhwlpv0cpu->TP; + rv32imafdxcorevhwlpv0cpu->X[5] = &rv32imafdxcorevhwlpv0cpu->T0; + rv32imafdxcorevhwlpv0cpu->X[6] = &rv32imafdxcorevhwlpv0cpu->T1; + rv32imafdxcorevhwlpv0cpu->X[7] = &rv32imafdxcorevhwlpv0cpu->T2; + rv32imafdxcorevhwlpv0cpu->X[8] = &rv32imafdxcorevhwlpv0cpu->S0; + rv32imafdxcorevhwlpv0cpu->X[9] = &rv32imafdxcorevhwlpv0cpu->S1; + rv32imafdxcorevhwlpv0cpu->X[10] = &rv32imafdxcorevhwlpv0cpu->A0; + rv32imafdxcorevhwlpv0cpu->X[11] = &rv32imafdxcorevhwlpv0cpu->A1; + rv32imafdxcorevhwlpv0cpu->X[12] = &rv32imafdxcorevhwlpv0cpu->A2; + rv32imafdxcorevhwlpv0cpu->X[13] = &rv32imafdxcorevhwlpv0cpu->A3; + rv32imafdxcorevhwlpv0cpu->X[14] = &rv32imafdxcorevhwlpv0cpu->A4; + rv32imafdxcorevhwlpv0cpu->X[15] = &rv32imafdxcorevhwlpv0cpu->A5; + rv32imafdxcorevhwlpv0cpu->X[16] = &rv32imafdxcorevhwlpv0cpu->A6; + rv32imafdxcorevhwlpv0cpu->X[17] = &rv32imafdxcorevhwlpv0cpu->A7; + rv32imafdxcorevhwlpv0cpu->X[18] = &rv32imafdxcorevhwlpv0cpu->S2; + rv32imafdxcorevhwlpv0cpu->X[19] = &rv32imafdxcorevhwlpv0cpu->S3; + rv32imafdxcorevhwlpv0cpu->X[20] = &rv32imafdxcorevhwlpv0cpu->S4; + rv32imafdxcorevhwlpv0cpu->X[21] = &rv32imafdxcorevhwlpv0cpu->S5; + rv32imafdxcorevhwlpv0cpu->X[22] = &rv32imafdxcorevhwlpv0cpu->S6; + rv32imafdxcorevhwlpv0cpu->X[23] = &rv32imafdxcorevhwlpv0cpu->S7; + rv32imafdxcorevhwlpv0cpu->X[24] = &rv32imafdxcorevhwlpv0cpu->S8; + rv32imafdxcorevhwlpv0cpu->X[25] = &rv32imafdxcorevhwlpv0cpu->S9; + rv32imafdxcorevhwlpv0cpu->X[26] = &rv32imafdxcorevhwlpv0cpu->S10; + rv32imafdxcorevhwlpv0cpu->X[27] = &rv32imafdxcorevhwlpv0cpu->S11; + rv32imafdxcorevhwlpv0cpu->X[28] = &rv32imafdxcorevhwlpv0cpu->T3; + rv32imafdxcorevhwlpv0cpu->X[29] = &rv32imafdxcorevhwlpv0cpu->T4; + rv32imafdxcorevhwlpv0cpu->X[30] = &rv32imafdxcorevhwlpv0cpu->T5; + rv32imafdxcorevhwlpv0cpu->X[31] = &rv32imafdxcorevhwlpv0cpu->T6; + rv32imafdxcorevhwlpv0cpu->CSR[3] = &rv32imafdxcorevhwlpv0cpu->FCSR; + rv32imafdxcorevhwlpv0cpu->CSR[3264] = &rv32imafdxcorevhwlpv0cpu->lpstart_0; + rv32imafdxcorevhwlpv0cpu->CSR[3265] = &rv32imafdxcorevhwlpv0cpu->lpend_0; + rv32imafdxcorevhwlpv0cpu->CSR[3266] = &rv32imafdxcorevhwlpv0cpu->lpcount_0; + rv32imafdxcorevhwlpv0cpu->CSR[3268] = &rv32imafdxcorevhwlpv0cpu->lpstart_1; + rv32imafdxcorevhwlpv0cpu->CSR[3269] = &rv32imafdxcorevhwlpv0cpu->lpend_1; + rv32imafdxcorevhwlpv0cpu->CSR[3270] = &rv32imafdxcorevhwlpv0cpu->lpcount_1; + rv32imafdxcorevhwlpv0cpu->CSR[768] = &rv32imafdxcorevhwlpv0cpu->MSTATUS; + rv32imafdxcorevhwlpv0cpu->CSR[772] = &rv32imafdxcorevhwlpv0cpu->MIE; + rv32imafdxcorevhwlpv0cpu->CSR[836] = &rv32imafdxcorevhwlpv0cpu->MIP; + + rv32imafdxcorevhwlpv0cpu->PRIV = 3; + rv32imafdxcorevhwlpv0cpu->DPC = 0; + *rv32imafdxcorevhwlpv0cpu->CSR[0] = 11; + *rv32imafdxcorevhwlpv0cpu->CSR[256] = 11; + *rv32imafdxcorevhwlpv0cpu->CSR[768] = 11; + *rv32imafdxcorevhwlpv0cpu->CSR[769] = 1075056941; + *rv32imafdxcorevhwlpv0cpu->CSR[3088] = 3; + *rv32imafdxcorevhwlpv0cpu->CSR[772] = 4294966203; + *rv32imafdxcorevhwlpv0cpu->CSR[260] = 4294964019; + *rv32imafdxcorevhwlpv0cpu->CSR[4] = 4294963473; + rv32imafdxcorevhwlpv0cpu->RES_ADDR = -1; +} + +void RV32IMAFDXCoreVHwlpV0Arch::deleteCPU(ETISS_CPU *cpu) +{ + delete (RV32IMAFDXCoreVHwlpV0 *) cpu ; +} + +/** + @return 8 (jump instruction + instruction of delay slot) +*/ +unsigned RV32IMAFDXCoreVHwlpV0Arch::getMaximumInstructionSizeInBytes() +{ + return 8; +} + +/** + @return 2 +*/ +unsigned RV32IMAFDXCoreVHwlpV0Arch::getInstructionSizeInBytes() +{ + return 2; +} + +/** + @brief required headers (RV32IMAFDXCoreVHwlpV0.h) +*/ +const std::set & RV32IMAFDXCoreVHwlpV0Arch::getHeaders() const +{ + return headers_ ; +} + +void RV32IMAFDXCoreVHwlpV0Arch::initCodeBlock(etiss::CodeBlock & cb) const +{ + cb.fileglobalCode().insert("#include \"Arch/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0.h\"\n"); + cb.fileglobalCode().insert("#include \"Arch/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Funcs.h\"\n"); + cb.functionglobalCode().insert("cpu->exception = 0;\n"); + cb.functionglobalCode().insert("cpu->return_pending = 0;\n"); + cb.functionglobalCode().insert("etiss_uint32 mem_ret_code = 0;\n"); +} + +etiss::plugin::gdb::GDBCore & RV32IMAFDXCoreVHwlpV0Arch::getGDBCore() +{ + return gdbcore_; +} + +const char * const reg_name[] = +{ + "X0", + "X1", + "X2", + "X3", + "X4", + "X5", + "X6", + "X7", + "X8", + "X9", + "X10", + "X11", + "X12", + "X13", + "X14", + "X15", + "X16", + "X17", + "X18", + "X19", + "X20", + "X21", + "X22", + "X23", + "X24", + "X25", + "X26", + "X27", + "X28", + "X29", + "X30", + "X31", +}; + +etiss::instr::InstructionGroup ISA32_RV32IMAFDXCoreVHwlpV0("ISA32_RV32IMAFDXCoreVHwlpV0", 32); +etiss::instr::InstructionClass ISA32_RV32IMAFDXCoreVHwlpV0Class(1, "ISA32_RV32IMAFDXCoreVHwlpV0", 32, ISA32_RV32IMAFDXCoreVHwlpV0); + +etiss::instr::InstructionCollection RV32IMAFDXCoreVHwlpV0ISA("RV32IMAFDXCoreVHwlpV0ISA", ISA32_RV32IMAFDXCoreVHwlpV0Class); \ No newline at end of file diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Arch.h b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Arch.h new file mode 100644 index 0000000000..d876c3296c --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Arch.h @@ -0,0 +1,106 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the architecture class for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#ifndef ETISS_RV32IMAFDXCoreVHwlpV0Arch_RV32IMAFDXCoreVHwlpV0Arch_H_ +#define ETISS_RV32IMAFDXCoreVHwlpV0Arch_RV32IMAFDXCoreVHwlpV0Arch_H_ + +#include "etiss/CPUArch.h" +#include "etiss/Instruction.h" +#include "etiss/InterruptVector.h" +#include "etiss/InterruptEnable.h" +#include "RV32IMAFDXCoreVHwlpV0.h" +#include "RV32IMAFDXCoreVHwlpV0GDBCore.h" + +#include + +extern const char * const reg_name[]; + +extern etiss::instr::InstructionGroup ISA32_RV32IMAFDXCoreVHwlpV0; +extern etiss::instr::InstructionClass ISA32_RV32IMAFDXCoreVHwlpV0Class; + +extern etiss::instr::InstructionCollection RV32IMAFDXCoreVHwlpV0ISA; + +class RV32IMAFDXCoreVHwlpV0Arch : public etiss::CPUArch { + +public: + RV32IMAFDXCoreVHwlpV0Arch(); + + virtual const std::set & getListenerSupportedRegisters(); + + + virtual ETISS_CPU * newCPU(); + virtual void resetCPU(ETISS_CPU * cpu,etiss::uint64 * startpointer); + virtual void deleteCPU(ETISS_CPU *); + + /** + @brief get the VirtualStruct of the core to mitigate register access + + @see RV32IMAFDXCoreVHwlpV0ArchSpecificImp.h + */ + virtual std::shared_ptr getVirtualStruct(ETISS_CPU * cpu); + + /** + @return 8 (jump instruction + instruction of delay slot) + */ + virtual unsigned getMaximumInstructionSizeInBytes(); + + /** + @return 2 + */ + virtual unsigned getInstructionSizeInBytes(); + + /** + @brief required headers (RV32IMAFDXCoreVHwlpV0.h) + */ + virtual const std::set & getHeaders() const; + + /** + @brief This function will be called automatically in order to handling architecure dependent exceptions such + as interrupt, system call, illegal instructions + + @see RV32IMAFDXCoreVHwlpV0ArchSpecificImp.h + */ + virtual etiss::int32 handleException(etiss::int32 code, ETISS_CPU * cpu); + + /** + @brief This function is called during CPUArch initialization + + @see RV32IMAFDXCoreVHwlpV0ArchSpecificImp.h + */ + virtual void initInstrSet(etiss::instr::ModedInstructionSet & ) const; + virtual void initCodeBlock(etiss::CodeBlock & cb) const; + + /** + @brief Target architecture may have inconsistent endianess. Data read from memory is buffered, and this function + is called to alter sequence of buffered data so that the inconsistent endianess is compensated. + + @see RV32IMAFDXCoreVHwlpV0ArchSpecificImp.h + */ + virtual void compensateEndianess(ETISS_CPU * cpu, etiss::instr::BitArray & ba) const ; + + /** + @brief If interrupt handling is expected, vector table could be provided to support interrupt triggering + + @see RV32IMAFDXCoreVHwlpV0ArchSpecificImp.h + */ + virtual etiss::InterruptVector * createInterruptVector(ETISS_CPU * cpu); + virtual void deleteInterruptVector(etiss::InterruptVector * vec, ETISS_CPU * cpu); + virtual etiss::InterruptEnable* createInterruptEnable(ETISS_CPU *cpu); + virtual void deleteInterruptEnable(etiss::InterruptEnable* en, ETISS_CPU* cpu); + + /** + @brief get the GDBcore for RV32IMAFDXCoreVHwlpV0 architecture + + @see RV32IMAFDXCoreVHwlpV0GDBCore.h for implementation of GDBcore + */ + virtual etiss::plugin::gdb::GDBCore & getGDBCore(); + +private: + std::set listenerSupportedRegisters_; + std::set headers_; + RV32IMAFDXCoreVHwlpV0GDBCore gdbcore_; +}; +#endif diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0ArchLib.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0ArchLib.cpp new file mode 100644 index 0000000000..0ed96523f4 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0ArchLib.cpp @@ -0,0 +1,48 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the library interface for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +// define a name for this library. this will be used to avoid name clashes with other libraries. in this example the library is named "X". +// IMPORTANT this name MUST match the library name: e.g. X -> libX.so + +#define ETISS_LIBNAME RV32IMAFDXCoreVHwlpV0 +#include "etiss/helper/CPUArchLibrary.h" // defines the following functions +#include "RV32IMAFDXCoreVHwlpV0Arch.h" +extern "C" { + + ETISS_LIBRARYIF_VERSION_FUNC_IMPL + + ETISS_PLUGIN_EXPORT unsigned RV32IMAFDXCoreVHwlpV0_countCPUArch() + { +//TODO + return 1; // number of cpu architectures provided + } + ETISS_PLUGIN_EXPORT const char * RV32IMAFDXCoreVHwlpV0_nameCPUArch(unsigned index) + { +//TODO + switch (index) + { + case 0: + return "RV32IMAFDXCoreVHwlpV0"; + default: + return ""; + } + } + ETISS_PLUGIN_EXPORT etiss::CPUArch* RV32IMAFDXCoreVHwlpV0_createCPUArch(unsigned index,std::map options) + { +//TODO + switch (index) + { + case 0: + return new RV32IMAFDXCoreVHwlpV0Arch(); + default: + return 0; + } + } + ETISS_PLUGIN_EXPORT void RV32IMAFDXCoreVHwlpV0_deleteCPUArch(etiss::CPUArch* arch) + { + delete arch; + } +} diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0ArchSpecificImp.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0ArchSpecificImp.cpp new file mode 100644 index 0000000000..64e033cee1 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0ArchSpecificImp.cpp @@ -0,0 +1,322 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the architecture specific implementation for the RV32IMAFDXCoreVHwlpV0 + * core architecture. + * + * WARNING: This file contains user-added code, be mindful when overwriting this with + * generated code! + */ + +#include + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" +#include "RV32IMAFDXCoreVHwlpV0ArchSpecificImp.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +extern "C" { +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" +} + +/** + @brief This function will be called automatically in order to handling exceptions such as interrupt, system call, illegal instructions + + @details Exception handling mechanism is implementation dependent for each cpu variant. Please add it to the following block if exception + handling is demanded. + Pesudo example: + switch(cause){ + case etiss::RETURNCODE::INTERRUPT: + . + . + . + break; + +*/ +etiss::int32 RV32IMAFDXCoreVHwlpV0Arch::handleException(etiss::int32 cause, ETISS_CPU * cpu) +{ + translate_exc_code(cpu, nullptr, nullptr, cause); + cpu->instructionPointer = cpu->nextPc; + return 0; +} + +/** + @brief This function is called during CPUArch initialization + + @details Function pointer length_updater_ has to be replaced if multiple length instruction execution is supported. This + function enables dynamic instruction length update in order to guarantee correct binary translation + Pesudo example: + vis->length_updater_ = [](VariableInstructionSet & ,InstructionContext & ic, BitArray & ba) + { + switch(ba.byteCount()){ + case 4: + if ( INSTRUCTION_LENTH_NOT_EQUAL(4)){ + updateInstrLength(ic, ba); + ic.is_not_default_width_ = true; + . + . + . + } + break; + } + }; + +*/ +void RV32IMAFDXCoreVHwlpV0Arch::initInstrSet(etiss::instr::ModedInstructionSet & mis) const +{ + + { + /* Set default JIT Extensions. Read Parameters set from ETISS configuration and append with architecturally needed */ + std::string cfgPar = ""; + cfgPar = etiss::cfg().get("jit.external_headers", ";"); + etiss::cfg().set("jit.external_headers", cfgPar + "etiss/jit/libsoftfloat.h"); + + cfgPar = etiss::cfg().get("jit.external_libs", ";"); + etiss::cfg().set("jit.external_libs", cfgPar + "softfloat"); + + cfgPar = etiss::cfg().get("jit.external_header_paths", ";"); + etiss::cfg().set("jit.external_header_paths", cfgPar + "/etiss/jit"); + + cfgPar = etiss::cfg().get("jit.external_lib_paths", ";"); + etiss::cfg().set("jit.external_lib_paths", cfgPar + "/etiss/jit"); + + } + + if (false) { + // Pre-compilation of instruction set to view instruction tree. Could be disabled. + etiss::instr::ModedInstructionSet iset("RV32IMAFDXCoreVHwlpV0ISA"); + bool ok = true; + RV32IMAFDXCoreVHwlpV0ISA.addTo(iset,ok); + + iset.compile(); + + std::cout << iset.print() << std::endl; + } + + bool ok = true; + RV32IMAFDXCoreVHwlpV0ISA.addTo(mis,ok); + if (!ok) + etiss::log(etiss::FATALERROR,"Failed to add instructions for RV32IMAFDXCoreVHwlpV0ISA"); + + etiss::instr::VariableInstructionSet * vis = mis.get(1); + + using namespace etiss; + using namespace etiss::instr; + + vis->get(32)->getInvalid().addCallback( + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint32 error_code = 0; +static BitArrayRange R_error_code_0(31, 0); +error_code += R_error_code_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//trap_entry 32\n"); + +// ----------------------------------------------------------------------------- +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, " + std::to_string(error_code) + "ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//trap_entry 32\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0 + ); + + vis->length_updater_ = [](VariableInstructionSet &, InstructionContext &ic, BitArray &ba) { + std::function updateRV32IMAFDXCoreVHwlpV0InstrLength = + [](InstructionContext &ic, etiss_uint32 opRd) { + ic.instr_width_fully_evaluated_ = true; + ic.is_not_default_width_ = true; + if (opRd == 0x3f) + ic.instr_width_ = 64; + else if ((opRd & 0x3f) == 0x1f) + ic.instr_width_ = 48; + else if (((opRd & 0x1f) >= 0x3) && ((opRd & 0x1f) < 0x1f)) + ic.instr_width_ = 32; + else if(opRd == 0x7f) /* P-Extension instructions */ + ic.instr_width_ = 32; + else if ((opRd & 0x3) != 0x3) + ic.instr_width_ = 16; + else + // This might happen when code is followed by data. + ic.is_not_default_width_ = false; + }; + + BitArrayRange op(6, 0); + etiss_uint32 opRd = op.read(ba); + + /*BitArrayRange fullOp(ba.byteCount()*8-1,0); + etiss_uint32 fullOpRd = fullOp.read(ba); + + std::stringstream ss; + ss << "Byte count: " << ba.byteCount()<< std::endl; + ss << "opcode: 0x" <= 0x3) || ((opRd & 0x1f) < 0x1f)) || (opRd == 0)) + { + ic.is_not_default_width_ = false; + break; + } + else if(opRd == 0x7f) /* P-Extension instructions */ + { + updateRV32IMAFDXCoreVHwlpV0InstrLength(ic, opRd); + break; + } + else + { + updateRV32IMAFDXCoreVHwlpV0InstrLength(ic, opRd); + break; + } + case 6: + if (((opRd & 0x3f) == 0x1f) || (opRd == 0)) + { + ic.is_not_default_width_ = false; + break; + } + else + { + updateRV32IMAFDXCoreVHwlpV0InstrLength(ic, opRd); + break; + } + case 8: + if ((opRd == 0x3f) || (opRd == 0)) + { + ic.is_not_default_width_ = false; + break; + } + else + { + updateRV32IMAFDXCoreVHwlpV0InstrLength(ic, opRd); + break; + } + default: + // This might happen when code is followed by data. + ic.is_not_default_width_ = false; + } + }; + +} + +/** + @brief This function is called whenever a data is read from memory + + @details Target architecture may have inconsistent endianess. Data read from memory is buffered, and this function + is called to alter sequence of buffered data so that the inconsistent endianess is compensated. + Example for ARMv6M: + void * ptr = ba.internalBuffer(); + if (ba.byteCount() == 2) + { + *((uint32_t*)ptr) = ((uint16_t)(*((uint8_t*)ptr))) | ((uint16_t)(*(((uint8_t*)ptr)+1)) << 8); + } + else if (ba.byteCount() == 4) + { + *((uint32_t*)ptr) = ((((uint32_t)(*((uint8_t*)ptr))) | ((uint32_t)(*(((uint8_t*)ptr)+1)) << 8)) << 16) | ((uint32_t)(*(((uint8_t*)ptr)+2)) ) | ((uint32_t)(*(((uint8_t*)ptr)+3)) << 8); + } + else + { + etiss::log(etiss::FATALERROR,"Endianess cannot be handled",ba.byteCount()); + } + + @attention Default endianess: little-endian + +*/ +void RV32IMAFDXCoreVHwlpV0Arch::compensateEndianess(ETISS_CPU * cpu, etiss::instr::BitArray & ba) const +{ + /************************************************************************** + * Endianess compensation * + ***************************************************************************/ +} + +std::shared_ptr RV32IMAFDXCoreVHwlpV0Arch::getVirtualStruct(ETISS_CPU * cpu) +{ + auto ret = etiss::VirtualStruct::allocate( + cpu, + [] (etiss::VirtualStruct::Field*f) { + delete f; + } + ); + + for (uint32_t i = 0; i < 32; ++i){ + ret->addField(new RegField_RV32IMAFDXCoreVHwlpV0(*ret,i)); + } + + ret->addField(new pcField_RV32IMAFDXCoreVHwlpV0(*ret)); + return ret; +} + +/** + @brief If interrupt handling is expected, vector table could be provided to support interrupt triggering + + @details Interrupt vector table is used to inform the core whenever an edge/level triggered interrupt + incoming. The content of interrupt vector could be a special register or standalone interrupt + lines. +*/ +etiss::InterruptVector * RV32IMAFDXCoreVHwlpV0Arch::createInterruptVector(ETISS_CPU * cpu) +{ + if (cpu == 0) + return 0; + + std::vector vec; + std::vector mask; + + vec.push_back(&((RV32IMAFDXCoreVHwlpV0*)cpu)->MIE); + mask.push_back(&((RV32IMAFDXCoreVHwlpV0*)cpu)->MIP); + + return new etiss::MappedInterruptVector(vec, mask); +} + +void RV32IMAFDXCoreVHwlpV0Arch::deleteInterruptVector(etiss::InterruptVector * vec, ETISS_CPU * cpu) +{ + delete vec; +} + +etiss::InterruptEnable* RV32IMAFDXCoreVHwlpV0Arch::createInterruptEnable(ETISS_CPU* cpu) { + return new etiss::MappedInterruptEnable(&((RV32IMAFDXCoreVHwlpV0*)cpu)->MSTATUS, 15); +} + +void RV32IMAFDXCoreVHwlpV0Arch::deleteInterruptEnable(etiss::InterruptEnable* en, ETISS_CPU* cpu) { + delete en; +} diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0ArchSpecificImp.h b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0ArchSpecificImp.h new file mode 100644 index 0000000000..0c0ccafe5c --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0ArchSpecificImp.h @@ -0,0 +1,82 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the architecture specific header for the RV32IMAFDXCoreVHwlpV0 + * core architecture. + * + * WARNING: This file contains user-added code, be mindful when overwriting this with + * generated code! + */ + +#ifndef ETISS_RV32IMAFDXCoreVHwlpV0Arch_RV32IMAFDXCoreVHwlpV0ARCHSPECIFICIMP_H_ +#define ETISS_RV32IMAFDXCoreVHwlpV0Arch_RV32IMAFDXCoreVHwlpV0ARCHSPECIFICIMP_H_ + +/** + @brief VirtualStruct for RV32IMAFDXCoreVHwlpV0 architecture to faciliate register acess + + @details VirtualStruct enables user to access certain register via their name without knowning ETISS hierarchy of a core. + Further fiels might be needed to enable gdbserver etc. + +*/ +class RegField_RV32IMAFDXCoreVHwlpV0 : public etiss::VirtualStruct::Field{ +private: + const unsigned gprid_; +public: + RegField_RV32IMAFDXCoreVHwlpV0(etiss::VirtualStruct & parent,unsigned gprid) + : Field(parent, + std::string("X")+etiss::toString(gprid), + std::string("X")+etiss::toString(gprid), + R|W, + 4 + ), + gprid_(gprid) + {} + + RegField_RV32IMAFDXCoreVHwlpV0(etiss::VirtualStruct & parent, std::string name, unsigned gprid) + : Field(parent, + name, + name, + R|W, + 4 + ), + gprid_(gprid) + {} + + virtual ~RegField_RV32IMAFDXCoreVHwlpV0(){} + +protected: + virtual uint64_t _read() const { + return (uint64_t) *((RV32IMAFDXCoreVHwlpV0*)parent_.structure_)->X[gprid_]; + } + + virtual void _write(uint64_t val) { + etiss::log(etiss::VERBOSE, "write to ETISS cpu state", name_, val); + *((RV32IMAFDXCoreVHwlpV0*)parent_.structure_)->X[gprid_] = (etiss_uint32) val; + } +}; + +class pcField_RV32IMAFDXCoreVHwlpV0 : public etiss::VirtualStruct::Field{ +public: + pcField_RV32IMAFDXCoreVHwlpV0(etiss::VirtualStruct & parent) + : Field(parent, + "instructionPointer", + "instructionPointer", + R|W, + 4 + ) + {} + + virtual ~pcField_RV32IMAFDXCoreVHwlpV0(){} + +protected: + virtual uint64_t _read() const { + return (uint64_t) ((ETISS_CPU *)parent_.structure_)->instructionPointer; + } + + virtual void _write(uint64_t val) { + etiss::log(etiss::VERBOSE, "write to ETISS cpu state", name_, val); + ((ETISS_CPU *)parent_.structure_)->instructionPointer = (etiss_uint32) val; + } +}; + +#endif \ No newline at end of file diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Funcs.h b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Funcs.h new file mode 100644 index 0000000000..e9ccfb766d --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Funcs.h @@ -0,0 +1,449 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the function macros for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#ifndef __RV32IMAFDXCOREVHWLPV0_FUNCS_H +#define __RV32IMAFDXCOREVHWLPV0_FUNCS_H + +#ifndef ETISS_ARCH_STATIC_FN_ONLY +#include "Arch/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0.h" +#include "etiss/jit/CPU.h" +#include "etiss/jit/System.h" +#include "etiss/jit/ReturnCode.h" +#endif + + + +extern void leave(etiss_int32 priv_lvl); + +extern void wait(etiss_int32 flag); + +static inline etiss_uint8 extension_enabled(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_int8 extension); + +extern etiss_uint32 fadd_s(etiss_uint32, etiss_uint32, etiss_uint8); + +extern etiss_uint32 fsub_s(etiss_uint32, etiss_uint32, etiss_uint8); + +extern etiss_uint32 fmul_s(etiss_uint32, etiss_uint32, etiss_uint8); + +extern etiss_uint32 fdiv_s(etiss_uint32, etiss_uint32, etiss_uint8); + +extern etiss_uint32 fmadd_s(etiss_uint32, etiss_uint32, etiss_uint32, etiss_uint32, etiss_uint8); + +extern etiss_uint32 fsel_s(etiss_uint32, etiss_uint32, etiss_uint32); + +extern etiss_uint32 fsqrt_s(etiss_uint32, etiss_uint8); + +extern etiss_uint32 fcmp_s(etiss_uint32, etiss_uint32, etiss_uint32); + +extern etiss_uint32 fcvt_s(etiss_uint32, etiss_uint32, etiss_uint8); + +extern etiss_uint64 fcvt_32_64(etiss_uint32, etiss_uint32, etiss_uint8); + +extern etiss_uint32 fcvt_64_32(etiss_uint64, etiss_uint32, etiss_uint8); + +extern etiss_uint32 unbox_s(etiss_uint64); + +extern etiss_uint32 fclass_s(etiss_uint32); + +extern etiss_uint32 fget_flags(); + +static inline etiss_uint8 get_rm(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_uint8 rm); + +extern etiss_uint64 fadd_d(etiss_uint64, etiss_uint64, etiss_uint8); + +extern etiss_uint64 fsub_d(etiss_uint64, etiss_uint64, etiss_uint8); + +extern etiss_uint64 fmul_d(etiss_uint64, etiss_uint64, etiss_uint8); + +extern etiss_uint64 fdiv_d(etiss_uint64, etiss_uint64, etiss_uint8); + +extern etiss_uint64 fmadd_d(etiss_uint64, etiss_uint64, etiss_uint64, etiss_uint32, etiss_uint8); + +extern etiss_uint64 fsel_d(etiss_uint64, etiss_uint64, etiss_uint32); + +extern etiss_uint64 fsqrt_d(etiss_uint64, etiss_uint8); + +extern etiss_uint64 fcmp_d(etiss_uint64, etiss_uint64, etiss_uint32); + +extern etiss_uint64 fcvt_d(etiss_uint64, etiss_uint32, etiss_uint8); + +extern etiss_uint32 fconv_d2f(etiss_uint64, etiss_uint8); + +extern etiss_uint64 fconv_f2d(etiss_uint32, etiss_uint8); + +extern etiss_uint64 unbox_d(etiss_uint64); + +extern etiss_uint64 fclass_d(etiss_uint64); + +extern etiss_uint64 etiss_get_cycles(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers); + +extern etiss_uint64 etiss_get_time(); + +extern etiss_uint64 etiss_get_instret(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers); + +static inline etiss_uint32 sstatus_mask(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers); + +static inline etiss_uint32 mstatus_mask(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers); + +static inline etiss_uint32 csr_read(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_uint32 csr); + +static inline void csr_write(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_uint32 csr, etiss_uint32 val); + +static inline etiss_uint64 get_field(etiss_uint64 reg, etiss_uint64 mask); + +static inline etiss_uint64 set_field(etiss_uint64 reg, etiss_uint64 mask, etiss_uint64 val); + +static inline etiss_uint8 ctz(etiss_uint64 val); + +static inline void raise(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_int32 irq, etiss_uint32 mcause); + +static inline void translate_exc_code(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_int32 cause); + +static inline etiss_uint32 calc_irq_mcause(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers); + +static inline void check_irq(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers); + +extern etiss_uint8 etiss_semihost_enabled(); + +extern etiss_int64 etiss_semihost(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_uint32 XLEN, etiss_uint64 operation, etiss_uint64 parameter); + +static inline etiss_uint8 extension_enabled(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_int8 extension) +{ +{ // block +return (*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[769LL] >> (extension - 65ULL)) & 1ULL; +} // block +} + +static inline etiss_uint8 get_rm(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_uint8 rm) +{ +{ // block +if (rm == 7ULL) { // conditional +rm = ((((((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR) >> (5ULL)) & 7)) & 0x7; +} // conditional +if (rm > 4ULL) { // conditional +raise(cpu, system, plugin_pointers, 0ULL, 2LL); +} // conditional +return rm; +} // block +} + +static inline etiss_uint32 sstatus_mask(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers) +{ +{ // block +etiss_uint32 mask = 0ULL; +if (extension_enabled(cpu, system, plugin_pointers, 83ULL)) { // conditional +{ // block +mask = mask | 5767458ULL; +if (extension_enabled(cpu, system, plugin_pointers, 86ULL)) { // conditional +mask = mask | 1536LL; +} // conditional +if (extension_enabled(cpu, system, plugin_pointers, 70ULL)) { // conditional +mask = mask | 24576LL; +} // conditional +if (extension_enabled(cpu, system, plugin_pointers, 88ULL)) { // conditional +mask = mask | 98304LL; +} // conditional +if ((get_field(*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[384LL], 2147483648ULL))) { // conditional +mask = mask | 262144LL; +} // conditional +} // block +} // conditional +return mask; +} // block +} + +static inline etiss_uint32 mstatus_mask(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers) +{ +{ // block +etiss_uint32 mask = 6280ULL; +return mask | sstatus_mask(cpu, system, plugin_pointers); +} // block +} + +static inline etiss_uint32 csr_read(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_uint32 csr) +{ +{ // block +if (csr == 1LL) { // conditional +return *((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[3LL] & 31ULL; +} // conditional +if (csr == 2LL) { // conditional +return (*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[3LL] >> 5ULL) & 7ULL; +} // conditional +if (csr == 3072LL) { // conditional +return etiss_get_cycles(cpu, system, plugin_pointers); +} // conditional +if (csr == 3200LL) { // conditional +return etiss_get_cycles(cpu, system, plugin_pointers) >> 32ULL; +} // conditional +if (csr == 3073LL) { // conditional +return etiss_get_time(); +} // conditional +if (csr == 3201LL) { // conditional +return etiss_get_time() >> 32ULL; +} // conditional +if (csr == 3074LL) { // conditional +return etiss_get_instret(cpu, system, plugin_pointers); +} // conditional +if (csr == 3202LL) { // conditional +return etiss_get_instret(cpu, system, plugin_pointers) >> 32ULL; +} // conditional +if (csr == 768LL || csr == 256LL) { // conditional +return *((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[768LL] | 8589934592ULL | 34359738368ULL; +} // conditional +if (csr == 769LL) { // conditional +return (((1ULL) << 30) | ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[769LL]) >> (0ULL)) & 1073741823))); +} // conditional +return *((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[csr]; +} // block +} + +static inline void csr_write(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_uint32 csr, etiss_uint32 val) +{ +{ // block +if (csr == 1LL) { // conditional +*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[3LL] = (*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[3LL] & 224ULL) | (val & 31ULL); +} // conditional + else if (csr == 2LL) { // conditional +*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[3LL] = ((val & 7ULL) << 5ULL) | (*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[3LL] & 31ULL); +} // conditional + else if (csr == 3LL) { // conditional +*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[3LL] = val & 255ULL; +} // conditional + else if (csr == 768LL) { // conditional +*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[768LL] = val & mstatus_mask(cpu, system, plugin_pointers); +} // conditional + else if (csr == 256LL) { // conditional +*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[768LL] = val & sstatus_mask(cpu, system, plugin_pointers); +} // conditional + else if (csr != 769LL) { // conditional +*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[csr] = val; +} // conditional +} // block +} + +static inline etiss_uint64 get_field(etiss_uint64 reg, etiss_uint64 mask) +{ +{ // block +return (reg & mask) / (mask & ~((mask << 1ULL))); +} // block +} + +static inline etiss_uint64 set_field(etiss_uint64 reg, etiss_uint64 mask, etiss_uint64 val) +{ +{ // block +return ((reg & ~(mask)) | ((val * (mask & ~((mask << 1ULL)))) & mask)); +} // block +} + +static inline etiss_uint8 ctz(etiss_uint64 val) +{ +{ // block +if (!(val)) { // conditional +return 0ULL; +} // conditional +etiss_uint8 res = 0ULL; +if ((val << 32ULL) == 0ULL) { // conditional +{ // block +res = res + 32ULL; +val = val >> 32ULL; +} // block +} // conditional +if ((val << 48ULL) == 0ULL) { // conditional +{ // block +res = res + 16ULL; +val = val >> 16ULL; +} // block +} // conditional +if ((val << 56ULL) == 0ULL) { // conditional +{ // block +res = res + 8ULL; +val = val >> 8ULL; +} // block +} // conditional +if ((val << 60ULL) == 0ULL) { // conditional +{ // block +res = res + 4ULL; +val = val >> 4ULL; +} // block +} // conditional +if ((val << 62ULL) == 0ULL) { // conditional +{ // block +res = res + 2ULL; +val = val >> 2ULL; +} // block +} // conditional +if ((val << 63ULL) == 0ULL) { // conditional +{ // block +res = res + 1ULL; +val = val >> 1ULL; +} // block +} // conditional +return res; +} // block +} + +static inline void raise(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_int32 irq, etiss_uint32 mcause) +{ +cpu->return_pending = 1; +cpu->exception = 0; +{ // block +etiss_uint32 epc = cpu->instructionPointer; +etiss_uint32 deleg = 0ULL; +etiss_uint32 vector = 0ULL; +etiss_uint32 bit = mcause; +etiss_int32 irq2 = (mcause & 2147483648ULL) != 0ULL; +if (irq2) { // conditional +{ // block +deleg = ((((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV <= 1LL)) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[771LL]) : (0ULL); +bit = bit & 2147483647ULL; +} // block +} // conditional +else { // conditional +{ // block +deleg = ((((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV <= 1LL)) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[770LL]) : (0ULL); +} // block +} // conditional +if (((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV <= 1LL && (deleg >> bit) & 1ULL) { // conditional +{ // block +vector = ((*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[261LL] & 1ULL) && irq2) ? (bit * 4ULL) : (0ULL); +cpu->nextPc = (*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[261LL] & -2LL) + vector; +*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[321LL] = epc; +*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[322LL] = mcause; +etiss_uint32 s = csr_read(cpu, system, plugin_pointers, 256LL); +s = set_field(s, 32LL, get_field(s, 2LL)); +s = set_field(s, 256LL, ((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV); +s = set_field(s, 2LL, 0ULL); +csr_write(cpu, system, plugin_pointers, 256LL, s); +((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV = (1LL) & 0x7; +} // block +} // conditional +else { // conditional +{ // block +vector = ((*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[773LL] & 1ULL) && irq2) ? (bit * 4ULL) : (0ULL); +cpu->nextPc = (*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[773LL] & -2LL) + vector; +*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[833LL] = epc; +*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[834LL] = mcause; +etiss_uint32 s = csr_read(cpu, system, plugin_pointers, 768LL); +s = set_field(s, 128LL, get_field(s, 8LL)); +s = set_field(s, 6144LL, ((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV); +s = set_field(s, 8LL, 0ULL); +csr_write(cpu, system, plugin_pointers, 768LL, s); +((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV = (3LL) & 0x7; +} // block +} // conditional +} // block +} + +static inline void translate_exc_code(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers, etiss_int32 cause) +{ +{ // block +etiss_uint32 code = 0ULL; +if (cause == -2147483648LL) { // conditional +return; +} // conditional + else if (cause == -5LL) { // conditional +code = 5LL; +} // conditional + else if (cause == -14LL) { // conditional +code = 13LL; +} // conditional + else if (cause == -6LL) { // conditional +code = 7LL; +} // conditional + else if (cause == -15LL) { // conditional +code = 15LL; +} // conditional + else if (cause == -7LL) { // conditional +code = 1LL; +} // conditional + else if (cause == -9LL) { // conditional +{ // block +code = calc_irq_mcause(cpu, system, plugin_pointers); +if (!(code)) { // conditional +return; +} // conditional +} // block +} // conditional +else { // conditional +code = 2LL; +} // conditional +raise(cpu, system, plugin_pointers, 0ULL, code); +} // block +} + +static inline etiss_uint32 calc_irq_mcause(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers) +{ +{ // block +etiss_uint32 pending_interrupts = *((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[772LL] & *((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[836LL]; +if (!(pending_interrupts)) { // conditional +return 0ULL; +} // conditional +etiss_uint32 mie = get_field(*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[768LL], 8LL); +etiss_uint32 m_enabled = ((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV < 3LL || (((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV == 3LL && mie); +etiss_uint32 enabled_interrupts = pending_interrupts & ~(*((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[771LL]) & -(m_enabled); +if (enabled_interrupts == 0ULL) { // conditional +{ // block +etiss_uint32 deleg = *((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[771LL]; +etiss_uint32 sie = get_field(csr_read(cpu, system, plugin_pointers, 256LL), 2LL); +etiss_uint32 s_enabled = ((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV < 1LL || (((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV == 1LL && sie); +enabled_interrupts = pending_interrupts & deleg & -(s_enabled); +} // block +} // conditional +if (enabled_interrupts) { // conditional +{ // block +if (enabled_interrupts >> 12ULL) { // conditional +enabled_interrupts = enabled_interrupts >> 12ULL << 12ULL; +} // conditional + else if (enabled_interrupts & 2048LL) { // conditional +enabled_interrupts = 2048LL; +} // conditional + else if (enabled_interrupts & 8LL) { // conditional +enabled_interrupts = 8LL; +} // conditional + else if (enabled_interrupts & 128LL) { // conditional +enabled_interrupts = 128LL; +} // conditional + else if (enabled_interrupts & 512LL) { // conditional +enabled_interrupts = 512LL; +} // conditional + else if (enabled_interrupts & 2LL) { // conditional +enabled_interrupts = 2LL; +} // conditional + else if (enabled_interrupts & 32LL) { // conditional +enabled_interrupts = 32LL; +} // conditional + else if (enabled_interrupts & 8192LL) { // conditional +enabled_interrupts = 8192LL; +} // conditional + else if (enabled_interrupts & 1024LL) { // conditional +enabled_interrupts = 1024LL; +} // conditional + else if (enabled_interrupts & 4LL) { // conditional +enabled_interrupts = 4LL; +} // conditional + else if (enabled_interrupts & 64LL) { // conditional +enabled_interrupts = 64LL; +} // conditional +else { // conditional +return 0ULL; +} // conditional +return 2147483648ULL | ctz(enabled_interrupts); +} // block +} // conditional +return 0ULL; +} // block +} + +static inline void check_irq(ETISS_CPU * const cpu, ETISS_System * const system, void * const * const plugin_pointers) +{ +{ // block +etiss_uint32 irq_mcause = calc_irq_mcause(cpu, system, plugin_pointers); +if (irq_mcause) { // conditional +raise(cpu, system, plugin_pointers, 1ULL, irq_mcause); +} // conditional +} // block +} +#endif \ No newline at end of file diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0GDBCore.h b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0GDBCore.h new file mode 100644 index 0000000000..97bf693ceb --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0GDBCore.h @@ -0,0 +1,70 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the GDBCore adapter for the RV32IMAFDXCoreVHwlpV0 core architecture. + * + * WARNING: This file contains user-added code, be mindful when overwriting this with + * generated code! + */ + +#ifndef ETISS_RV32IMAFDXCoreVHwlpV0Arch_RV32IMAFDXCoreVHwlpV0GDBCORE_H_ +#define ETISS_RV32IMAFDXCoreVHwlpV0Arch_RV32IMAFDXCoreVHwlpV0GDBCORE_H_ + +#include "etiss/IntegratedLibrary/gdb/GDBCore.h" +#include + +/** + @brief This class is the brige between RV32IMAFDXCoreVHwlpV0 architecture and gdbserver + + @details Gdbserver integrated in ETISS calls GDBCore to read/write registers via virtualStrruct + The index in mapRegister() should strictly follow the RV32IMAFDXCoreVHwlpV0 gdb tool defined register + order. Because gdbserver will send raw register data sequentially in strict order over + RSP ->TCP/IP ->RSP protocal + + Check the order with gdb command: + $(gdb) info all-registers + which lists all registers supported and its order. + + By default only general purpose register and instruction pointer are supported. Further + Special Function Register/Control and Status Register could be added manually. Meanwhile + virtualStruct in RV32IMAFDXCoreVHwlpV0Arch.cpp should be modified as well as well + +*/ +class RV32IMAFDXCoreVHwlpV0GDBCore : public etiss::plugin::gdb::GDBCore { +public: + std::string mapRegister(unsigned index){ + if (index < 32){ + std::stringstream ss; + ss << "X" << index; + return ss.str(); + } + switch (index){ + case 32: + return "instructionPointer"; + /************************************************************************** + * Further register should be added here to send data over gdbserver * + ***************************************************************************/ + } + return ""; + } + + unsigned mapRegister(std::string name){ + return INVALIDMAPPING; + } + + unsigned mappedRegisterCount(){ + // Modify according to sent register number + return 33; + } + + etiss::uint64 getInstructionPointer(ETISS_CPU * cpu){ + return cpu->instructionPointer; + } + + bool isLittleEndian(){ + // Modify according to RV32IMAFDXCoreVHwlpV0 manual + return true; + } +}; + +#endif diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Instr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Instr.cpp new file mode 100644 index 0000000000..454602099c --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0Instr.cpp @@ -0,0 +1,15 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the default + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32AInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32AInstr.cpp new file mode 100644 index 0000000000..1242565666 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32AInstr.cpp @@ -0,0 +1,1534 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the RV32A + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// AMOSWAPW -------------------------------------------------------------------- +static InstructionDefinition amoswapw_rd_rs1_rs2_rl_aq ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "amoswapw", + (uint32_t) 0x800202f, + (uint32_t) 0xf800707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//AMOSWAPW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int32)(((etiss_int32)(mem_val_0)));\n"; +} // conditional +cp.code() += "etiss_uint32 mem_val_1;\n"; +cp.code() += "mem_val_1 = (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_1, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//AMOSWAPW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "amoswapw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rl=" + std::to_string(rl) + " | aq=" + std::to_string(aq) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// AMOADDW --------------------------------------------------------------------- +static InstructionDefinition amoaddw_rd_rs1_rs2_rl_aq ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "amoaddw", + (uint32_t) 0x00202f, + (uint32_t) 0xf800707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//AMOADDW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int32 res1 = mem_val_0;\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res1;\n"; +} // conditional +cp.code() += "etiss_uint32 res2 = res1 + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_1;\n"; +cp.code() += "mem_val_1 = res2;\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_1, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//AMOADDW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "amoaddw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rl=" + std::to_string(rl) + " | aq=" + std::to_string(aq) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// AMOXORW --------------------------------------------------------------------- +static InstructionDefinition amoxorw_rd_rs1_rs2_rl_aq ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "amoxorw", + (uint32_t) 0x2000202f, + (uint32_t) 0xf800707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//AMOXORW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int32 res1 = mem_val_0;\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res1;\n"; +} // conditional +cp.code() += "etiss_uint32 res2 = res1 ^ *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_1;\n"; +cp.code() += "mem_val_1 = res2;\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_1, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//AMOXORW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "amoxorw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rl=" + std::to_string(rl) + " | aq=" + std::to_string(aq) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// AMOANDW --------------------------------------------------------------------- +static InstructionDefinition amoandw_rd_rs1_rs2_rl_aq ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "amoandw", + (uint32_t) 0x6000202f, + (uint32_t) 0xf800707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//AMOANDW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int32 res1 = mem_val_0;\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res1;\n"; +} // conditional +cp.code() += "etiss_uint32 res2 = res1 & *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_1;\n"; +cp.code() += "mem_val_1 = res2;\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_1, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//AMOANDW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "amoandw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rl=" + std::to_string(rl) + " | aq=" + std::to_string(aq) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// AMOORW ---------------------------------------------------------------------- +static InstructionDefinition amoorw_rd_rs1_rs2_rl_aq ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "amoorw", + (uint32_t) 0x4000202f, + (uint32_t) 0xf800707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//AMOORW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int32 res1 = mem_val_0;\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res1;\n"; +} // conditional +cp.code() += "etiss_uint32 res2 = res1 | *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_1;\n"; +cp.code() += "mem_val_1 = res2;\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_1, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//AMOORW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "amoorw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rl=" + std::to_string(rl) + " | aq=" + std::to_string(aq) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// AMOMINW --------------------------------------------------------------------- +static InstructionDefinition amominw_rd_rs1_rs2_rl_aq ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "amominw", + (uint32_t) 0x8000202f, + (uint32_t) 0xf800707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//AMOMINW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int32 res1 = mem_val_0;\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res1;\n"; +} // conditional +cp.code() += "etiss_uint32 res2 = (res1 > (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL])) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) : (res1);\n"; +cp.code() += "etiss_uint32 mem_val_1;\n"; +cp.code() += "mem_val_1 = res2;\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_1, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//AMOMINW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "amominw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rl=" + std::to_string(rl) + " | aq=" + std::to_string(aq) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// AMOMAXW --------------------------------------------------------------------- +static InstructionDefinition amomaxw_rd_rs1_rs2_rl_aq ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "amomaxw", + (uint32_t) 0xa000202f, + (uint32_t) 0xf800707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//AMOMAXW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int32 res1 = mem_val_0;\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res1;\n"; +} // conditional +cp.code() += "etiss_uint32 res2 = (res1 < (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL])) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) : (res1);\n"; +cp.code() += "etiss_uint32 mem_val_1;\n"; +cp.code() += "mem_val_1 = res2;\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_1, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//AMOMAXW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "amomaxw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rl=" + std::to_string(rl) + " | aq=" + std::to_string(aq) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// AMOMINUW -------------------------------------------------------------------- +static InstructionDefinition amominuw_rd_rs1_rs2_rl_aq ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "amominuw", + (uint32_t) 0xc000202f, + (uint32_t) 0xf800707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//AMOMINUW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint32 res1 = mem_val_0;\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int32)(res1);\n"; +} // conditional +cp.code() += "etiss_uint32 res2 = (res1 > (etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL])) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) : (res1);\n"; +cp.code() += "etiss_uint32 mem_val_1;\n"; +cp.code() += "mem_val_1 = res2;\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_1, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//AMOMINUW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "amominuw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rl=" + std::to_string(rl) + " | aq=" + std::to_string(aq) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// AMOMAXUW -------------------------------------------------------------------- +static InstructionDefinition amomaxuw_rd_rs1_rs2_rl_aq ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "amomaxuw", + (uint32_t) 0xe000202f, + (uint32_t) 0xf800707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//AMOMAXUW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint32 res1 = mem_val_0;\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int32)(res1);\n"; +} // conditional +cp.code() += "etiss_uint32 res2 = (res1 < (etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL])) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) : (res1);\n"; +cp.code() += "etiss_uint32 mem_val_1;\n"; +cp.code() += "mem_val_1 = res2;\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_1, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//AMOMAXUW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "amomaxuw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rl=" + std::to_string(rl) + " | aq=" + std::to_string(aq) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32DInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32DInstr.cpp new file mode 100644 index 0000000000..4f124aa488 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32DInstr.cpp @@ -0,0 +1,3588 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the RV32D + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// FLD ------------------------------------------------------------------------- +static InstructionDefinition fld_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fld", + (uint32_t) 0x003007, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FLD\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +cp.code() += "etiss_uint64 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 8);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint64 res = (etiss_uint64)(mem_val_0);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FLD\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fld" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FSD ------------------------------------------------------------------------- +static InstructionDefinition fsd_imm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fsd", + (uint32_t) 0x003027, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(11, 7); +imm += R_imm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(31, 25); +imm += R_imm_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FSD\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +cp.code() += "etiss_uint64 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 8);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FSD\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(11, 7); +imm += R_imm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(31, 25); +imm += R_imm_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fsd" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FMADD_D --------------------------------------------------------------------- +static InstructionDefinition fmadd_d_rd_rm_rs1_rs2_rs3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fmadd_d", + (uint32_t) 0x2000043, + (uint32_t) 0x600007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FMADD_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fmadd_d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs3) + "ULL]), 0ULL, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FMADD_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fmadd_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rs3=" + std::to_string(rs3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FMSUB_D --------------------------------------------------------------------- +static InstructionDefinition fmsub_d_rd_rm_rs1_rs2_rs3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fmsub_d", + (uint32_t) 0x2000047, + (uint32_t) 0x600007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FMSUB_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fmadd_d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs3) + "ULL]), 1ULL, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FMSUB_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fmsub_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rs3=" + std::to_string(rs3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FNMADD_D -------------------------------------------------------------------- +static InstructionDefinition fnmadd_d_rd_rm_rs1_rs2_rs3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fnmadd_d", + (uint32_t) 0x200004f, + (uint32_t) 0x600007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FNMADD_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fmadd_d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs3) + "ULL]), 2ULL, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FNMADD_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fnmadd_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rs3=" + std::to_string(rs3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FNMSUB_D -------------------------------------------------------------------- +static InstructionDefinition fnmsub_d_rd_rm_rs1_rs2_rs3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fnmsub_d", + (uint32_t) 0x200004b, + (uint32_t) 0x600007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FNMSUB_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fmadd_d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs3) + "ULL]), 3ULL, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FNMSUB_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fnmsub_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rs3=" + std::to_string(rs3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FADD_D ---------------------------------------------------------------------- +static InstructionDefinition fadd_d_rd_rm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fadd_d", + (uint32_t) 0x2000053, + (uint32_t) 0xfe00007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FADD_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fadd_d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]), get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FADD_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fadd_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FSUB_D ---------------------------------------------------------------------- +static InstructionDefinition fsub_d_rd_rm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fsub_d", + (uint32_t) 0xa000053, + (uint32_t) 0xfe00007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FSUB_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fsub_d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]), get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FSUB_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fsub_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FMUL_D ---------------------------------------------------------------------- +static InstructionDefinition fmul_d_rd_rm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fmul_d", + (uint32_t) 0x12000053, + (uint32_t) 0xfe00007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FMUL_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fmul_d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]), get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FMUL_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fmul_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FDIV_D ---------------------------------------------------------------------- +static InstructionDefinition fdiv_d_rd_rm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fdiv_d", + (uint32_t) 0x1a000053, + (uint32_t) 0xfe00007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FDIV_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fdiv_d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]), get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FDIV_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fdiv_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FSQRT_D --------------------------------------------------------------------- +static InstructionDefinition fsqrt_d_rd_rm_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fsqrt_d", + (uint32_t) 0x5a000053, + (uint32_t) 0xfff0007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FSQRT_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fsqrt_d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FSQRT_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fsqrt_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FSGNJ_D --------------------------------------------------------------------- +static InstructionDefinition fsgnj_d_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fsgnj_d", + (uint32_t) 0x22000053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FSGNJ_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = ((((((((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]) >> (63ULL)) & 1)) << 63) | ((((((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 9223372036854775807)));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FSGNJ_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fsgnj_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FSGNJN_D -------------------------------------------------------------------- +static InstructionDefinition fsgnjn_d_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fsgnjn_d", + (uint32_t) 0x22001053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FSGNJN_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = (((~((((((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]) >> (63ULL)) & 1))) << 63) | ((((((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 9223372036854775807)));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FSGNJN_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fsgnjn_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FSGNJX_D -------------------------------------------------------------------- +static InstructionDefinition fsgnjx_d_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fsgnjx_d", + (uint32_t) 0x22002053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FSGNJX_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]) ^ ((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]) & 9223372036854775808ULL);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FSGNJX_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fsgnjx_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FMIN_D ---------------------------------------------------------------------- +static InstructionDefinition fmin_d_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fmin_d", + (uint32_t) 0x2a000053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FMIN_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fsel_d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]), 0ULL);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FMIN_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fmin_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FMAX_D ---------------------------------------------------------------------- +static InstructionDefinition fmax_d_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fmax_d", + (uint32_t) 0x2a001053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FMAX_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fsel_d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), (etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]), 1ULL);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FMAX_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fmax_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FCVT_S_D -------------------------------------------------------------------- +static InstructionDefinition fcvt_s_d_rd_rm_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fcvt_s_d", + (uint32_t) 0x40100053, + (uint32_t) 0xfff0007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FCVT_S_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 res = fconv_d2f(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL], " + std::to_string(rm) + "ULL);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL + res;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FCVT_S_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fcvt_s_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FCVT_D_S -------------------------------------------------------------------- +static InstructionDefinition fcvt_d_s_rd_rm_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fcvt_d_s", + (uint32_t) 0x42000053, + (uint32_t) 0xfff0007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FCVT_D_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fconv_f2d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), " + std::to_string(rm) + "ULL);\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FCVT_D_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fcvt_d_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FEQ_D ----------------------------------------------------------------------- +static InstructionDefinition feq_d_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "feq_d", + (uint32_t) 0xa2002053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FEQ_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = 0ULL;\n"; +cp.code() += "res = fcmp_d(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL], ((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL], 0ULL);\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res;\n"; +} // conditional +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FEQ_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "feq_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FLT_D ----------------------------------------------------------------------- +static InstructionDefinition flt_d_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "flt_d", + (uint32_t) 0xa2001053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FLT_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = 0ULL;\n"; +cp.code() += "res = fcmp_d(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL], ((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL], 2ULL);\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res;\n"; +} // conditional +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FLT_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "flt_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FLE_D ----------------------------------------------------------------------- +static InstructionDefinition fle_d_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fle_d", + (uint32_t) 0xa2000053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FLE_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = 0ULL;\n"; +cp.code() += "res = fcmp_d(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL], ((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL], 1ULL);\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res;\n"; +} // conditional +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FLE_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fle_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FCLASS_D -------------------------------------------------------------------- +static InstructionDefinition fclass_d_rd_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fclass_d", + (uint32_t) 0xe2001053, + (uint32_t) 0xfff0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FCLASS_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = fclass_d((etiss_uint64)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]));\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FCLASS_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fclass_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FCVT_W_D -------------------------------------------------------------------- +static InstructionDefinition fcvt_w_d_rd_rm_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fcvt_w_d", + (uint32_t) 0xc2000053, + (uint32_t) 0xfff0007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FCVT_W_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 res = 0ULL;\n"; +cp.code() += "res = fcvt_64_32(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL], 0ULL, " + std::to_string(rm) + "ULL);\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res;\n"; +} // conditional +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FCVT_W_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fcvt_w_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FCVT_WU_D ------------------------------------------------------------------- +static InstructionDefinition fcvt_wu_d_rd_rm_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fcvt_wu_d", + (uint32_t) 0xc2100053, + (uint32_t) 0xfff0007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FCVT_WU_D\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 res = 0ULL;\n"; +cp.code() += "res = fcvt_64_32(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL], 1ULL, " + std::to_string(rm) + "ULL);\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint64)((etiss_int32)(res));\n"; +} // conditional +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FCVT_WU_D\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fcvt_wu_d" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FCVT_D_W -------------------------------------------------------------------- +static InstructionDefinition fcvt_d_w_rd_rm_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fcvt_d_w", + (uint32_t) 0xd2000053, + (uint32_t) 0xfff0007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FCVT_D_W\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int64 res = fcvt_32_64((etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]), 2ULL, " + std::to_string(rm) + "ULL);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FCVT_D_W\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fcvt_d_w" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FCVT_D_WU ------------------------------------------------------------------- +static InstructionDefinition fcvt_d_wu_rd_rm_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fcvt_d_wu", + (uint32_t) 0xd2100053, + (uint32_t) 0xfff0007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FCVT_D_WU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = fcvt_32_64((etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]), 3ULL, " + std::to_string(rm) + "ULL);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = res;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FCVT_D_WU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fcvt_d_wu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32FInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32FInstr.cpp new file mode 100644 index 0000000000..19f4974728 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32FInstr.cpp @@ -0,0 +1,3701 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the RV32F + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// FLW ------------------------------------------------------------------------- +static InstructionDefinition flw_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "flw", + (uint32_t) 0x002007, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FLW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint32 res = (etiss_uint32)(mem_val_0);\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FLW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "flw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FSW ------------------------------------------------------------------------- +static InstructionDefinition fsw_imm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fsw", + (uint32_t) 0x002027, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(11, 7); +imm += R_imm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(31, 25); +imm += R_imm_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FSW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_uint32)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FSW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(11, 7); +imm += R_imm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(31, 25); +imm += R_imm_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fsw" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FMADD_S --------------------------------------------------------------------- +static InstructionDefinition fmadd_s_rd_rm_rs1_rs2_rs3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fmadd_s", + (uint32_t) 0x000043, + (uint32_t) 0x600007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FMADD_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 res = fmadd_s(unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]), unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs3) + "ULL]), 0ULL, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FMADD_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fmadd_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rs3=" + std::to_string(rs3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FMSUB_S --------------------------------------------------------------------- +static InstructionDefinition fmsub_s_rd_rm_rs1_rs2_rs3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fmsub_s", + (uint32_t) 0x000047, + (uint32_t) 0x600007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FMSUB_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 res = fmadd_s(unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]), unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]), unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs3) + "ULL]), 1ULL, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FMSUB_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fmsub_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rs3=" + std::to_string(rs3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FNMADD_S -------------------------------------------------------------------- +static InstructionDefinition fnmadd_s_rd_rm_rs1_rs2_rs3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fnmadd_s", + (uint32_t) 0x00004f, + (uint32_t) 0x600007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FNMADD_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs3 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs3) + "ULL]);\n"; +cp.code() += "etiss_uint32 res = fmadd_s(frs1, frs2, frs3, 2ULL, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FNMADD_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fnmadd_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rs3=" + std::to_string(rs3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FNMSUB_S -------------------------------------------------------------------- +static InstructionDefinition fnmsub_s_rd_rm_rs1_rs2_rs3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fnmsub_s", + (uint32_t) 0x00004b, + (uint32_t) 0x600007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FNMSUB_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs3 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs3) + "ULL]);\n"; +cp.code() += "etiss_uint32 res = fmadd_s(frs1, frs2, frs3, 3ULL, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FNMSUB_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(31, 27); +rs3 += R_rs3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fnmsub_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rs3=" + std::to_string(rs3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FADD_S ---------------------------------------------------------------------- +static InstructionDefinition fadd_s_rd_rm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fadd_s", + (uint32_t) 0x000053, + (uint32_t) 0xfe00007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FADD_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "etiss_uint32 res = fadd_s(frs1, frs2, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FADD_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fadd_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FSUB_S ---------------------------------------------------------------------- +static InstructionDefinition fsub_s_rd_rm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fsub_s", + (uint32_t) 0x8000053, + (uint32_t) 0xfe00007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FSUB_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "etiss_uint32 res = fsub_s(frs1, frs2, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FSUB_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fsub_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FMUL_S ---------------------------------------------------------------------- +static InstructionDefinition fmul_s_rd_rm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fmul_s", + (uint32_t) 0x10000053, + (uint32_t) 0xfe00007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FMUL_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "etiss_uint32 res = fmul_s(frs1, frs2, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FMUL_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fmul_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FDIV_S ---------------------------------------------------------------------- +static InstructionDefinition fdiv_s_rd_rm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fdiv_s", + (uint32_t) 0x18000053, + (uint32_t) 0xfe00007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FDIV_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "etiss_uint32 res = fdiv_s(frs1, frs2, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FDIV_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fdiv_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FSQRT_S --------------------------------------------------------------------- +static InstructionDefinition fsqrt_s_rd_rm_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fsqrt_s", + (uint32_t) 0x58000053, + (uint32_t) 0xfff0007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FSQRT_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 res = fsqrt_s(frs1, get_rm(cpu, system, plugin_pointers, " + std::to_string(rm) + "ULL));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FSQRT_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fsqrt_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FSGNJ_S --------------------------------------------------------------------- +static InstructionDefinition fsgnj_s_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fsgnj_s", + (uint32_t) 0x20000053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FSGNJ_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "etiss_uint32 res = ((((((frs2) >> (31ULL)) & 1)) << 31) | ((((frs1) >> (0ULL)) & 2147483647)));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FSGNJ_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fsgnj_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FSGNJN_S -------------------------------------------------------------------- +static InstructionDefinition fsgnjn_s_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fsgnjn_s", + (uint32_t) 0x20001053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FSGNJN_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "etiss_uint32 res = (((~((((frs2) >> (31ULL)) & 1))) << 31) | ((((frs1) >> (0ULL)) & 2147483647)));\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FSGNJN_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fsgnjn_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FSGNJX_S -------------------------------------------------------------------- +static InstructionDefinition fsgnjx_s_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fsgnjx_s", + (uint32_t) 0x20002053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FSGNJX_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "etiss_uint32 res = frs1 ^ (frs2 & 2147483648ULL);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FSGNJX_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fsgnjx_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FMIN_S ---------------------------------------------------------------------- +static InstructionDefinition fmin_s_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fmin_s", + (uint32_t) 0x28000053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FMIN_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "etiss_uint32 res = fsel_s(frs1, frs2, 0ULL);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FMIN_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fmin_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FMAX_S ---------------------------------------------------------------------- +static InstructionDefinition fmax_s_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fmax_s", + (uint32_t) 0x28001053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FMAX_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "etiss_uint32 res = fsel_s(frs1, frs2, 1ULL);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FMAX_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fmax_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FCVT_W_S -------------------------------------------------------------------- +static InstructionDefinition fcvt_w_s_rd_rm_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fcvt_w_s", + (uint32_t) 0xc0000053, + (uint32_t) 0xfff0007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FCVT_W_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 res = 0ULL;\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "res = fcvt_s(frs1, 0ULL, " + std::to_string(rm) + "ULL);\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res;\n"; +} // conditional +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FCVT_W_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fcvt_w_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FCVT_WU_S ------------------------------------------------------------------- +static InstructionDefinition fcvt_wu_s_rd_rm_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fcvt_wu_s", + (uint32_t) 0xc0100053, + (uint32_t) 0xfff0007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FCVT_WU_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 res = 0ULL;\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "res = fcvt_s(frs1, 1ULL, " + std::to_string(rm) + "ULL);\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint32)((etiss_int32)(res));\n"; +} // conditional +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FCVT_WU_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fcvt_wu_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FEQ_S ----------------------------------------------------------------------- +static InstructionDefinition feq_s_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "feq_s", + (uint32_t) 0xa0002053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FEQ_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 res = 0ULL;\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "res = fcmp_s(frs1, frs2, 0ULL);\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res;\n"; +} // conditional +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FEQ_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "feq_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FLT_S ----------------------------------------------------------------------- +static InstructionDefinition flt_s_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "flt_s", + (uint32_t) 0xa0001053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FLT_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 res = 0ULL;\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "res = fcmp_s(frs1, frs2, 2ULL);\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res;\n"; +} // conditional +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FLT_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "flt_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FLE_S ----------------------------------------------------------------------- +static InstructionDefinition fle_s_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fle_s", + (uint32_t) 0xa0000053, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FLE_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 res = 0ULL;\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 frs1 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "etiss_uint32 frs2 = unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "res = fcmp_s(frs1, frs2, 1ULL);\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res;\n"; +} // conditional +cp.code() += "etiss_uint32 flags = fget_flags();\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR = (((RV32IMAFDXCoreVHwlpV0*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FLE_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fle_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FCLASS_S -------------------------------------------------------------------- +static InstructionDefinition fclass_s_rd_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fclass_s", + (uint32_t) 0xe0001053, + (uint32_t) 0xfff0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FCLASS_S\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 res = 0ULL;\n"; +cp.code() += "res = fclass_s(unbox_s(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]));\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = res;\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FCLASS_S\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fclass_s" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FCVT_S_W -------------------------------------------------------------------- +static InstructionDefinition fcvt_s_w_rd_rm_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fcvt_s_w", + (uint32_t) 0xd0000053, + (uint32_t) 0xfff0007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FCVT_S_W\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 res = fcvt_s((etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]), 2ULL, " + std::to_string(rm) + "ULL);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FCVT_S_W\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fcvt_s_w" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FCVT_S_WU ------------------------------------------------------------------- +static InstructionDefinition fcvt_s_wu_rd_rm_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fcvt_s_wu", + (uint32_t) 0xd0100053, + (uint32_t) 0xfff0007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FCVT_S_WU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 res = fcvt_s((etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]), 3ULL, " + std::to_string(rm) + "ULL);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(res);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FCVT_S_WU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rm = 0; +static BitArrayRange R_rm_0(14, 12); +rm += R_rm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fcvt_s_wu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rm=" + std::to_string(rm) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FMV_X_W --------------------------------------------------------------------- +static InstructionDefinition fmv_x_w_rd_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fmv_x_w", + (uint32_t) 0xe0000053, + (uint32_t) 0xfff0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FMV_X_W\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint32)((etiss_int32)(((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rs1) + "ULL]));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FMV_X_W\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fmv_x_w" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FMV_W_X --------------------------------------------------------------------- +static InstructionDefinition fmv_w_x_rd_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fmv_w_x", + (uint32_t) 0xf0000053, + (uint32_t) 0xfff0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FMV_W_X\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->F[" + std::to_string(rd) + "ULL] = -4294967296LL | (etiss_uint64)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FMV_W_X\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fmv_w_x" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32IInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32IInstr.cpp new file mode 100644 index 0000000000..836d630a49 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32IInstr.cpp @@ -0,0 +1,5327 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the RV32I + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// LUI ------------------------------------------------------------------------- +static InstructionDefinition lui_rd_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "lui", + (uint32_t) 0x000037, + (uint32_t) 0x00007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint32 imm = 0; +static BitArrayRange R_imm_12(31, 12); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//LUI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = " + std::to_string((etiss_uint32)(((etiss_int32)(imm)))) + "ULL;\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//LUI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint32 imm = 0; +static BitArrayRange R_imm_12(31, 12); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "lui" << " # " << ba << (" [rd=" + std::to_string(rd) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// AUIPC ----------------------------------------------------------------------- +static InstructionDefinition auipc_rd_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "auipc", + (uint32_t) 0x000017, + (uint32_t) 0x00007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint32 imm = 0; +static BitArrayRange R_imm_12(31, 12); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//AUIPC\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = " + std::to_string(ic.current_address_ + (etiss_int32)(imm)) + "LL;\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//AUIPC\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint32 imm = 0; +static BitArrayRange R_imm_12(31, 12); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "auipc" << " # " << ba << (" [rd=" + std::to_string(rd) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// JAL ------------------------------------------------------------------------- +static InstructionDefinition jal_rd_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "jal", + (uint32_t) 0x00006f, + (uint32_t) 0x00007f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint32 imm = 0; +static BitArrayRange R_imm_12(19, 12); +imm += R_imm_12.read(ba) << 12; +static BitArrayRange R_imm_11(20, 20); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(30, 21); +imm += R_imm_1.read(ba) << 1; +static BitArrayRange R_imm_20(31, 31); +imm += R_imm_20.read(ba) << 20; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//JAL\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (imm % 4ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = " + std::to_string(ic.current_address_ + 4ULL) + "ULL;\n"; +} // conditional +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int32)(((etiss_int32)imm) << (11)) >> (11))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//JAL\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint32 imm = 0; +static BitArrayRange R_imm_12(19, 12); +imm += R_imm_12.read(ba) << 12; +static BitArrayRange R_imm_11(20, 20); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(30, 21); +imm += R_imm_1.read(ba) << 1; +static BitArrayRange R_imm_20(31, 31); +imm += R_imm_20.read(ba) << 20; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "jal" << " # " << ba << (" [rd=" + std::to_string(rd) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// JALR ------------------------------------------------------------------------ +static InstructionDefinition jalr_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "jalr", + (uint32_t) 0x000067, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//JALR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 new_pc = (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL) & -2LL;\n"; +cp.code() += "if (new_pc % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = " + std::to_string(ic.current_address_ + 4ULL) + "ULL;\n"; +} // conditional +cp.code() += "cpu->nextPc = new_pc & -2LL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//JALR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "jalr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// BEQ ------------------------------------------------------------------------- +static InstructionDefinition beq_imm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "beq", + (uint32_t) 0x000063, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//BEQ\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] == *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +if (imm % 4ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (3)) >> (3))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//BEQ\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "beq" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// BNE ------------------------------------------------------------------------- +static InstructionDefinition bne_imm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "bne", + (uint32_t) 0x001063, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//BNE\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] != *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +if (imm % 4ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (3)) >> (3))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//BNE\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "bne" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// BLT ------------------------------------------------------------------------- +static InstructionDefinition blt_imm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "blt", + (uint32_t) 0x004063, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//BLT\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if ((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]) < (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL])) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +if (imm % 4ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (3)) >> (3))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//BLT\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "blt" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// BGE ------------------------------------------------------------------------- +static InstructionDefinition bge_imm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "bge", + (uint32_t) 0x005063, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//BGE\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if ((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]) >= (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL])) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +if (imm % 4ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (3)) >> (3))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//BGE\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "bge" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// BLTU ------------------------------------------------------------------------ +static InstructionDefinition bltu_imm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "bltu", + (uint32_t) 0x006063, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//BLTU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] < *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +if (imm % 4ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (3)) >> (3))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//BLTU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "bltu" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// BGEU ------------------------------------------------------------------------ +static InstructionDefinition bgeu_imm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "bgeu", + (uint32_t) 0x007063, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//BGEU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] >= *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +if (imm % 4ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (3)) >> (3))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//BGEU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "bgeu" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// LB -------------------------------------------------------------------------- +static InstructionDefinition lb_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "lb", + (uint32_t) 0x000003, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//LB\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +cp.code() += "etiss_uint8 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 1);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int8 res = (etiss_int8)(mem_val_0);\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//LB\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "lb" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// LH -------------------------------------------------------------------------- +static InstructionDefinition lh_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "lh", + (uint32_t) 0x001003, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//LH\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +cp.code() += "etiss_uint16 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 2);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int16 res = (etiss_int16)(mem_val_0);\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//LH\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "lh" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// LW -------------------------------------------------------------------------- +static InstructionDefinition lw_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "lw", + (uint32_t) 0x002003, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//LW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int32 res = (etiss_int32)(mem_val_0);\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//LW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "lw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// LBU ------------------------------------------------------------------------- +static InstructionDefinition lbu_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "lbu", + (uint32_t) 0x004003, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//LBU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +cp.code() += "etiss_uint8 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 1);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint8 res = (etiss_uint8)(mem_val_0);\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//LBU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "lbu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// LHU ------------------------------------------------------------------------- +static InstructionDefinition lhu_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "lhu", + (uint32_t) 0x005003, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//LHU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +cp.code() += "etiss_uint16 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 2);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint16 res = (etiss_uint16)(mem_val_0);\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//LHU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "lhu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SB -------------------------------------------------------------------------- +static InstructionDefinition sb_imm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "sb", + (uint32_t) 0x000023, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(11, 7); +imm += R_imm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(31, 25); +imm += R_imm_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SB\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 store_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +cp.code() += "etiss_uint8 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int8)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, store_address, (etiss_uint8*)&mem_val_0, 1);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SB\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(11, 7); +imm += R_imm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(31, 25); +imm += R_imm_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "sb" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SH -------------------------------------------------------------------------- +static InstructionDefinition sh_imm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "sh", + (uint32_t) 0x001023, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(11, 7); +imm += R_imm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(31, 25); +imm += R_imm_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SH\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 store_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +cp.code() += "etiss_uint16 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int16)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, store_address, (etiss_uint8*)&mem_val_0, 2);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SH\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(11, 7); +imm += R_imm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(31, 25); +imm += R_imm_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "sh" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SW -------------------------------------------------------------------------- +static InstructionDefinition sw_imm_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "sw", + (uint32_t) 0x002023, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(11, 7); +imm += R_imm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(31, 25); +imm += R_imm_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 store_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, store_address, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(11, 7); +imm += R_imm_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm_5(31, 25); +imm += R_imm_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "sw" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// ADDI ------------------------------------------------------------------------ +static InstructionDefinition addi_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "addi", + (uint32_t) 0x000013, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//ADDI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//ADDI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "addi" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SLTI ------------------------------------------------------------------------ +static InstructionDefinition slti_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "slti", + (uint32_t) 0x002013, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SLTI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]) < " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL)) ? (1ULL) : (0ULL);\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SLTI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "slti" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SLTIU ----------------------------------------------------------------------- +static InstructionDefinition sltiu_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "sltiu", + (uint32_t) 0x003013, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SLTIU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = ((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] < " + std::to_string((etiss_uint32)((((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))))) + "ULL)) ? (1ULL) : (0ULL);\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SLTIU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "sltiu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// XORI ------------------------------------------------------------------------ +static InstructionDefinition xori_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "xori", + (uint32_t) 0x004013, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//XORI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] ^ " + std::to_string((etiss_uint32)((((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))))) + "ULL;\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//XORI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "xori" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// ORI ------------------------------------------------------------------------- +static InstructionDefinition ori_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "ori", + (uint32_t) 0x006013, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//ORI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] | " + std::to_string((etiss_uint32)((((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))))) + "ULL;\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//ORI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "ori" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// ANDI ------------------------------------------------------------------------ +static InstructionDefinition andi_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "andi", + (uint32_t) 0x007013, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//ANDI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] & " + std::to_string((etiss_uint32)((((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))))) + "ULL;\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//ANDI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "andi" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SLLI ------------------------------------------------------------------------ +static InstructionDefinition slli_rd_rs1_shamt ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "slli", + (uint32_t) 0x001013, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 shamt = 0; +static BitArrayRange R_shamt_0(24, 20); +shamt += R_shamt_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SLLI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] << " + std::to_string(shamt) + "ULL;\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SLLI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 shamt = 0; +static BitArrayRange R_shamt_0(24, 20); +shamt += R_shamt_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "slli" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | shamt=" + std::to_string(shamt) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SRLI ------------------------------------------------------------------------ +static InstructionDefinition srli_rd_rs1_shamt ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "srli", + (uint32_t) 0x005013, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 shamt = 0; +static BitArrayRange R_shamt_0(24, 20); +shamt += R_shamt_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SRLI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] >> " + std::to_string(shamt) + "ULL;\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SRLI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 shamt = 0; +static BitArrayRange R_shamt_0(24, 20); +shamt += R_shamt_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "srli" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | shamt=" + std::to_string(shamt) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SRAI ------------------------------------------------------------------------ +static InstructionDefinition srai_rd_rs1_shamt ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "srai", + (uint32_t) 0x40005013, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 shamt = 0; +static BitArrayRange R_shamt_0(24, 20); +shamt += R_shamt_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SRAI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]) >> " + std::to_string(shamt) + "ULL;\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SRAI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 shamt = 0; +static BitArrayRange R_shamt_0(24, 20); +shamt += R_shamt_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "srai" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | shamt=" + std::to_string(shamt) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// ADD ------------------------------------------------------------------------- +static InstructionDefinition add_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "add", + (uint32_t) 0x000033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//ADD\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//ADD\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "add" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SUB ------------------------------------------------------------------------- +static InstructionDefinition sub_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "sub", + (uint32_t) 0x40000033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SUB\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] - *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SUB\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "sub" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SLL ------------------------------------------------------------------------- +static InstructionDefinition sll_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "sll", + (uint32_t) 0x001033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SLL\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] << (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL] & 31ULL);\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SLL\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "sll" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SLT ------------------------------------------------------------------------- +static InstructionDefinition slt_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "slt", + (uint32_t) 0x002033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SLT\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = ((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]) < (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL])) ? (1ULL) : (0ULL);\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SLT\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "slt" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SLTU ------------------------------------------------------------------------ +static InstructionDefinition sltu_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "sltu", + (uint32_t) 0x003033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SLTU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] < *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) ? (1ULL) : (0ULL);\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SLTU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "sltu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// XOR ------------------------------------------------------------------------- +static InstructionDefinition xor_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "xor", + (uint32_t) 0x004033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//XOR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] ^ *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//XOR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "xor" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SRL ------------------------------------------------------------------------- +static InstructionDefinition srl_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "srl", + (uint32_t) 0x005033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SRL\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] >> (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL] & 31ULL);\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SRL\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "srl" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SRA ------------------------------------------------------------------------- +static InstructionDefinition sra_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "sra", + (uint32_t) 0x40005033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SRA\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]) >> (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL] & 31ULL);\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SRA\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "sra" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// OR -------------------------------------------------------------------------- +static InstructionDefinition or_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "or", + (uint32_t) 0x006033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//OR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] | *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//OR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "or" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// AND ------------------------------------------------------------------------- +static InstructionDefinition and_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "and", + (uint32_t) 0x007033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//AND\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] & *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n"; +} // conditional +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//AND\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "and" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// FENCE ----------------------------------------------------------------------- +static InstructionDefinition fence_rd_rs1_succ_pred_fm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fence", + (uint32_t) 0x00000f, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 succ = 0; +static BitArrayRange R_succ_0(23, 20); +succ += R_succ_0.read(ba) << 0; +etiss_uint8 pred = 0; +static BitArrayRange R_pred_0(27, 24); +pred += R_pred_0.read(ba) << 0; +etiss_uint8 fm = 0; +static BitArrayRange R_fm_0(31, 28); +fm += R_fm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FENCE\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FENCE[0ULL] = " + std::to_string(pred << 4ULL | succ) + "ULL;\n"; +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FENCE\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 succ = 0; +static BitArrayRange R_succ_0(23, 20); +succ += R_succ_0.read(ba) << 0; +etiss_uint8 pred = 0; +static BitArrayRange R_pred_0(27, 24); +pred += R_pred_0.read(ba) << 0; +etiss_uint8 fm = 0; +static BitArrayRange R_fm_0(31, 28); +fm += R_fm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fence" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | succ=" + std::to_string(succ) + " | pred=" + std::to_string(pred) + " | fm=" + std::to_string(fm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32MInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32MInstr.cpp new file mode 100644 index 0000000000..618461e8d7 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_RV32MInstr.cpp @@ -0,0 +1,1155 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the RV32M + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// MUL ------------------------------------------------------------------------- +static InstructionDefinition mul_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "mul", + (uint32_t) 0x2000033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//MUL\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int64 res = (etiss_int64)((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL])) * (etiss_int64)((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint32)(res);\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//MUL\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "mul" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// MULH ------------------------------------------------------------------------ +static InstructionDefinition mulh_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "mulh", + (uint32_t) 0x2001033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//MULH\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int64 res = (etiss_int64)((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL])) * (etiss_int64)((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint32)((res >> 32ULL));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//MULH\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "mulh" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// MULHSU ---------------------------------------------------------------------- +static InstructionDefinition mulhsu_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "mulhsu", + (uint32_t) 0x2002033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//MULHSU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int64 res = (etiss_int64)((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL])) * (etiss_uint64)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint32)((res >> 32ULL));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//MULHSU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "mulhsu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// MULHU ----------------------------------------------------------------------- +static InstructionDefinition mulhu_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "mulhu", + (uint32_t) 0x2003033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//MULHU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint64 res = (etiss_uint64)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]) * (etiss_uint64)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint32)((res >> 32ULL));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//MULHU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "mulhu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// DIV ------------------------------------------------------------------------- +static InstructionDefinition div_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "div", + (uint32_t) 0x2004033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//DIV\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL] != 0ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +etiss_uint32 MMIN = 2147483648ULL; +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] == " + std::to_string(MMIN) + "ULL && (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) == -1LL) { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = " + std::to_string(MMIN) + "ULL;\n"; +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]) / (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n"; +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = -1LL;\n"; +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//DIV\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "div" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// DIVU ------------------------------------------------------------------------ +static InstructionDefinition divu_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "divu", + (uint32_t) 0x2005033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//DIVU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL] != 0ULL) { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] / *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n"; +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = -1LL;\n"; +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//DIVU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "divu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// REM ------------------------------------------------------------------------- +static InstructionDefinition rem_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "rem", + (uint32_t) 0x2006033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//REM\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL] != 0ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +etiss_uint32 MMIN = 2147483648ULL; +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] == " + std::to_string(MMIN) + "ULL && (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) == -1LL) { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = 0ULL;\n"; +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]) % (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n"; +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//REM\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "rem" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// REMU ------------------------------------------------------------------------ +static InstructionDefinition remu_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "remu", + (uint32_t) 0x2007033, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//REMU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL] != 0ULL) { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] % *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n"; +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//REMU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "remu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVAluInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVAluInstr.cpp new file mode 100644 index 0000000000..9cd50c9d78 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVAluInstr.cpp @@ -0,0 +1,4320 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the XCoreVAlu + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// CV_ABS ---------------------------------------------------------------------- +static InstructionDefinition cv_abs_rd_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_abs", + (uint32_t) 0x5000302b, + (uint32_t) 0xfff0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ABS\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) < 0ULL)) ? (((((-(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]))) >> (0ULL)) & 4294967295)) : (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]);\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ABS\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_abs" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SLET --------------------------------------------------------------------- +static InstructionDefinition cv_slet_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_slet", + (uint32_t) 0x5200302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SLET\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint8)(((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) <= (etiss_int32)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295))));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SLET\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_slet" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SLETU -------------------------------------------------------------------- +static InstructionDefinition cv_sletu_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sletu", + (uint32_t) 0x5400302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SLETU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint8)(((etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) <= (etiss_uint32)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295))));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SLETU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sletu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MIN ---------------------------------------------------------------------- +static InstructionDefinition cv_min_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_min", + (uint32_t) 0x5600302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MIN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) < (etiss_int32)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)))) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MIN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_min" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MINU --------------------------------------------------------------------- +static InstructionDefinition cv_minu_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_minu", + (uint32_t) 0x5800302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MINU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) < (etiss_uint32)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)))) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MINU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_minu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAX ---------------------------------------------------------------------- +static InstructionDefinition cv_max_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_max", + (uint32_t) 0x5a00302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAX\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) > (etiss_int32)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)))) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAX\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_max" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAXU --------------------------------------------------------------------- +static InstructionDefinition cv_maxu_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_maxu", + (uint32_t) 0x5c00302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAXU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) > (etiss_uint32)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)))) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAXU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_maxu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_EXTHS -------------------------------------------------------------------- +static InstructionDefinition cv_exths_rd_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_exths", + (uint32_t) 0x6000302b, + (uint32_t) 0xfff0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_EXTHS\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_EXTHS\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_exths" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_EXTHZ -------------------------------------------------------------------- +static InstructionDefinition cv_exthz_rd_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_exthz", + (uint32_t) 0x6200302b, + (uint32_t) 0xfff0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_EXTHZ\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_EXTHZ\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_exthz" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_EXTBS -------------------------------------------------------------------- +static InstructionDefinition cv_extbs_rd_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_extbs", + (uint32_t) 0x6400302b, + (uint32_t) 0xfff0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_EXTBS\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_EXTBS\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_extbs" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_EXTBZ -------------------------------------------------------------------- +static InstructionDefinition cv_extbz_rd_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_extbz", + (uint32_t) 0x6600302b, + (uint32_t) 0xfff0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_EXTBZ\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_EXTBZ\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_extbz" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CLIP --------------------------------------------------------------------- +static InstructionDefinition cv_clip_rd_rs1_Iuimm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_clip", + (uint32_t) 0x7000302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Iuimm5 = 0; +static BitArrayRange R_Iuimm5_0(24, 20); +Iuimm5 += R_Iuimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CLIP\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +etiss_int32 a = ((Iuimm5)) ? (-((1ULL << (Iuimm5 - 1ULL)))) : (-1LL); +etiss_int32 b = ((Iuimm5)) ? (((1ULL << (Iuimm5 - 1ULL)) - 1ULL)) : (0ULL); +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] <= " + std::to_string(a) + "LL) { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = " + std::to_string(a) + "LL;\n"; +cp.code() += "} // conditional\n"; +cp.code() += " else if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] >= " + std::to_string(b) + "LL) { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = " + std::to_string(b) + "LL;\n"; +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CLIP\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Iuimm5 = 0; +static BitArrayRange R_Iuimm5_0(24, 20); +Iuimm5 += R_Iuimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_clip" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Iuimm5=" + std::to_string(Iuimm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CLIPU -------------------------------------------------------------------- +static InstructionDefinition cv_clipu_rd_rs1_Iuimm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_clipu", + (uint32_t) 0x7200302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Iuimm5 = 0; +static BitArrayRange R_Iuimm5_0(24, 20); +Iuimm5 += R_Iuimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CLIPU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +etiss_int32 a = 0ULL; +etiss_int32 b = ((Iuimm5)) ? (((1ULL << (Iuimm5 - 1ULL)) - 1ULL)) : (0ULL); +cp.code() += "if ((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) <= " + std::to_string(a) + "LL) { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = " + std::to_string(a) + "LL;\n"; +cp.code() += "} // conditional\n"; +cp.code() += " else if ((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >= " + std::to_string(b) + "LL) { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = " + std::to_string(b) + "LL;\n"; +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CLIPU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Iuimm5 = 0; +static BitArrayRange R_Iuimm5_0(24, 20); +Iuimm5 += R_Iuimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_clipu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Iuimm5=" + std::to_string(Iuimm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CLIPR -------------------------------------------------------------------- +static InstructionDefinition cv_clipr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_clipr", + (uint32_t) 0x7400302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CLIPR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 a = -(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295) + 1ULL));\n"; +cp.code() += "etiss_int32 b = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295);\n"; +cp.code() += "if ((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) <= a) { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = a;\n"; +cp.code() += "} // conditional\n"; +cp.code() += " else if ((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >= b) { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = b;\n"; +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CLIPR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_clipr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CLIPUR ------------------------------------------------------------------- +static InstructionDefinition cv_clipur_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_clipur", + (uint32_t) 0x7600302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CLIPUR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +etiss_int32 a = 0ULL; +cp.code() += "etiss_int32 b = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295);\n"; +cp.code() += "if ((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) <= " + std::to_string(a) + "LL) { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = " + std::to_string(a) + "LL;\n"; +cp.code() += "} // conditional\n"; +cp.code() += " else if ((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >= b) { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = b;\n"; +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CLIPUR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_clipur" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADDN --------------------------------------------------------------------- +static InstructionDefinition cv_addn_rd_rs1_rs2_Luimm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_addn", + (uint32_t) 0x00205b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADDN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295))) >> " + std::to_string(Luimm5) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADDN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_addn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Luimm5=" + std::to_string(Luimm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADDUN -------------------------------------------------------------------- +static InstructionDefinition cv_addun_rd_rs1_rs2_Luimm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_addun", + (uint32_t) 0x4000205b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADDUN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295))) >> " + std::to_string(Luimm5) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADDUN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_addun" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Luimm5=" + std::to_string(Luimm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADDRN -------------------------------------------------------------------- +static InstructionDefinition cv_addrn_rd_rs1_rs2_Luimm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_addrn", + (uint32_t) 0x8000205b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADDRN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295) + " + std::to_string((1ULL << (Luimm5 - 1ULL))) + "ULL)) >> " + std::to_string(Luimm5) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADDRN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_addrn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Luimm5=" + std::to_string(Luimm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADDURN ------------------------------------------------------------------- +static InstructionDefinition cv_addurn_rd_rs1_rs2_Luimm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_addurn", + (uint32_t) 0xc000205b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADDURN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295) + " + std::to_string((1ULL << (Luimm5 - 1ULL))) + "ULL)) >> " + std::to_string(Luimm5) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADDURN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_addurn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Luimm5=" + std::to_string(Luimm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUBN --------------------------------------------------------------------- +static InstructionDefinition cv_subn_rd_rs1_rs2_Luimm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_subn", + (uint32_t) 0x00305b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUBN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295))) >> " + std::to_string(Luimm5) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUBN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_subn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Luimm5=" + std::to_string(Luimm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUBUN -------------------------------------------------------------------- +static InstructionDefinition cv_subun_rd_rs1_rs2_Luimm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_subun", + (uint32_t) 0x4000305b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUBUN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295))) >> " + std::to_string(Luimm5) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUBUN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_subun" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Luimm5=" + std::to_string(Luimm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUBRN -------------------------------------------------------------------- +static InstructionDefinition cv_subrn_rd_rs1_rs2_Luimm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_subrn", + (uint32_t) 0x8000305b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUBRN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295) + " + std::to_string((1ULL << (Luimm5 - 1ULL))) + "ULL)) >> " + std::to_string(Luimm5) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUBRN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_subrn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Luimm5=" + std::to_string(Luimm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUBURN ------------------------------------------------------------------- +static InstructionDefinition cv_suburn_rd_rs1_rs2_Luimm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_suburn", + (uint32_t) 0xc000305b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUBURN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295) + " + std::to_string((1ULL << (Luimm5 - 1ULL))) + "ULL)) >> " + std::to_string(Luimm5) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUBURN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_suburn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Luimm5=" + std::to_string(Luimm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADDNR -------------------------------------------------------------------- +static InstructionDefinition cv_addnr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_addnr", + (uint32_t) 0x8000302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADDNR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL])) >> ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31);\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADDNR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_addnr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADDUNR ------------------------------------------------------------------- +static InstructionDefinition cv_addunr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_addunr", + (uint32_t) 0x8200302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADDUNR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL])) >> ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31);\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADDUNR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_addunr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADDRNR ------------------------------------------------------------------- +static InstructionDefinition cv_addrnr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_addrnr", + (uint32_t) 0x8400302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADDRNR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (1ULL << (((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31) - 1ULL)))) >> ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31);\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADDRNR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_addrnr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADDURNR ------------------------------------------------------------------ +static InstructionDefinition cv_addurnr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_addurnr", + (uint32_t) 0x8600302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADDURNR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (1ULL << (((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31) - 1ULL)))) >> ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31);\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADDURNR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_addurnr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUBNR -------------------------------------------------------------------- +static InstructionDefinition cv_subnr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_subnr", + (uint32_t) 0x8800302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUBNR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] - *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL])) >> ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31);\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUBNR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_subnr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUBUNR ------------------------------------------------------------------- +static InstructionDefinition cv_subunr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_subunr", + (uint32_t) 0x8a00302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUBUNR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] - *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL])) >> ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31);\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUBUNR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_subunr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUBRNR ------------------------------------------------------------------- +static InstructionDefinition cv_subrnr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_subrnr", + (uint32_t) 0x8c00302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUBRNR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] - *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (1ULL << (((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31) - 1ULL)))) >> ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31);\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUBRNR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_subrnr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUBURNR ------------------------------------------------------------------ +static InstructionDefinition cv_suburnr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_suburnr", + (uint32_t) 0x8e00302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUBURNR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] - *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (1ULL << (((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31) - 1ULL)))) >> ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31);\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUBURNR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_suburnr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVBitmanipInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVBitmanipInstr.cpp new file mode 100644 index 0000000000..81519e9f3a --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVBitmanipInstr.cpp @@ -0,0 +1,575 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the XCoreVBitmanip + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// CV_EXTRACT ------------------------------------------------------------------ +static InstructionDefinition cv_extract_rd_rs1_Iuimm5_Luimm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_extract", + (uint32_t) 0x00005b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Iuimm5 = 0; +static BitArrayRange R_Iuimm5_0(24, 20); +Iuimm5 += R_Iuimm5_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_EXTRACT\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_int32)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] >> " + std::to_string(Iuimm5) + "ULL) & " + std::to_string(((2ULL << Luimm5) - 1ULL)) + "ULL) << " + std::to_string((31ULL - Luimm5)) + "ULL)) >> " + std::to_string((31ULL - Luimm5)) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_EXTRACT\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Iuimm5 = 0; +static BitArrayRange R_Iuimm5_0(24, 20); +Iuimm5 += R_Iuimm5_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_extract" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Iuimm5=" + std::to_string(Iuimm5) + " | Luimm5=" + std::to_string(Luimm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_EXTRACTU ----------------------------------------------------------------- +static InstructionDefinition cv_extractu_rd_rs1_Iuimm5_Luimm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_extractu", + (uint32_t) 0x4000005b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Iuimm5 = 0; +static BitArrayRange R_Iuimm5_0(24, 20); +Iuimm5 += R_Iuimm5_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_EXTRACTU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] >> " + std::to_string(Iuimm5) + "ULL) & " + std::to_string(((2ULL << Luimm5) - 1ULL)) + "ULL));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_EXTRACTU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Iuimm5 = 0; +static BitArrayRange R_Iuimm5_0(24, 20); +Iuimm5 += R_Iuimm5_0.read(ba) << 0; +etiss_uint8 Luimm5 = 0; +static BitArrayRange R_Luimm5_0(29, 25); +Luimm5 += R_Luimm5_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_extractu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Iuimm5=" + std::to_string(Iuimm5) + " | Luimm5=" + std::to_string(Luimm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_EXTRACTR ----------------------------------------------------------------- +static InstructionDefinition cv_extractr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_extractr", + (uint32_t) 0x3000302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_EXTRACTR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_int32)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] >> ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31)) & ((2ULL << ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (5ULL)) & 31)) - 1ULL)) << (31ULL - ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (5ULL)) & 31)))) >> (31ULL - ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (5ULL)) & 31));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_EXTRACTR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_extractr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_EXTRACTUR ---------------------------------------------------------------- +static InstructionDefinition cv_extractur_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_extractur", + (uint32_t) 0x3200302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_EXTRACTUR\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] >> ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (0ULL)) & 31)) & ((2ULL << ((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 4294967295)) >> (5ULL)) & 31)) - 1ULL)));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_EXTRACTUR\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_extractur" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVBranchImmediateInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVBranchImmediateInstr.cpp new file mode 100644 index 0000000000..7a562f0bdf --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVBranchImmediateInstr.cpp @@ -0,0 +1,349 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the XCoreVBranchImmediate + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// CV_BEQIMM ------------------------------------------------------------------- +static InstructionDefinition cv_beqimm_imm_rs1_simm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_beqimm", + (uint32_t) 0x00600b, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 simm5 = 0; +static BitArrayRange R_simm5_0(24, 20); +simm5 += R_simm5_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_BEQIMM\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] == " + std::to_string(((etiss_int8)(((etiss_int8)simm5) << (3)) >> (3))) + "LL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +if (imm % 4ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (3)) >> (3))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_BEQIMM\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 simm5 = 0; +static BitArrayRange R_simm5_0(24, 20); +simm5 += R_simm5_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_beqimm" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | simm5=" + std::to_string(simm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_BNEIMM ------------------------------------------------------------------- +static InstructionDefinition cv_bneimm_imm_rs1_simm5 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_bneimm", + (uint32_t) 0x00700b, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 simm5 = 0; +static BitArrayRange R_simm5_0(24, 20); +simm5 += R_simm5_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_BNEIMM\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] != " + std::to_string(((etiss_int8)(((etiss_int8)simm5) << (3)) >> (3))) + "LL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +if (imm % 4ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (3)) >> (3))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_BNEIMM\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm = 0; +static BitArrayRange R_imm_11(7, 7); +imm += R_imm_11.read(ba) << 11; +static BitArrayRange R_imm_1(11, 8); +imm += R_imm_1.read(ba) << 1; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 simm5 = 0; +static BitArrayRange R_simm5_0(24, 20); +simm5 += R_simm5_0.read(ba) << 0; +static BitArrayRange R_imm_5(30, 25); +imm += R_imm_5.read(ba) << 5; +static BitArrayRange R_imm_12(31, 31); +imm += R_imm_12.read(ba) << 12; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_bneimm" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | simm5=" + std::to_string(simm5) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVHwlpV0Instr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVHwlpV0Instr.cpp new file mode 100644 index 0000000000..0e75cdadec --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVHwlpV0Instr.cpp @@ -0,0 +1,1475 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the XCoreVHwlpV0 + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// CV_STARTI ------------------------------------------------------------------- +static InstructionDefinition cv_starti_L_rs1_uimmL ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_starti", + (uint32_t) 0x00402b, + (uint32_t) 0x007f7f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 uimmL = 0; +static BitArrayRange R_uimmL_0(31, 20); +uimmL += R_uimmL_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_STARTI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (L == 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 = " + std::to_string((etiss_uint32)((ic.current_address_ + (uimmL << 2ULL)))) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 = " + std::to_string((etiss_uint32)((ic.current_address_ + (uimmL << 2ULL)))) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_STARTI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 uimmL = 0; +static BitArrayRange R_uimmL_0(31, 20); +uimmL += R_uimmL_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_starti" << " # " << ba << (" [L=" + std::to_string(L) + " | rs1=" + std::to_string(rs1) + " | uimmL=" + std::to_string(uimmL) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_START -------------------------------------------------------------------- +static InstructionDefinition cv_start_L_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_start", + (uint32_t) 0x00412b, + (uint32_t) 0xfff07f7f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_START\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (L == 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_START\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_start" << " # " << ba << (" [L=" + std::to_string(L) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ENDI --------------------------------------------------------------------- +static InstructionDefinition cv_endi_L_rs1_uimmL ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_endi", + (uint32_t) 0x00422b, + (uint32_t) 0x007f7f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 uimmL = 0; +static BitArrayRange R_uimmL_0(31, 20); +uimmL += R_uimmL_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ENDI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (L == 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 = " + std::to_string((etiss_uint32)((ic.current_address_ + (uimmL << 2ULL)))) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 = " + std::to_string((etiss_uint32)((ic.current_address_ + (uimmL << 2ULL)))) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ENDI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 uimmL = 0; +static BitArrayRange R_uimmL_0(31, 20); +uimmL += R_uimmL_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_endi" << " # " << ba << (" [L=" + std::to_string(L) + " | rs1=" + std::to_string(rs1) + " | uimmL=" + std::to_string(uimmL) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_END ---------------------------------------------------------------------- +static InstructionDefinition cv_end_L_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_end", + (uint32_t) 0x00432b, + (uint32_t) 0xfff07f7f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_END\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (L == 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_END\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_end" << " # " << ba << (" [L=" + std::to_string(L) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_COUNTI ------------------------------------------------------------------- +static InstructionDefinition cv_counti_L_uimmL ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_counti", + (uint32_t) 0x00442b, + (uint32_t) 0x0fff7f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint16 uimmL = 0; +static BitArrayRange R_uimmL_0(31, 20); +uimmL += R_uimmL_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_COUNTI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (L == 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = " + std::to_string((etiss_uint32)(uimmL)) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = " + std::to_string((etiss_uint32)(uimmL)) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_COUNTI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint16 uimmL = 0; +static BitArrayRange R_uimmL_0(31, 20); +uimmL += R_uimmL_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_counti" << " # " << ba << (" [L=" + std::to_string(L) + " | uimmL=" + std::to_string(uimmL) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_COUNT -------------------------------------------------------------------- +static InstructionDefinition cv_count_L_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_count", + (uint32_t) 0x00452b, + (uint32_t) 0xfff07f7f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_COUNT\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (L == 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_COUNT\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_count" << " # " << ba << (" [L=" + std::to_string(L) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SETUPI ------------------------------------------------------------------- +static InstructionDefinition cv_setupi_L_uimmS_uimmL ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_setupi", + (uint32_t) 0x00462b, + (uint32_t) 0x007f7f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 uimmS = 0; +static BitArrayRange R_uimmS_0(19, 15); +uimmS += R_uimmS_0.read(ba) << 0; +etiss_uint16 uimmL = 0; +static BitArrayRange R_uimmL_0(31, 20); +uimmL += R_uimmL_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SETUPI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (L == 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 = " + std::to_string((etiss_uint32)((ic.current_address_ + 4ULL))) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 = " + std::to_string((etiss_uint32)((ic.current_address_ + (uimmS << 2ULL)))) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = " + std::to_string((etiss_uint32)(uimmL)) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 = " + std::to_string((etiss_uint32)((ic.current_address_ + 4ULL))) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 = " + std::to_string((etiss_uint32)((ic.current_address_ + (uimmS << 2ULL)))) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = " + std::to_string((etiss_uint32)(uimmL)) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 0ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 < ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 + 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SETUPI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 uimmS = 0; +static BitArrayRange R_uimmS_0(19, 15); +uimmS += R_uimmS_0.read(ba) << 0; +etiss_uint16 uimmL = 0; +static BitArrayRange R_uimmL_0(31, 20); +uimmL += R_uimmL_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_setupi" << " # " << ba << (" [L=" + std::to_string(L) + " | uimmS=" + std::to_string(uimmS) + " | uimmL=" + std::to_string(uimmL) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SETUP -------------------------------------------------------------------- +static InstructionDefinition cv_setup_L_rs1_uimmL ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_setup", + (uint32_t) 0x00472b, + (uint32_t) 0x007f7f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 uimmL = 0; +static BitArrayRange R_uimmL_0(31, 20); +uimmL += R_uimmL_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SETUP\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (L == 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 = " + std::to_string((etiss_uint32)((ic.current_address_ + 4ULL))) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 = " + std::to_string((etiss_uint32)((ic.current_address_ + (uimmL << 2ULL)))) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 = " + std::to_string((etiss_uint32)((ic.current_address_ + 4ULL))) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 % 4ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 0ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 = " + std::to_string((etiss_uint32)((ic.current_address_ + (uimmL << 2ULL)))) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 0ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 < ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 + 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SETUP\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 L = 0; +static BitArrayRange R_L_0(7, 7); +L += R_L_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 uimmL = 0; +static BitArrayRange R_uimmL_0(31, 20); +uimmL += R_uimmL_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_setup" << " # " << ba << (" [L=" + std::to_string(L) + " | rs1=" + std::to_string(rs1) + " | uimmL=" + std::to_string(uimmL) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVMacInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVMacInstr.cpp new file mode 100644 index 0000000000..7312c3dc6b --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVMacInstr.cpp @@ -0,0 +1,2531 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the XCoreVMac + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// CV_MAC ---------------------------------------------------------------------- +static InstructionDefinition cv_mac_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_mac", + (uint32_t) 0x9000302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAC\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int128 result = ((etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) * (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL])) & 0x1ffffffffffffffff;\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(result);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAC\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_mac" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MSU ---------------------------------------------------------------------- +static InstructionDefinition cv_msu_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_msu", + (uint32_t) 0x9200302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MSU\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int64 result = (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) - (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) * (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((result) >> (0ULL)) & 4294967295);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MSU\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_msu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MULUN -------------------------------------------------------------------- +static InstructionDefinition cv_mulun_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_mulun", + (uint32_t) 0x00505b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MULUN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 result = ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> " + std::to_string(Is3) + "ULL;\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((result) >> (0ULL)) & 4294967295);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MULUN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_mulun" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MULHHUN ------------------------------------------------------------------ +static InstructionDefinition cv_mulhhun_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_mulhhun", + (uint32_t) 0x4000505b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MULHHUN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 result = ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> " + std::to_string(Is3) + "ULL;\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((result) >> (0ULL)) & 4294967295);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MULHHUN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_mulhhun" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MULSN -------------------------------------------------------------------- +static InstructionDefinition cv_mulsn_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_mulsn", + (uint32_t) 0x00405b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MULSN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 result = ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> " + std::to_string(Is3) + "ULL;\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((result) >> (0ULL)) & 4294967295);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MULSN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_mulsn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MULHHSN ------------------------------------------------------------------ +static InstructionDefinition cv_mulhhsn_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_mulhhsn", + (uint32_t) 0x4000405b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MULHHSN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 result = ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> " + std::to_string(Is3) + "ULL;\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((result) >> (0ULL)) & 4294967295);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MULHHSN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_mulhhsn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MULURN ------------------------------------------------------------------- +static InstructionDefinition cv_mulurn_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_mulurn", + (uint32_t) 0x8000505b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MULURN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 product = ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) & 0x7fffffff;\n"; +etiss_uint32 powerOf2 = (1ULL << (Is3 - 1ULL)) & 0x3fffffff; +cp.code() += "etiss_uint32 sum = product + " + std::to_string(powerOf2) + "ULL;\n"; +cp.code() += "etiss_uint32 rounded = sum >> " + std::to_string(Is3) + "ULL;\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((rounded) >> (0ULL)) & 4294967295);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MULURN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_mulurn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MULHHURN ----------------------------------------------------------------- +static InstructionDefinition cv_mulhhurn_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_mulhhurn", + (uint32_t) 0xc000505b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MULHHURN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 product = ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) & 0x7fffffff;\n"; +etiss_uint32 powerOf2 = (1ULL << (Is3 - 1ULL)) & 0x3fffffff; +cp.code() += "etiss_uint32 sum = product + " + std::to_string(powerOf2) + "ULL;\n"; +cp.code() += "etiss_uint32 rounded = sum >> " + std::to_string(Is3) + "ULL;\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((rounded) >> (0ULL)) & 4294967295);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MULHHURN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_mulhhurn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MULSRN ------------------------------------------------------------------- +static InstructionDefinition cv_mulsrn_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_mulsrn", + (uint32_t) 0x8000405b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MULSRN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 product = ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) & 0x7fffffff;\n"; +etiss_uint32 powerOf2 = (1ULL << (Is3 - 1ULL)) & 0x3fffffff; +cp.code() += "etiss_int32 sum = product + " + std::to_string(powerOf2) + "ULL;\n"; +cp.code() += "etiss_int32 rounded = sum >> " + std::to_string(Is3) + "ULL;\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((rounded) >> (0ULL)) & 4294967295);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MULSRN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_mulsrn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MULHHSRN ----------------------------------------------------------------- +static InstructionDefinition cv_mulhhsrn_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_mulhhsrn", + (uint32_t) 0xc000405b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MULHHSRN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 product = ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) & 0x7fffffff;\n"; +etiss_uint32 powerOf2 = (1ULL << (Is3 - 1ULL)) & 0x3fffffff; +cp.code() += "etiss_int32 sum = product + " + std::to_string(powerOf2) + "ULL;\n"; +cp.code() += "etiss_int32 rounded = sum >> " + std::to_string(Is3) + "ULL;\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((rounded) >> (0ULL)) & 4294967295);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MULHHSRN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_mulhhsrn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MACUN -------------------------------------------------------------------- +static InstructionDefinition cv_macun_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_macun", + (uint32_t) 0x00705b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MACUN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 result = ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) + (etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL])) >> " + std::to_string(Is3) + "ULL;\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((result) >> (0ULL)) & 4294967295);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MACUN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_macun" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MACHHUN ------------------------------------------------------------------ +static InstructionDefinition cv_machhun_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_machhun", + (uint32_t) 0x4000705b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MACHHUN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 result = ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) + (etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL])) >> " + std::to_string(Is3) + "ULL;\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((result) >> (0ULL)) & 4294967295);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MACHHUN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_machhun" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MACSN -------------------------------------------------------------------- +static InstructionDefinition cv_macsn_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_macsn", + (uint32_t) 0x8000105b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MACSN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 result = ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL])) >> " + std::to_string(Is3) + "ULL;\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((result) >> (0ULL)) & 4294967295);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MACSN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_macsn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MACHHSN ------------------------------------------------------------------ +static InstructionDefinition cv_machhsn_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_machhsn", + (uint32_t) 0xc000105b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MACHHSN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 result = ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL])) >> " + std::to_string(Is3) + "ULL;\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((result) >> (0ULL)) & 4294967295);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MACHHSN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_machhsn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MACURN ------------------------------------------------------------------- +static InstructionDefinition cv_macurn_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_macurn", + (uint32_t) 0x8000605b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MACURN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 product = ((etiss_uint16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535))) * (etiss_uint16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) & 0x3fffffff;\n"; +etiss_uint32 powerOf2 = (1ULL << (Is3 - 1ULL)) & 0x3fffffff; +cp.code() += "etiss_uint64 sum = (product + (etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) + " + std::to_string(powerOf2) + "ULL) & 0x1ffffffff;\n"; +cp.code() += "etiss_uint64 rounded = (sum >> " + std::to_string(Is3) + "ULL) & 0x1ffffffff;\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((rounded) >> (0ULL)) & 4294967295);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MACURN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_macurn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MACHHURN ----------------------------------------------------------------- +static InstructionDefinition cv_machhurn_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_machhurn", + (uint32_t) 0xc000605b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MACHHURN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 product = ((etiss_uint16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535))) * (etiss_uint16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))) & 0x3fffffff;\n"; +etiss_uint32 powerOf2 = (1ULL << (Is3 - 1ULL)) & 0x3fffffff; +cp.code() += "etiss_uint64 sum = (product + (etiss_uint32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) + " + std::to_string(powerOf2) + "ULL) & 0x1ffffffff;\n"; +cp.code() += "etiss_uint64 rounded = (sum >> " + std::to_string(Is3) + "ULL) & 0x1ffffffff;\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((rounded) >> (0ULL)) & 4294967295);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MACHHURN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_machhurn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MACSRN ------------------------------------------------------------------- +static InstructionDefinition cv_macsrn_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_macsrn", + (uint32_t) 0x8000705b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MACSRN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 product = ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) & 0x7fffffff;\n"; +etiss_uint32 powerOf2 = (1ULL << (Is3 - 1ULL)) & 0x3fffffff; +cp.code() += "etiss_int32 sum = product + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) + " + std::to_string(powerOf2) + "ULL;\n"; +cp.code() += "etiss_int32 rounded = sum >> " + std::to_string(Is3) + "ULL;\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((rounded) >> (0ULL)) & 4294967295);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MACSRN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_macsrn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MACHHSRN ----------------------------------------------------------------- +static InstructionDefinition cv_machhsrn_rd_rs1_rs2_Is3 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_machhsrn", + (uint32_t) 0xc000705b, + (uint32_t) 0xc000707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MACHHSRN\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_int32 product = ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) & 0x7fffffff;\n"; +etiss_uint32 powerOf2 = (1ULL << (Is3 - 1ULL)) & 0x3fffffff; +cp.code() += "etiss_int32 sum = product + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) + " + std::to_string(powerOf2) + "ULL;\n"; +cp.code() += "etiss_int32 rounded = sum >> " + std::to_string(Is3) + "ULL;\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((rounded) >> (0ULL)) & 4294967295);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MACHHSRN\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 Is3 = 0; +static BitArrayRange R_Is3_0(29, 25); +Is3 += R_Is3_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_machhsrn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | Is3=" + std::to_string(Is3) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVMemInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVMemInstr.cpp new file mode 100644 index 0000000000..4d07435f86 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVMemInstr.cpp @@ -0,0 +1,3496 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the XCoreVMem + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// CV_LB_ri_inc ---------------------------------------------------------------- +static InstructionDefinition cv_lb_ri_inc_rd_rs1_imm12 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lb_ri_inc", + (uint32_t) 0x00000b, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(31, 20); +imm12 += R_imm12_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LB_ri_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint8 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 1);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int8 res = (etiss_int8)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm12) << (4)) >> (4))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LB_ri_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(31, 20); +imm12 += R_imm12_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lb_ri_inc" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm12=" + std::to_string(imm12) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LBU_ri_inc --------------------------------------------------------------- +static InstructionDefinition cv_lbu_ri_inc_rd_rs1_imm12 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lbu_ri_inc", + (uint32_t) 0x00400b, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(31, 20); +imm12 += R_imm12_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LBU_ri_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint8 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 1);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint8 res = (etiss_uint8)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm12) << (4)) >> (4))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LBU_ri_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(31, 20); +imm12 += R_imm12_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lbu_ri_inc" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm12=" + std::to_string(imm12) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LH_ri_inc ---------------------------------------------------------------- +static InstructionDefinition cv_lh_ri_inc_rd_rs1_imm12 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lh_ri_inc", + (uint32_t) 0x00100b, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(31, 20); +imm12 += R_imm12_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LH_ri_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint16 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 2);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int16 res = (etiss_int16)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm12) << (4)) >> (4))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LH_ri_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(31, 20); +imm12 += R_imm12_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lh_ri_inc" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm12=" + std::to_string(imm12) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LHU_ri_inc --------------------------------------------------------------- +static InstructionDefinition cv_lhu_ri_inc_rd_rs1_imm12 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lhu_ri_inc", + (uint32_t) 0x00500b, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(31, 20); +imm12 += R_imm12_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LHU_ri_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint16 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 2);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint16 res = (etiss_uint16)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm12) << (4)) >> (4))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LHU_ri_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(31, 20); +imm12 += R_imm12_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lhu_ri_inc" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm12=" + std::to_string(imm12) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LW_ri_inc ---------------------------------------------------------------- +static InstructionDefinition cv_lw_ri_inc_rd_rs1_imm12 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lw_ri_inc", + (uint32_t) 0x00200b, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(31, 20); +imm12 += R_imm12_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LW_ri_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int32 res = (etiss_int32)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm12) << (4)) >> (4))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LW_ri_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(31, 20); +imm12 += R_imm12_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lw_ri_inc" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm12=" + std::to_string(imm12) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LB_rr_inc ---------------------------------------------------------------- +static InstructionDefinition cv_lb_rr_inc_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lb_rr_inc", + (uint32_t) 0x00302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LB_rr_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint8 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 1);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int8 res = (etiss_int8)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LB_rr_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lb_rr_inc" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LBU_rr_inc --------------------------------------------------------------- +static InstructionDefinition cv_lbu_rr_inc_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lbu_rr_inc", + (uint32_t) 0x1000302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LBU_rr_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint8 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 1);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint8 res = (etiss_uint8)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LBU_rr_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lbu_rr_inc" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LH_rr_inc ---------------------------------------------------------------- +static InstructionDefinition cv_lh_rr_inc_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lh_rr_inc", + (uint32_t) 0x200302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LH_rr_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint16 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 2);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int16 res = (etiss_int16)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LH_rr_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lh_rr_inc" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LHU_rr_inc --------------------------------------------------------------- +static InstructionDefinition cv_lhu_rr_inc_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lhu_rr_inc", + (uint32_t) 0x1200302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LHU_rr_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint16 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 2);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint16 res = (etiss_uint16)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LHU_rr_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lhu_rr_inc" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LW_rr_inc ---------------------------------------------------------------- +static InstructionDefinition cv_lw_rr_inc_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lw_rr_inc", + (uint32_t) 0x400302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LW_rr_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int32 res = (etiss_int32)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LW_rr_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lw_rr_inc" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LB_rr -------------------------------------------------------------------- +static InstructionDefinition cv_lb_rr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lb_rr", + (uint32_t) 0x800302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LB_rr\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL];\n"; +cp.code() += "etiss_uint8 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 1);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int8 res = (etiss_int8)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LB_rr\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lb_rr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LBU_rr ------------------------------------------------------------------- +static InstructionDefinition cv_lbu_rr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lbu_rr", + (uint32_t) 0x1800302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LBU_rr\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL];\n"; +cp.code() += "etiss_uint8 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 1);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint8 res = (etiss_uint8)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LBU_rr\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lbu_rr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LH_rr -------------------------------------------------------------------- +static InstructionDefinition cv_lh_rr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lh_rr", + (uint32_t) 0xa00302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LH_rr\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL];\n"; +cp.code() += "etiss_uint16 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 2);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int16 res = (etiss_int16)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LH_rr\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lh_rr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LHU_rr ------------------------------------------------------------------- +static InstructionDefinition cv_lhu_rr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lhu_rr", + (uint32_t) 0x1a00302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LHU_rr\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL];\n"; +cp.code() += "etiss_uint16 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 2);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint16 res = (etiss_uint16)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LHU_rr\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lhu_rr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_LW_rr -------------------------------------------------------------------- +static InstructionDefinition cv_lw_rr_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_lw_rr", + (uint32_t) 0xc00302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_LW_rr\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 load_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int32 res = (etiss_int32)(mem_val_0);\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(res);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_LW_rr\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_lw_rr" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SB_ri_inc ---------------------------------------------------------------- +static InstructionDefinition cv_sb_ri_inc_imm12_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sb_ri_inc", + (uint32_t) 0x00002b, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(11, 7); +imm12 += R_imm12_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm12_5(31, 25); +imm12 += R_imm12_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SB_ri_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 store_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint8 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int8)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, store_address, (etiss_uint8*)&mem_val_0, 1);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm12) << (4)) >> (4))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SB_ri_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(11, 7); +imm12 += R_imm12_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm12_5(31, 25); +imm12 += R_imm12_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sb_ri_inc" << " # " << ba << (" [imm12=" + std::to_string(imm12) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SH_ri_inc ---------------------------------------------------------------- +static InstructionDefinition cv_sh_ri_inc_imm12_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sh_ri_inc", + (uint32_t) 0x00102b, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(11, 7); +imm12 += R_imm12_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm12_5(31, 25); +imm12 += R_imm12_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SH_ri_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 store_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint16 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int16)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, store_address, (etiss_uint8*)&mem_val_0, 2);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm12) << (4)) >> (4))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SH_ri_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(11, 7); +imm12 += R_imm12_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm12_5(31, 25); +imm12 += R_imm12_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sh_ri_inc" << " # " << ba << (" [imm12=" + std::to_string(imm12) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SW_ri_inc ---------------------------------------------------------------- +static InstructionDefinition cv_sw_ri_inc_imm12_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sw_ri_inc", + (uint32_t) 0x00202b, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(11, 7); +imm12 += R_imm12_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm12_5(31, 25); +imm12 += R_imm12_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SW_ri_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 store_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, store_address, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm12) << (4)) >> (4))) + "LL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SW_ri_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint16 imm12 = 0; +static BitArrayRange R_imm12_0(11, 7); +imm12 += R_imm12_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +static BitArrayRange R_imm12_5(31, 25); +imm12 += R_imm12_5.read(ba) << 5; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sw_ri_inc" << " # " << ba << (" [imm12=" + std::to_string(imm12) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SB_rr_inc ---------------------------------------------------------------- +static InstructionDefinition cv_sb_rr_inc_rs3_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sb_rr_inc", + (uint32_t) 0x2000302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(11, 7); +rs3 += R_rs3_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SB_rr_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 store_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint8 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int8)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, store_address, (etiss_uint8*)&mem_val_0, 1);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs3) + "ULL]);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SB_rr_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(11, 7); +rs3 += R_rs3_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sb_rr_inc" << " # " << ba << (" [rs3=" + std::to_string(rs3) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SH_rr_inc ---------------------------------------------------------------- +static InstructionDefinition cv_sh_rr_inc_rs3_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sh_rr_inc", + (uint32_t) 0x2200302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(11, 7); +rs3 += R_rs3_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SH_rr_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 store_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint16 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int16)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, store_address, (etiss_uint8*)&mem_val_0, 2);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs3) + "ULL]);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SH_rr_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(11, 7); +rs3 += R_rs3_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sh_rr_inc" << " # " << ba << (" [rs3=" + std::to_string(rs3) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SW_rr_inc ---------------------------------------------------------------- +static InstructionDefinition cv_sw_rr_inc_rs3_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sw_rr_inc", + (uint32_t) 0x2400302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(11, 7); +rs3 += R_rs3_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SW_rr_inc\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 store_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, store_address, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs3) + "ULL]);\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SW_rr_inc\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(11, 7); +rs3 += R_rs3_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sw_rr_inc" << " # " << ba << (" [rs3=" + std::to_string(rs3) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SB_rr -------------------------------------------------------------------- +static InstructionDefinition cv_sb_rr_rs3_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sb_rr", + (uint32_t) 0x2800302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(11, 7); +rs3 += R_rs3_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SB_rr\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 store_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs3) + "ULL];\n"; +cp.code() += "etiss_uint8 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int8)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, store_address, (etiss_uint8*)&mem_val_0, 1);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SB_rr\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(11, 7); +rs3 += R_rs3_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sb_rr" << " # " << ba << (" [rs3=" + std::to_string(rs3) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SH_rr -------------------------------------------------------------------- +static InstructionDefinition cv_sh_rr_rs3_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sh_rr", + (uint32_t) 0x2a00302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(11, 7); +rs3 += R_rs3_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SH_rr\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 store_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs3) + "ULL];\n"; +cp.code() += "etiss_uint16 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int16)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, store_address, (etiss_uint8*)&mem_val_0, 2);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SH_rr\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(11, 7); +rs3 += R_rs3_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sh_rr" << " # " << ba << (" [rs3=" + std::to_string(rs3) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SW_rr -------------------------------------------------------------------- +static InstructionDefinition cv_sw_rr_rs3_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sw_rr", + (uint32_t) 0x2c00302b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(11, 7); +rs3 += R_rs3_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SW_rr\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 store_address = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL] + *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs3) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, store_address, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SW_rr\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rs3 = 0; +static BitArrayRange R_rs3_0(11, 7); +rs3 += R_rs3_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sw_rr" << " # " << ba << (" [rs3=" + std::to_string(rs3) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVSimdInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVSimdInstr.cpp new file mode 100644 index 0000000000..74af31e138 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_XCoreVSimdInstr.cpp @@ -0,0 +1,30601 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the XCoreVSimd + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// CV_ADD_H -------------------------------------------------------------------- +static InstructionDefinition cv_add_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_add_h", + (uint32_t) 0x00007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADD_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADD_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_add_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADD_SC_H ----------------------------------------------------------------- +static InstructionDefinition cv_add_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_add_sc_h", + (uint32_t) 0x00407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADD_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADD_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_add_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADD_SCI_H ---------------------------------------------------------------- +static InstructionDefinition cv_add_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_add_sci_h", + (uint32_t) 0x00607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADD_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) + " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) + " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADD_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_add_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADD_B -------------------------------------------------------------------- +static InstructionDefinition cv_add_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_add_b", + (uint32_t) 0x00107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADD_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADD_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_add_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADD_SC_B ----------------------------------------------------------------- +static InstructionDefinition cv_add_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_add_sc_b", + (uint32_t) 0x00507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADD_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADD_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_add_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADD_SCI_B ---------------------------------------------------------------- +static InstructionDefinition cv_add_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_add_sci_b", + (uint32_t) 0x00707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADD_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) + " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) + " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) + " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) + " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADD_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_add_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUB_H -------------------------------------------------------------------- +static InstructionDefinition cv_sub_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sub_h", + (uint32_t) 0x800007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUB_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUB_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sub_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUB_SC_H ----------------------------------------------------------------- +static InstructionDefinition cv_sub_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sub_sc_h", + (uint32_t) 0x800407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUB_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUB_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sub_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUB_SCI_H ---------------------------------------------------------------- +static InstructionDefinition cv_sub_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sub_sci_h", + (uint32_t) 0x800607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUB_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) - " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) - " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUB_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sub_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUB_B -------------------------------------------------------------------- +static InstructionDefinition cv_sub_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sub_b", + (uint32_t) 0x800107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUB_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUB_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sub_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUB_SC_B ----------------------------------------------------------------- +static InstructionDefinition cv_sub_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sub_sc_b", + (uint32_t) 0x800507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUB_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUB_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sub_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUB_SCI_B ---------------------------------------------------------------- +static InstructionDefinition cv_sub_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sub_sci_b", + (uint32_t) 0x800707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUB_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) - " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) - " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) - " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) - " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUB_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sub_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AVG_H -------------------------------------------------------------------- +static InstructionDefinition cv_avg_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_avg_h", + (uint32_t) 0x1000007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AVG_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AVG_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_avg_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AVG_SC_H ----------------------------------------------------------------- +static InstructionDefinition cv_avg_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_avg_sc_h", + (uint32_t) 0x1000407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AVG_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AVG_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_avg_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AVG_SCI_H ---------------------------------------------------------------- +static InstructionDefinition cv_avg_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_avg_sci_h", + (uint32_t) 0x1000607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AVG_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) + " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> 1ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) + " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> 1ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AVG_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_avg_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AVG_B -------------------------------------------------------------------- +static InstructionDefinition cv_avg_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_avg_b", + (uint32_t) 0x1000107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AVG_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AVG_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_avg_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AVG_SC_B ----------------------------------------------------------------- +static InstructionDefinition cv_avg_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_avg_sc_b", + (uint32_t) 0x1000507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AVG_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AVG_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_avg_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AVG_SCI_B ---------------------------------------------------------------- +static InstructionDefinition cv_avg_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_avg_sci_b", + (uint32_t) 0x1000707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AVG_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) + " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> 1ULL)) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) + " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> 1ULL)) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) + " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> 1ULL)) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) + " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> 1ULL)) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AVG_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_avg_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AVGU_H ------------------------------------------------------------------- +static InstructionDefinition cv_avgu_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_avgu_h", + (uint32_t) 0x1800007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AVGU_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((etiss_uint16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_uint16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AVGU_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_avgu_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AVGU_SC_H ---------------------------------------------------------------- +static InstructionDefinition cv_avgu_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_avgu_sc_h", + (uint32_t) 0x1800407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AVGU_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((etiss_uint16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_uint16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AVGU_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_avgu_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AVGU_SCI_H --------------------------------------------------------------- +static InstructionDefinition cv_avgu_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_avgu_sci_h", + (uint32_t) 0x1800607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AVGU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((etiss_uint16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) + " + std::to_string(((etiss_uint16)(Imm6))) + "ULL)) >> 1ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_uint16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) + " + std::to_string(((etiss_uint16)(Imm6))) + "ULL)) >> 1ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AVGU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_avgu_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AVGU_B ------------------------------------------------------------------- +static InstructionDefinition cv_avgu_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_avgu_b", + (uint32_t) 0x1800107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AVGU_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((etiss_uint8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((etiss_uint8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((etiss_uint8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((etiss_uint8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AVGU_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_avgu_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AVGU_SC_B ---------------------------------------------------------------- +static InstructionDefinition cv_avgu_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_avgu_sc_b", + (uint32_t) 0x1800507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AVGU_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((etiss_uint8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((etiss_uint8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((etiss_uint8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((etiss_uint8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> 1ULL)) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AVGU_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_avgu_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AVGU_SCI_B --------------------------------------------------------------- +static InstructionDefinition cv_avgu_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_avgu_sci_b", + (uint32_t) 0x1800707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AVGU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((etiss_uint8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) + " + std::to_string(((etiss_uint8)(Imm6))) + "ULL)) >> 1ULL)) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((etiss_uint8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) + " + std::to_string(((etiss_uint8)(Imm6))) + "ULL)) >> 1ULL)) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((etiss_uint8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) + " + std::to_string(((etiss_uint8)(Imm6))) + "ULL)) >> 1ULL)) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((etiss_uint8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) + " + std::to_string(((etiss_uint8)(Imm6))) + "ULL)) >> 1ULL)) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AVGU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_avgu_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MIN_H -------------------------------------------------------------------- +static InstructionDefinition cv_min_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_min_h", + (uint32_t) 0x2000007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MIN_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MIN_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_min_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MIN_SC_H ----------------------------------------------------------------- +static InstructionDefinition cv_min_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_min_sc_h", + (uint32_t) 0x2000407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MIN_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MIN_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_min_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MIN_SCI_H ---------------------------------------------------------------- +static InstructionDefinition cv_min_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_min_sci_h", + (uint32_t) 0x2000607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MIN_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) : (" + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) : (" + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MIN_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_min_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MIN_B -------------------------------------------------------------------- +static InstructionDefinition cv_min_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_min_b", + (uint32_t) 0x2000107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MIN_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MIN_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_min_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MIN_SC_B ----------------------------------------------------------------- +static InstructionDefinition cv_min_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_min_sc_b", + (uint32_t) 0x2000507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MIN_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MIN_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_min_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MIN_SCI_B ---------------------------------------------------------------- +static InstructionDefinition cv_min_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_min_sci_b", + (uint32_t) 0x2000707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MIN_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) : (" + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) : (" + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) : (" + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) : (" + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MIN_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_min_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MINU_H ------------------------------------------------------------------- +static InstructionDefinition cv_minu_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_minu_h", + (uint32_t) 0x2800007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MINU_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MINU_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_minu_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MINU_SC_H ---------------------------------------------------------------- +static InstructionDefinition cv_minu_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_minu_sc_h", + (uint32_t) 0x2800407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MINU_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MINU_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_minu_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MINU_SCI_H --------------------------------------------------------------- +static InstructionDefinition cv_minu_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_minu_sci_h", + (uint32_t) 0x2800607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MINU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < " + std::to_string((etiss_uint16)(((etiss_uint16)(Imm6)))) + "ULL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) : (" + std::to_string(((etiss_uint16)(Imm6))) + "ULL) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < " + std::to_string((etiss_uint16)(((etiss_uint16)(Imm6)))) + "ULL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) : (" + std::to_string(((etiss_uint16)(Imm6))) + "ULL) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MINU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_minu_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MINU_B ------------------------------------------------------------------- +static InstructionDefinition cv_minu_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_minu_b", + (uint32_t) 0x2800107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MINU_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MINU_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_minu_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MINU_SC_B ---------------------------------------------------------------- +static InstructionDefinition cv_minu_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_minu_sc_b", + (uint32_t) 0x2800507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MINU_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MINU_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_minu_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MINU_SCI_B --------------------------------------------------------------- +static InstructionDefinition cv_minu_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_minu_sci_b", + (uint32_t) 0x2800707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MINU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) : (" + std::to_string(((etiss_uint8)(Imm6))) + "ULL) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) : (" + std::to_string(((etiss_uint8)(Imm6))) + "ULL) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) : (" + std::to_string(((etiss_uint8)(Imm6))) + "ULL) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) : (" + std::to_string(((etiss_uint8)(Imm6))) + "ULL) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MINU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_minu_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAX_H -------------------------------------------------------------------- +static InstructionDefinition cv_max_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_max_h", + (uint32_t) 0x3000007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAX_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) > (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) > (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAX_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_max_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAX_SC_H ----------------------------------------------------------------- +static InstructionDefinition cv_max_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_max_sc_h", + (uint32_t) 0x3000407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAX_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) > (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) > (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAX_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_max_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAX_SCI_H ---------------------------------------------------------------- +static InstructionDefinition cv_max_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_max_sci_h", + (uint32_t) 0x3000607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAX_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) > " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) : (" + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) > " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) : (" + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAX_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_max_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAX_B -------------------------------------------------------------------- +static InstructionDefinition cv_max_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_max_b", + (uint32_t) 0x3000107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAX_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAX_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_max_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAX_SC_B ----------------------------------------------------------------- +static InstructionDefinition cv_max_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_max_sc_b", + (uint32_t) 0x3000507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAX_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAX_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_max_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAX_SCI_B ---------------------------------------------------------------- +static InstructionDefinition cv_max_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_max_sci_b", + (uint32_t) 0x3000707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAX_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) > " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) : (" + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) > " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) : (" + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) > " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) : (" + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) > " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) : (" + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAX_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_max_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAXU_H ------------------------------------------------------------------- +static InstructionDefinition cv_maxu_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_maxu_h", + (uint32_t) 0x3800007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAXU_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) > (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) > (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAXU_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_maxu_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAXU_SC_H ---------------------------------------------------------------- +static InstructionDefinition cv_maxu_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_maxu_sc_h", + (uint32_t) 0x3800407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAXU_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) > (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) > (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAXU_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_maxu_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAXU_SCI_H --------------------------------------------------------------- +static InstructionDefinition cv_maxu_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_maxu_sci_h", + (uint32_t) 0x3800607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAXU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) > " + std::to_string((etiss_uint16)(((etiss_uint16)(Imm6)))) + "ULL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) : (" + std::to_string(((etiss_uint16)(Imm6))) + "ULL) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) > " + std::to_string((etiss_uint16)(((etiss_uint16)(Imm6)))) + "ULL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) : (" + std::to_string(((etiss_uint16)(Imm6))) + "ULL) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAXU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_maxu_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAXU_B ------------------------------------------------------------------- +static InstructionDefinition cv_maxu_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_maxu_b", + (uint32_t) 0x3800107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAXU_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAXU_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_maxu_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAXU_SC_B ---------------------------------------------------------------- +static InstructionDefinition cv_maxu_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_maxu_sc_b", + (uint32_t) 0x3800507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAXU_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAXU_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_maxu_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_MAXU_SCI_B --------------------------------------------------------------- +static InstructionDefinition cv_maxu_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_maxu_sci_b", + (uint32_t) 0x3800707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_MAXU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) > " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) : (" + std::to_string(((etiss_uint8)(Imm6))) + "ULL) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) > " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) : (" + std::to_string(((etiss_uint8)(Imm6))) + "ULL) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) > " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) : (" + std::to_string(((etiss_uint8)(Imm6))) + "ULL) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) > " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)) ? ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) : (" + std::to_string(((etiss_uint8)(Imm6))) + "ULL) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_MAXU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_maxu_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SRL_H -------------------------------------------------------------------- +static InstructionDefinition cv_srl_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_srl_h", + (uint32_t) 0x4000007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SRL_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SRL_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_srl_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SRL_SC_H ----------------------------------------------------------------- +static InstructionDefinition cv_srl_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_srl_sc_h", + (uint32_t) 0x4000407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SRL_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SRL_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_srl_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SRL_SCI_H ---------------------------------------------------------------- +static InstructionDefinition cv_srl_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_srl_sci_h", + (uint32_t) 0x4000607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SRL_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) >> " + std::to_string((((etiss_uint16)(Imm6)))) + "ULL << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) >> " + std::to_string((((etiss_uint16)(Imm6)))) + "ULL << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SRL_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_srl_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SRL_B -------------------------------------------------------------------- +static InstructionDefinition cv_srl_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_srl_b", + (uint32_t) 0x4000107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SRL_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SRL_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_srl_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SRL_SC_B ----------------------------------------------------------------- +static InstructionDefinition cv_srl_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_srl_sc_b", + (uint32_t) 0x4000507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SRL_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SRL_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_srl_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SRL_SCI_B ---------------------------------------------------------------- +static InstructionDefinition cv_srl_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_srl_sci_b", + (uint32_t) 0x4000707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SRL_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) >> " + std::to_string((((etiss_uint8)(Imm6)))) + "ULL << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) >> " + std::to_string((((etiss_uint8)(Imm6)))) + "ULL << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) >> " + std::to_string((((etiss_uint8)(Imm6)))) + "ULL << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) >> " + std::to_string((((etiss_uint8)(Imm6)))) + "ULL << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SRL_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_srl_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SRA_H -------------------------------------------------------------------- +static InstructionDefinition cv_sra_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sra_h", + (uint32_t) 0x4800007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SRA_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SRA_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sra_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SRA_SC_H ----------------------------------------------------------------- +static InstructionDefinition cv_sra_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sra_sc_h", + (uint32_t) 0x4800407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SRA_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SRA_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sra_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SRA_SCI_H ---------------------------------------------------------------- +static InstructionDefinition cv_sra_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sra_sci_h", + (uint32_t) 0x4800607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SRA_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) >> " + std::to_string((((etiss_uint16)(Imm6)))) + "ULL << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) >> " + std::to_string((((etiss_uint16)(Imm6)))) + "ULL << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SRA_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sra_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SRA_B -------------------------------------------------------------------- +static InstructionDefinition cv_sra_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sra_b", + (uint32_t) 0x4800107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SRA_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SRA_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sra_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SRA_SC_B ----------------------------------------------------------------- +static InstructionDefinition cv_sra_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sra_sc_b", + (uint32_t) 0x4800507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SRA_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) >> ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SRA_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sra_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SRA_SCI_B ---------------------------------------------------------------- +static InstructionDefinition cv_sra_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sra_sci_b", + (uint32_t) 0x4800707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SRA_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) >> " + std::to_string((((etiss_uint8)(Imm6)))) + "ULL << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) >> " + std::to_string((((etiss_uint8)(Imm6)))) + "ULL << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) >> " + std::to_string((((etiss_uint8)(Imm6)))) + "ULL << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) >> " + std::to_string((((etiss_uint8)(Imm6)))) + "ULL << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SRA_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sra_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SLL_H -------------------------------------------------------------------- +static InstructionDefinition cv_sll_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sll_h", + (uint32_t) 0x5000007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SLL_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) << ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) << ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SLL_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sll_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SLL_SC_H ----------------------------------------------------------------- +static InstructionDefinition cv_sll_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sll_sc_h", + (uint32_t) 0x5000407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SLL_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) << ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) << ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SLL_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sll_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SLL_SCI_H ---------------------------------------------------------------- +static InstructionDefinition cv_sll_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sll_sci_h", + (uint32_t) 0x5000607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SLL_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) << " + std::to_string((((etiss_uint16)(Imm6)))) + "ULL << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) << " + std::to_string((((etiss_uint16)(Imm6)))) + "ULL << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SLL_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sll_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SLL_B -------------------------------------------------------------------- +static InstructionDefinition cv_sll_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sll_b", + (uint32_t) 0x5000107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SLL_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) << ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) << ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) << ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) << ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SLL_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sll_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SLL_SC_B ----------------------------------------------------------------- +static InstructionDefinition cv_sll_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sll_sc_b", + (uint32_t) 0x5000507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SLL_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) << ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) << ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) << ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) << ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SLL_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sll_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SLL_SCI_B ---------------------------------------------------------------- +static InstructionDefinition cv_sll_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sll_sci_b", + (uint32_t) 0x5000707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SLL_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) << " + std::to_string((((etiss_uint8)(Imm6)))) + "ULL << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) << " + std::to_string((((etiss_uint8)(Imm6)))) + "ULL << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) << " + std::to_string((((etiss_uint8)(Imm6)))) + "ULL << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) << " + std::to_string((((etiss_uint8)(Imm6)))) + "ULL << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SLL_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sll_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_OR_H --------------------------------------------------------------------- +static InstructionDefinition cv_or_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_or_h", + (uint32_t) 0x5800007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_OR_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) | (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) | (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_OR_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_or_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_OR_SC_H ------------------------------------------------------------------ +static InstructionDefinition cv_or_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_or_sc_h", + (uint32_t) 0x5800407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_OR_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) | (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) | (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_OR_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_or_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_OR_SCI_H ----------------------------------------------------------------- +static InstructionDefinition cv_or_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_or_sci_h", + (uint32_t) 0x5800607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_OR_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) | " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) | " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_OR_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_or_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_OR_B --------------------------------------------------------------------- +static InstructionDefinition cv_or_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_or_b", + (uint32_t) 0x5800107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_OR_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) | (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) | (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) | (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) | (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_OR_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_or_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_OR_SC_B ------------------------------------------------------------------ +static InstructionDefinition cv_or_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_or_sc_b", + (uint32_t) 0x5800507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_OR_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) | (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) | (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) | (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) | (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_OR_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_or_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_OR_SCI_B ----------------------------------------------------------------- +static InstructionDefinition cv_or_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_or_sci_b", + (uint32_t) 0x5800707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_OR_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) | " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) | " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) | " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) | " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_OR_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_or_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_XOR_H -------------------------------------------------------------------- +static InstructionDefinition cv_xor_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_xor_h", + (uint32_t) 0x6000007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_XOR_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) ^ (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) ^ (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_XOR_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_xor_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_XOR_SC_H ----------------------------------------------------------------- +static InstructionDefinition cv_xor_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_xor_sc_h", + (uint32_t) 0x6000407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_XOR_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) ^ (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) ^ (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_XOR_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_xor_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_XOR_SCI_H ---------------------------------------------------------------- +static InstructionDefinition cv_xor_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_xor_sci_h", + (uint32_t) 0x6000607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_XOR_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) ^ " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) ^ " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_XOR_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_xor_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_XOR_B -------------------------------------------------------------------- +static InstructionDefinition cv_xor_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_xor_b", + (uint32_t) 0x6000107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_XOR_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) ^ (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) ^ (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) ^ (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) ^ (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_XOR_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_xor_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_XOR_SC_B ----------------------------------------------------------------- +static InstructionDefinition cv_xor_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_xor_sc_b", + (uint32_t) 0x6000507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_XOR_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) ^ (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) ^ (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) ^ (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) ^ (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_XOR_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_xor_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_XOR_SCI_B ---------------------------------------------------------------- +static InstructionDefinition cv_xor_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_xor_sci_b", + (uint32_t) 0x6000707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_XOR_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) ^ " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) ^ " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) ^ " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) ^ " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_XOR_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_xor_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AND_H -------------------------------------------------------------------- +static InstructionDefinition cv_and_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_and_h", + (uint32_t) 0x6800007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AND_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) & (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) & (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AND_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_and_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AND_SC_H ----------------------------------------------------------------- +static InstructionDefinition cv_and_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_and_sc_h", + (uint32_t) 0x6800407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AND_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) & (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) & (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AND_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_and_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AND_SCI_H ---------------------------------------------------------------- +static InstructionDefinition cv_and_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_and_sci_h", + (uint32_t) 0x6800607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AND_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) & " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) & " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AND_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_and_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AND_B -------------------------------------------------------------------- +static InstructionDefinition cv_and_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_and_b", + (uint32_t) 0x6800107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AND_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) & (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) & (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) & (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) & (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AND_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_and_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AND_SC_B ----------------------------------------------------------------- +static InstructionDefinition cv_and_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_and_sc_b", + (uint32_t) 0x6800507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AND_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) & (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) & (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) & (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) & (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AND_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_and_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_AND_SCI_B ---------------------------------------------------------------- +static InstructionDefinition cv_and_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_and_sci_b", + (uint32_t) 0x6800707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_AND_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) & " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) & " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) & " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) & " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_AND_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_and_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ABS_H -------------------------------------------------------------------- +static InstructionDefinition cv_abs_h_rd_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_abs_h", + (uint32_t) 0x7000007b, + (uint32_t) 0xfff0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ABS_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < 0ULL)) ? (((((-((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)))) >> (0ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < 0ULL)) ? (((((-((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)))) >> (0ULL)) & 65535)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ABS_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_abs_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ABS_B -------------------------------------------------------------------- +static InstructionDefinition cv_abs_b_rd_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_abs_b", + (uint32_t) 0x7000107b, + (uint32_t) 0xfff0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ABS_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < 0ULL)) ? (((((-((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)))) >> (0ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < 0ULL)) ? (((((-((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)))) >> (0ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < 0ULL)) ? (((((-((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)))) >> (0ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < 0ULL)) ? (((((-((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)))) >> (0ULL)) & 255)) : ((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ABS_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_abs_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_EXTRACT_H ---------------------------------------------------------------- +static InstructionDefinition cv_extract_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_extract_h", + (uint32_t) 0xb800007b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_EXTRACT_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int32)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL + 15ULL) + "ULL) - (" + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL) + "ULL) + 1)) - 1)))));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_EXTRACT_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_extract_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_EXTRACT_B ---------------------------------------------------------------- +static InstructionDefinition cv_extract_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_extract_b", + (uint32_t) 0xb800107b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_EXTRACT_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int32)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)))));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_EXTRACT_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_extract_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_EXTRACTU_H --------------------------------------------------------------- +static InstructionDefinition cv_extractu_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_extractu_h", + (uint32_t) 0xb800207b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_EXTRACTU_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL + 15ULL) + "ULL) - (" + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL) + "ULL) + 1)) - 1))));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_EXTRACTU_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_extractu_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_EXTRACTU_B --------------------------------------------------------------- +static InstructionDefinition cv_extractu_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_extractu_b", + (uint32_t) 0xb800307b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_EXTRACTU_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1))));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_EXTRACTU_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_extractu_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_INSERT_H ----------------------------------------------------------------- +static InstructionDefinition cv_insert_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_insert_h", + (uint32_t) 0xb800407b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_INSERT_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (~(((1 << ((" + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL + 15ULL) + "ULL) - (" + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL) + "ULL) + 1)) - 1) << (" + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL) + "ULL)))) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) << " + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL) + "ULL) & (((1 << ((" + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL + 15ULL) + "ULL) - (" + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL) + "ULL) + 1)) - 1) << (" + std::to_string((((Imm6) >> (0ULL)) & 1) * 16ULL) + "ULL))));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_INSERT_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_insert_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_INSERT_B ----------------------------------------------------------------- +static InstructionDefinition cv_insert_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_insert_b", + (uint32_t) 0xb800507b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_INSERT_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (~(((1 << ((" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1) << (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL)))) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) << " + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL) & (((1 << ((" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1) << (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL))));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_INSERT_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_insert_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTUP_H ------------------------------------------------------------------ +static InstructionDefinition cv_dotup_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotup_h", + (uint32_t) 0x8000007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTUP_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTUP_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotup_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTUP_SC_H --------------------------------------------------------------- +static InstructionDefinition cv_dotup_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotup_sc_h", + (uint32_t) 0x8000407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTUP_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTUP_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotup_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTUP_SCI_H -------------------------------------------------------------- +static InstructionDefinition cv_dotup_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotup_sci_h", + (uint32_t) 0x8000607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTUP_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * " + std::to_string((etiss_uint16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "ULL) + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * " + std::to_string((etiss_uint16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "ULL))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTUP_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotup_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTUP_B ------------------------------------------------------------------ +static InstructionDefinition cv_dotup_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotup_b", + (uint32_t) 0x8000107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTUP_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTUP_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotup_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTUP_SC_B --------------------------------------------------------------- +static InstructionDefinition cv_dotup_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotup_sc_b", + (uint32_t) 0x8000507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTUP_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTUP_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotup_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTUP_SCI_B -------------------------------------------------------------- +static InstructionDefinition cv_dotup_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotup_sci_b", + (uint32_t) 0x8000707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTUP_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * " + std::to_string((etiss_uint8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "ULL) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * " + std::to_string((etiss_uint8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "ULL) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * " + std::to_string((etiss_uint8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "ULL) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * " + std::to_string((etiss_uint8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "ULL))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTUP_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotup_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTUSP_H ----------------------------------------------------------------- +static InstructionDefinition cv_dotusp_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotusp_h", + (uint32_t) 0x8800007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTUSP_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTUSP_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotusp_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTUSP_SC_H -------------------------------------------------------------- +static InstructionDefinition cv_dotusp_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotusp_sc_h", + (uint32_t) 0x8800407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTUSP_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTUSP_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotusp_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTUSP_SCI_H ------------------------------------------------------------- +static InstructionDefinition cv_dotusp_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotusp_sci_h", + (uint32_t) 0x8800607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTUSP_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTUSP_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotusp_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTUSP_B ----------------------------------------------------------------- +static InstructionDefinition cv_dotusp_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotusp_b", + (uint32_t) 0x8800107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTUSP_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTUSP_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotusp_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTUSP_SC_B -------------------------------------------------------------- +static InstructionDefinition cv_dotusp_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotusp_sc_b", + (uint32_t) 0x8800507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTUSP_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTUSP_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotusp_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTUSP_SCI_B ------------------------------------------------------------- +static InstructionDefinition cv_dotusp_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotusp_sci_b", + (uint32_t) 0x8800707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTUSP_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTUSP_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotusp_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTSP_H ------------------------------------------------------------------ +static InstructionDefinition cv_dotsp_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotsp_h", + (uint32_t) 0x9000007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTSP_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int16)((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) + ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTSP_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotsp_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTSP_SC_H --------------------------------------------------------------- +static InstructionDefinition cv_dotsp_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotsp_sc_h", + (uint32_t) 0x9000407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTSP_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int16)((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) + ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTSP_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotsp_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTSP_SCI_H -------------------------------------------------------------- +static InstructionDefinition cv_dotsp_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotsp_sci_h", + (uint32_t) 0x9000607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTSP_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int16)((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTSP_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotsp_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTSP_B ------------------------------------------------------------------ +static InstructionDefinition cv_dotsp_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotsp_b", + (uint32_t) 0x9000107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTSP_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int8)((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTSP_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotsp_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTSP_SC_B --------------------------------------------------------------- +static InstructionDefinition cv_dotsp_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotsp_sc_b", + (uint32_t) 0x9000507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTSP_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int8)((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTSP_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotsp_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_DOTSP_SCI_B -------------------------------------------------------------- +static InstructionDefinition cv_dotsp_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_dotsp_sci_b", + (uint32_t) 0x9000707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_DOTSP_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int8)((((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_DOTSP_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_dotsp_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTUP_H ----------------------------------------------------------------- +static InstructionDefinition cv_sdotup_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotup_h", + (uint32_t) 0x9800007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTUP_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTUP_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotup_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTUP_SC_H -------------------------------------------------------------- +static InstructionDefinition cv_sdotup_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotup_sc_h", + (uint32_t) 0x9800407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTUP_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTUP_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotup_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTUP_SCI_H ------------------------------------------------------------- +static InstructionDefinition cv_sdotup_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotup_sci_h", + (uint32_t) 0x9800607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTUP_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * " + std::to_string((etiss_uint16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "ULL) + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * " + std::to_string((etiss_uint16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "ULL))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTUP_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotup_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTUP_B ----------------------------------------------------------------- +static InstructionDefinition cv_sdotup_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotup_b", + (uint32_t) 0x9800107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTUP_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTUP_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotup_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTUP_SC_B -------------------------------------------------------------- +static InstructionDefinition cv_sdotup_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotup_sc_b", + (uint32_t) 0x9800507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTUP_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTUP_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotup_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTUP_SCI_B ------------------------------------------------------------- +static InstructionDefinition cv_sdotup_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotup_sci_b", + (uint32_t) 0x9800707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTUP_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * " + std::to_string((etiss_uint8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "ULL) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * " + std::to_string((etiss_uint8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "ULL) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * " + std::to_string((etiss_uint8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "ULL) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * " + std::to_string((etiss_uint8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "ULL))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTUP_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotup_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTUSP_H ---------------------------------------------------------------- +static InstructionDefinition cv_sdotusp_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotusp_h", + (uint32_t) 0xa000007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTUSP_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTUSP_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotusp_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTUSP_SC_H ------------------------------------------------------------- +static InstructionDefinition cv_sdotusp_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotusp_sc_h", + (uint32_t) 0xa000407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTUSP_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTUSP_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotusp_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTUSP_SCI_H ------------------------------------------------------------ +static InstructionDefinition cv_sdotusp_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotusp_sci_h", + (uint32_t) 0xa000607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTUSP_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTUSP_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotusp_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTUSP_B ---------------------------------------------------------------- +static InstructionDefinition cv_sdotusp_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotusp_b", + (uint32_t) 0xa000107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTUSP_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTUSP_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotusp_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTUSP_SC_B ------------------------------------------------------------- +static InstructionDefinition cv_sdotusp_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotusp_sc_b", + (uint32_t) 0xa000507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTUSP_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTUSP_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotusp_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTUSP_SCI_B ------------------------------------------------------------ +static InstructionDefinition cv_sdotusp_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotusp_sci_b", + (uint32_t) 0xa000707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTUSP_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTUSP_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotusp_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTSP_H ----------------------------------------------------------------- +static InstructionDefinition cv_sdotsp_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotsp_h", + (uint32_t) 0xa800007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTSP_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) + ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTSP_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotsp_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTSP_SC_H -------------------------------------------------------------- +static InstructionDefinition cv_sdotsp_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotsp_sc_h", + (uint32_t) 0xa800407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTSP_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) + ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTSP_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotsp_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTSP_SCI_H ------------------------------------------------------------- +static InstructionDefinition cv_sdotsp_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotsp_sci_h", + (uint32_t) 0xa800607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTSP_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTSP_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotsp_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTSP_B ----------------------------------------------------------------- +static InstructionDefinition cv_sdotsp_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotsp_b", + (uint32_t) 0xa800107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTSP_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTSP_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotsp_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTSP_SC_B -------------------------------------------------------------- +static InstructionDefinition cv_sdotsp_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotsp_sc_b", + (uint32_t) 0xa800507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTSP_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTSP_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotsp_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SDOTSP_SCI_B ------------------------------------------------------------- +static InstructionDefinition cv_sdotsp_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sdotsp_sci_b", + (uint32_t) 0xa800707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SDOTSP_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (etiss_uint32)(((etiss_int32)((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL) + ((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) * " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))));\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SDOTSP_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sdotsp_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SHUFFLE_H ---------------------------------------------------------------- +static InstructionDefinition cv_shuffle_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_shuffle_h", + (uint32_t) 0xc000007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SHUFFLE_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) >> (0ULL)) & 1) * 16ULL))) & ((1 << (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) >> (0ULL)) & 1) * 16ULL) + 15ULL) - ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) >> (0ULL)) & 1) * 16ULL)) + 1)) - 1)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) >> (0ULL)) & 1) * 16ULL))) & ((1 << (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) >> (0ULL)) & 1) * 16ULL) + 15ULL) - ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) >> (0ULL)) & 1) * 16ULL)) + 1)) - 1)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SHUFFLE_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_shuffle_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SHUFFLE_SCI_H ------------------------------------------------------------ +static InstructionDefinition cv_shuffle_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_shuffle_sci_h", + (uint32_t) 0xc000607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SHUFFLE_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string(((((Imm6) >> (0ULL)) & 1) * 16ULL)) + "ULL)) & ((1 << ((" + std::to_string(((((Imm6) >> (0ULL)) & 1) * 16ULL) + 15ULL) + "ULL) - (" + std::to_string(((((Imm6) >> (0ULL)) & 1) * 16ULL)) + "ULL) + 1)) - 1)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string(((((Imm6) >> (1ULL)) & 1) * 16ULL)) + "ULL)) & ((1 << ((" + std::to_string(((((Imm6) >> (1ULL)) & 1) * 16ULL) + 15ULL) + "ULL) - (" + std::to_string(((((Imm6) >> (1ULL)) & 1) * 16ULL)) + "ULL) + 1)) - 1)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SHUFFLE_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_shuffle_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SHUFFLE_B ---------------------------------------------------------------- +static InstructionDefinition cv_shuffle_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_shuffle_b", + (uint32_t) 0xc000107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SHUFFLE_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) >> (0ULL)) & 3) * 8ULL))) & ((1 << (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) >> (0ULL)) & 3) * 8ULL) + 7ULL) - ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) >> (0ULL)) & 3) * 8ULL)) + 1)) - 1)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) >> (0ULL)) & 3) * 8ULL))) & ((1 << (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) >> (0ULL)) & 3) * 8ULL) + 7ULL) - ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) >> (0ULL)) & 3) * 8ULL)) + 1)) - 1)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) >> (0ULL)) & 3) * 8ULL))) & ((1 << (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) >> (0ULL)) & 3) * 8ULL) + 7ULL) - ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) >> (0ULL)) & 3) * 8ULL)) + 1)) - 1)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) >> (0ULL)) & 3) * 8ULL))) & ((1 << (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) >> (0ULL)) & 3) * 8ULL) + 7ULL) - ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) >> (0ULL)) & 3) * 8ULL)) + 1)) - 1)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SHUFFLE_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_shuffle_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SHUFFLEI0_SCI_B ---------------------------------------------------------- +static InstructionDefinition cv_shufflei0_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_shufflei0_sci_b", + (uint32_t) 0xc000707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SHUFFLEI0_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (2ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (2ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (2ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (4ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (4ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (4ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SHUFFLEI0_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_shufflei0_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SHUFFLEI1_SCI_B ---------------------------------------------------------- +static InstructionDefinition cv_shufflei1_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_shufflei1_sci_b", + (uint32_t) 0xc800707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SHUFFLEI1_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (2ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (2ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (2ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (4ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (4ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (4ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SHUFFLEI1_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_shufflei1_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SHUFFLEI2_SCI_B ---------------------------------------------------------- +static InstructionDefinition cv_shufflei2_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_shufflei2_sci_b", + (uint32_t) 0xd000707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SHUFFLEI2_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (2ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (2ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (2ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (4ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (4ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (4ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SHUFFLEI2_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_shufflei2_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SHUFFLEI3_SCI_B ---------------------------------------------------------- +static InstructionDefinition cv_shufflei3_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_shufflei3_sci_b", + (uint32_t) 0xd800707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SHUFFLEI3_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (0ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (2ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (2ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (2ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (" + std::to_string((((Imm6) >> (4ULL)) & 3) * 8ULL) + "ULL)) & ((1 << ((" + std::to_string((((Imm6) >> (4ULL)) & 3) * 8ULL + 7ULL) + "ULL) - (" + std::to_string((((Imm6) >> (4ULL)) & 3) * 8ULL) + "ULL) + 1)) - 1)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SHUFFLEI3_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_shufflei3_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SHUFFLE2_H --------------------------------------------------------------- +static InstructionDefinition cv_shuffle2_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_shuffle2_h", + (uint32_t) 0xe000007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SHUFFLE2_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) >> (1ULL)) & 1)) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) : (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]))) >> ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) >> (0ULL)) & 1) * 16ULL))) & ((1 << (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) >> (0ULL)) & 1) * 16ULL) + 15ULL) - ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) >> (0ULL)) & 1) * 16ULL)) + 1)) - 1)) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) >> (1ULL)) & 1)) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) : (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]))) >> ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) >> (0ULL)) & 1) * 16ULL))) & ((1 << (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) >> (0ULL)) & 1) * 16ULL) + 15ULL) - ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) >> (0ULL)) & 1) * 16ULL)) + 1)) - 1)) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SHUFFLE2_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_shuffle2_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SHUFFLE2_B --------------------------------------------------------------- +static InstructionDefinition cv_shuffle2_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_shuffle2_b", + (uint32_t) 0xe000107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SHUFFLE2_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) >> (2ULL)) & 1)) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) : (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]))) >> ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) >> (0ULL)) & 3) * 8ULL))) & ((1 << (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) >> (0ULL)) & 3) * 8ULL) + 7ULL) - ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)) >> (0ULL)) & 3) * 8ULL)) + 1)) - 1)) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) >> (2ULL)) & 1)) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) : (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]))) >> ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) >> (0ULL)) & 3) * 8ULL))) & ((1 << (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) >> (0ULL)) & 3) * 8ULL) + 7ULL) - ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)) >> (0ULL)) & 3) * 8ULL)) + 1)) - 1)) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) >> (2ULL)) & 1)) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) : (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]))) >> ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) >> (0ULL)) & 3) * 8ULL))) & ((1 << (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) >> (0ULL)) & 3) * 8ULL) + 7ULL) - ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)) >> (0ULL)) & 3) * 8ULL)) + 1)) - 1)) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) >> (2ULL)) & 1)) ? (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) : (*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]))) >> ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) >> (0ULL)) & 3) * 8ULL))) & ((1 << (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) >> (0ULL)) & 3) * 8ULL) + 7ULL) - ((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)) >> (0ULL)) & 3) * 8ULL)) + 1)) - 1)) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SHUFFLE2_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_shuffle2_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_PACK --------------------------------------------------------------------- +static InstructionDefinition cv_pack_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_pack", + (uint32_t) 0xf000007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_PACK\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_PACK\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_pack" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_PACK_H ------------------------------------------------------------------- +static InstructionDefinition cv_pack_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_pack_h", + (uint32_t) 0xf200007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_PACK_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_PACK_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_pack_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_PACKHI_B ----------------------------------------------------------------- +static InstructionDefinition cv_packhi_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_packhi_b", + (uint32_t) 0xfa00107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_PACKHI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) << 24ULL) & 4278190080U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255) << 16ULL) & 16711680U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_PACKHI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_packhi_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_PACKLO_B ----------------------------------------------------------------- +static InstructionDefinition cv_packlo_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_packlo_b", + (uint32_t) 0xf800107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_PACKLO_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255) << 0ULL) & 255U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_PACKLO_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_packlo_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPEQ_H ------------------------------------------------------------------ +static InstructionDefinition cv_cmpeq_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpeq_h", + (uint32_t) 0x400007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPEQ_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) == (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) == (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPEQ_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpeq_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPEQ_SC_H --------------------------------------------------------------- +static InstructionDefinition cv_cmpeq_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpeq_sc_h", + (uint32_t) 0x400407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPEQ_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) == (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) == (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPEQ_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpeq_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPEQ_SCI_H -------------------------------------------------------------- +static InstructionDefinition cv_cmpeq_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpeq_sci_h", + (uint32_t) 0x400607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPEQ_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) == " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) == " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPEQ_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpeq_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPEQ_B ------------------------------------------------------------------ +static InstructionDefinition cv_cmpeq_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpeq_b", + (uint32_t) 0x400107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPEQ_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) == (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) == (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) == (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) == (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPEQ_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpeq_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPEQ_SC_B --------------------------------------------------------------- +static InstructionDefinition cv_cmpeq_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpeq_sc_b", + (uint32_t) 0x400507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPEQ_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) == (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) == (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) == (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) == (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPEQ_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpeq_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPEQ_SCI_B -------------------------------------------------------------- +static InstructionDefinition cv_cmpeq_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpeq_sci_b", + (uint32_t) 0x400707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPEQ_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) == " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) == " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) == " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) == " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPEQ_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpeq_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPNE_H ------------------------------------------------------------------ +static InstructionDefinition cv_cmpne_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpne_h", + (uint32_t) 0xc00007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPNE_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) != (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) != (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPNE_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpne_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPNE_SC_H --------------------------------------------------------------- +static InstructionDefinition cv_cmpne_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpne_sc_h", + (uint32_t) 0xc00407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPNE_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) != (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) != (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPNE_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpne_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPNE_SCI_H -------------------------------------------------------------- +static InstructionDefinition cv_cmpne_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpne_sci_h", + (uint32_t) 0xc00607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPNE_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) != " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) != " + std::to_string(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPNE_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpne_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPNE_B ------------------------------------------------------------------ +static InstructionDefinition cv_cmpne_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpne_b", + (uint32_t) 0xc00107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPNE_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) != (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) != (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) != (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) != (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPNE_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpne_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPNE_SC_B --------------------------------------------------------------- +static InstructionDefinition cv_cmpne_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpne_sc_b", + (uint32_t) 0xc00507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPNE_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) != (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) != (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) != (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) != (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPNE_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpne_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPNE_SCI_B -------------------------------------------------------------- +static InstructionDefinition cv_cmpne_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpne_sci_b", + (uint32_t) 0xc00707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPNE_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255) != " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255) != " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255) != " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255) != " + std::to_string(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2)))))) + "ULL)))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPNE_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpne_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGT_H ------------------------------------------------------------------ +static InstructionDefinition cv_cmpgt_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgt_h", + (uint32_t) 0x1400007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGT_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) > (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) > (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGT_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgt_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGT_SC_H --------------------------------------------------------------- +static InstructionDefinition cv_cmpgt_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgt_sc_h", + (uint32_t) 0x1400407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGT_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) > (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) > (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGT_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgt_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGT_SCI_H -------------------------------------------------------------- +static InstructionDefinition cv_cmpgt_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgt_sci_h", + (uint32_t) 0x1400607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGT_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) > " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) > " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGT_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgt_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGT_B ------------------------------------------------------------------ +static InstructionDefinition cv_cmpgt_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgt_b", + (uint32_t) 0x1400107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGT_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGT_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgt_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGT_SC_B --------------------------------------------------------------- +static InstructionDefinition cv_cmpgt_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgt_sc_b", + (uint32_t) 0x1400507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGT_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) > (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGT_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgt_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGT_SCI_B -------------------------------------------------------------- +static InstructionDefinition cv_cmpgt_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgt_sci_b", + (uint32_t) 0x1400707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGT_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) > " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) > " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) > " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) > " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGT_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgt_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGE_H ------------------------------------------------------------------ +static InstructionDefinition cv_cmpge_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpge_h", + (uint32_t) 0x1c00007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGE_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) >= (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) >= (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGE_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpge_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGE_SC_H --------------------------------------------------------------- +static InstructionDefinition cv_cmpge_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpge_sc_h", + (uint32_t) 0x1c00407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGE_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) >= (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) >= (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGE_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpge_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGE_SCI_H -------------------------------------------------------------- +static InstructionDefinition cv_cmpge_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpge_sci_h", + (uint32_t) 0x1c00607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGE_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) >= " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) >= " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGE_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpge_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGE_B ------------------------------------------------------------------ +static InstructionDefinition cv_cmpge_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpge_b", + (uint32_t) 0x1c00107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGE_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) >= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) >= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) >= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) >= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGE_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpge_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGE_SC_B --------------------------------------------------------------- +static InstructionDefinition cv_cmpge_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpge_sc_b", + (uint32_t) 0x1c00507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGE_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) >= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) >= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) >= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) >= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGE_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpge_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGE_SCI_B -------------------------------------------------------------- +static InstructionDefinition cv_cmpge_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpge_sci_b", + (uint32_t) 0x1c00707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGE_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) >= " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) >= " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) >= " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) >= " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGE_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpge_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLT_H ------------------------------------------------------------------ +static InstructionDefinition cv_cmplt_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmplt_h", + (uint32_t) 0x2400007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLT_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLT_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmplt_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLT_SC_H --------------------------------------------------------------- +static InstructionDefinition cv_cmplt_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmplt_sc_h", + (uint32_t) 0x2400407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLT_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLT_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmplt_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLT_SCI_H -------------------------------------------------------------- +static InstructionDefinition cv_cmplt_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmplt_sci_h", + (uint32_t) 0x2400607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLT_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLT_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmplt_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLT_B ------------------------------------------------------------------ +static InstructionDefinition cv_cmplt_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmplt_b", + (uint32_t) 0x2400107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLT_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLT_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmplt_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLT_SC_B --------------------------------------------------------------- +static InstructionDefinition cv_cmplt_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmplt_sc_b", + (uint32_t) 0x2400507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLT_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLT_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmplt_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLT_SCI_B -------------------------------------------------------------- +static InstructionDefinition cv_cmplt_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmplt_sci_b", + (uint32_t) 0x2400707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLT_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLT_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmplt_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLE_H ------------------------------------------------------------------ +static InstructionDefinition cv_cmple_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmple_h", + (uint32_t) 0x2c00007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLE_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) <= (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) <= (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLE_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmple_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLE_SC_H --------------------------------------------------------------- +static InstructionDefinition cv_cmple_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmple_sc_h", + (uint32_t) 0x2c00407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLE_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) <= (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) <= (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLE_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmple_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLE_SCI_H -------------------------------------------------------------- +static InstructionDefinition cv_cmple_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmple_sci_h", + (uint32_t) 0x2c00607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLE_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) <= " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) <= " + std::to_string((etiss_int16)(((etiss_uint16)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLE_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmple_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLE_B ------------------------------------------------------------------ +static InstructionDefinition cv_cmple_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmple_b", + (uint32_t) 0x2c00107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLE_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) <= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) <= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) <= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) <= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLE_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmple_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLE_SC_B --------------------------------------------------------------- +static InstructionDefinition cv_cmple_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmple_sc_b", + (uint32_t) 0x2c00507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLE_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) <= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) <= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) <= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) <= (etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLE_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmple_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLE_SCI_B -------------------------------------------------------------- +static InstructionDefinition cv_cmple_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmple_sci_b", + (uint32_t) 0x2c00707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLE_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) <= " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) <= " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) <= " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_int8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) <= " + std::to_string((etiss_int8)(((etiss_uint8)((((etiss_int8)(((etiss_int8)Imm6) << (2)) >> (2))))))) + "LL)))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLE_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmple_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGTU_H ----------------------------------------------------------------- +static InstructionDefinition cv_cmpgtu_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgtu_h", + (uint32_t) 0x3400007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGTU_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) > (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) > (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGTU_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgtu_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGTU_SC_H -------------------------------------------------------------- +static InstructionDefinition cv_cmpgtu_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgtu_sc_h", + (uint32_t) 0x3400407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGTU_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) > (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) > (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGTU_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgtu_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGTU_SCI_H ------------------------------------------------------------- +static InstructionDefinition cv_cmpgtu_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgtu_sci_h", + (uint32_t) 0x3400607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGTU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) > " + std::to_string((etiss_uint16)(((etiss_uint16)(Imm6)))) + "ULL)))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) > " + std::to_string((etiss_uint16)(((etiss_uint16)(Imm6)))) + "ULL)))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGTU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgtu_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGTU_B ----------------------------------------------------------------- +static InstructionDefinition cv_cmpgtu_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgtu_b", + (uint32_t) 0x3400107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGTU_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGTU_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgtu_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGTU_SC_B -------------------------------------------------------------- +static InstructionDefinition cv_cmpgtu_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgtu_sc_b", + (uint32_t) 0x3400507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGTU_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) > (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGTU_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgtu_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGTU_SCI_B ------------------------------------------------------------- +static InstructionDefinition cv_cmpgtu_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgtu_sci_b", + (uint32_t) 0x3400707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGTU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) > " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) > " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) > " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) > " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGTU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgtu_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGEU_H ----------------------------------------------------------------- +static InstructionDefinition cv_cmpgeu_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgeu_h", + (uint32_t) 0x3c00007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGEU_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) >= (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) >= (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGEU_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgeu_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGEU_SC_H -------------------------------------------------------------- +static InstructionDefinition cv_cmpgeu_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgeu_sc_h", + (uint32_t) 0x3c00407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGEU_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) >= (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) >= (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGEU_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgeu_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGEU_SCI_H ------------------------------------------------------------- +static InstructionDefinition cv_cmpgeu_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgeu_sci_h", + (uint32_t) 0x3c00607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGEU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) >= " + std::to_string((etiss_uint16)(((etiss_uint16)(Imm6)))) + "ULL)))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) >= " + std::to_string((etiss_uint16)(((etiss_uint16)(Imm6)))) + "ULL)))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGEU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgeu_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGEU_B ----------------------------------------------------------------- +static InstructionDefinition cv_cmpgeu_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgeu_b", + (uint32_t) 0x3c00107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGEU_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) >= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) >= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) >= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) >= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGEU_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgeu_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGEU_SC_B -------------------------------------------------------------- +static InstructionDefinition cv_cmpgeu_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgeu_sc_b", + (uint32_t) 0x3c00507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGEU_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) >= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) >= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) >= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) >= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGEU_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgeu_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPGEU_SCI_B ------------------------------------------------------------- +static InstructionDefinition cv_cmpgeu_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpgeu_sci_b", + (uint32_t) 0x3c00707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPGEU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) >= " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) >= " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) >= " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) >= " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPGEU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpgeu_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLTU_H ----------------------------------------------------------------- +static InstructionDefinition cv_cmpltu_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpltu_h", + (uint32_t) 0x4400007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLTU_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLTU_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpltu_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLTU_SC_H -------------------------------------------------------------- +static InstructionDefinition cv_cmpltu_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpltu_sc_h", + (uint32_t) 0x4400407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLTU_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLTU_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpltu_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLTU_SCI_H ------------------------------------------------------------- +static InstructionDefinition cv_cmpltu_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpltu_sci_h", + (uint32_t) 0x4400607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLTU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) < " + std::to_string((etiss_uint16)(((etiss_uint16)(Imm6)))) + "ULL)))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) < " + std::to_string((etiss_uint16)(((etiss_uint16)(Imm6)))) + "ULL)))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLTU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpltu_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLTU_B ----------------------------------------------------------------- +static InstructionDefinition cv_cmpltu_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpltu_b", + (uint32_t) 0x4400107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLTU_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLTU_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpltu_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLTU_SC_B -------------------------------------------------------------- +static InstructionDefinition cv_cmpltu_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpltu_sc_b", + (uint32_t) 0x4400507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLTU_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLTU_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpltu_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLTU_SCI_B ------------------------------------------------------------- +static InstructionDefinition cv_cmpltu_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpltu_sci_b", + (uint32_t) 0x4400707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLTU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) < " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) < " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) < " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) < " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLTU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpltu_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLEU_H ----------------------------------------------------------------- +static InstructionDefinition cv_cmpleu_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpleu_h", + (uint32_t) 0x4c00007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLEU_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) <= (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) <= (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLEU_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpleu_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLEU_SC_H -------------------------------------------------------------- +static InstructionDefinition cv_cmpleu_sc_h_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpleu_sc_h", + (uint32_t) 0x4c00407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLEU_SC_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) <= (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) <= (etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)))))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLEU_SC_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpleu_sc_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLEU_SCI_H ------------------------------------------------------------- +static InstructionDefinition cv_cmpleu_sci_h_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpleu_sci_h", + (uint32_t) 0x4c00607b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLEU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) <= " + std::to_string((etiss_uint16)(((etiss_uint16)(Imm6)))) + "ULL)))) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((etiss_uint16)(((etiss_int16)(((etiss_uint16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) <= " + std::to_string((etiss_uint16)(((etiss_uint16)(Imm6)))) + "ULL)))) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLEU_SCI_H\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpleu_sci_h" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLEU_B ----------------------------------------------------------------- +static InstructionDefinition cv_cmpleu_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpleu_b", + (uint32_t) 0x4c00107b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLEU_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) <= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) <= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (8ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) <= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) <= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (24ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLEU_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpleu_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLEU_SC_B -------------------------------------------------------------- +static InstructionDefinition cv_cmpleu_sc_b_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpleu_sc_b", + (uint32_t) 0x4c00507b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLEU_SC_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) <= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) <= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) <= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) <= (etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 255)))))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLEU_SC_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpleu_sc_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CMPLEU_SCI_B ------------------------------------------------------------- +static InstructionDefinition cv_cmpleu_sci_b_rd_rs1_Imm6 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cmpleu_sci_b", + (uint32_t) 0x4c00707b, + (uint32_t) 0xfc00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CMPLEU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709551360U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 255)) <= " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 0ULL) & 255U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486335U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (8ULL)) & 255)) <= " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 8ULL) & 65280U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073692839935U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 255)) <= " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 16ULL) & 16711680U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069431361535U)) | (((etiss_uint8)(((etiss_int8)(((etiss_uint8)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (24ULL)) & 255)) <= " + std::to_string((etiss_uint8)(((etiss_uint8)(Imm6)))) + "ULL)))) << 24ULL) & 4278190080U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CMPLEU_SCI_B\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 Imm6 = 0; +static BitArrayRange R_Imm6_1(24, 20); +Imm6 += R_Imm6_1.read(ba) << 1; +static BitArrayRange R_Imm6_0(25, 25); +Imm6 += R_Imm6_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cmpleu_sci_b" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | Imm6=" + std::to_string(Imm6) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CPLXMUL_R ---------------------------------------------------------------- +static InstructionDefinition cv_cplxmul_r_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cplxmul_r", + (uint32_t) 0x5400007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_R\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | ((((((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) - (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> 15ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_R\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cplxmul_r" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CPLXMUL_R_DIV2 ----------------------------------------------------------- +static InstructionDefinition cv_cplxmul_r_div2_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cplxmul_r_div2", + (uint32_t) 0x5400207b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_R_DIV2\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | ((((((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) - (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> 16ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_R_DIV2\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cplxmul_r_div2" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CPLXMUL_R_DIV4 ----------------------------------------------------------- +static InstructionDefinition cv_cplxmul_r_div4_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cplxmul_r_div4", + (uint32_t) 0x5400407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_R_DIV4\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | ((((((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) - (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> 17ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_R_DIV4\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cplxmul_r_div4" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CPLXMUL_R_DIV8 ----------------------------------------------------------- +static InstructionDefinition cv_cplxmul_r_div8_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cplxmul_r_div8", + (uint32_t) 0x5400607b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_R_DIV8\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | ((((((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535)) - (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> 18ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_R_DIV8\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cplxmul_r_div8" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CPLXMUL_I ---------------------------------------------------------------- +static InstructionDefinition cv_cplxmul_i_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cplxmul_i", + (uint32_t) 0x5600007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_I\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | ((((((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) - (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 15ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_I\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cplxmul_i" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CPLXMUL_I_DIV2 ----------------------------------------------------------- +static InstructionDefinition cv_cplxmul_i_div2_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cplxmul_i_div2", + (uint32_t) 0x5600207b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_I_DIV2\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | ((((((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) - (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 16ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_I_DIV2\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cplxmul_i_div2" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CPLXMUL_I_DIV4 ----------------------------------------------------------- +static InstructionDefinition cv_cplxmul_i_div4_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cplxmul_i_div4", + (uint32_t) 0x5600407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_I_DIV4\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | ((((((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) - (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 17ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_I_DIV4\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cplxmul_i_div4" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CPLXMUL_I_DIV8 ----------------------------------------------------------- +static InstructionDefinition cv_cplxmul_i_div8_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cplxmul_i_div8", + (uint32_t) 0x5600607b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_I_DIV8\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | ((((((((etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535)) - (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)) * (etiss_int16)((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 18ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CPLXMUL_I_DIV8\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cplxmul_i_div8" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_CPLXCONJ ----------------------------------------------------------------- +static InstructionDefinition cv_cplxconj_rd_rs1 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_cplxconj", + (uint32_t) 0x5c00007b, + (uint32_t) 0xfff0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_CPLXCONJ\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | ((((((-((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535)))) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_CPLXCONJ\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_cplxconj" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUBROTMJ ----------------------------------------------------------------- +static InstructionDefinition cv_subrotmj_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_subrotmj", + (uint32_t) 0x6400007b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUBROTMJ\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535))) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUBROTMJ\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_subrotmj" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUBROTMJ_DIV2 ------------------------------------------------------------ +static InstructionDefinition cv_subrotmj_div2_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_subrotmj_div2", + (uint32_t) 0x6400207b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUBROTMJ_DIV2\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_int16)(((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535))) >> (0ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUBROTMJ_DIV2\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_subrotmj_div2" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUBROTMJ_DIV4 ------------------------------------------------------------ +static InstructionDefinition cv_subrotmj_div4_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_subrotmj_div4", + (uint32_t) 0x6400407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUBROTMJ_DIV4\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_int16)(((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535))) >> (0ULL)) & 65535))) >> 2ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUBROTMJ_DIV4\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_subrotmj_div4" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUBROTMJ_DIV8 ------------------------------------------------------------ +static InstructionDefinition cv_subrotmj_div8_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_subrotmj_div8", + (uint32_t) 0x6400607b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUBROTMJ_DIV8\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_int16)(((((((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535))) >> (0ULL)) & 65535))) >> 3ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUBROTMJ_DIV8\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_subrotmj_div8" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADD_DIV2 ----------------------------------------------------------------- +static InstructionDefinition cv_add_div2_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_add_div2", + (uint32_t) 0x6c00207b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADD_DIV2\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADD_DIV2\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_add_div2" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADD_DIV4 ----------------------------------------------------------------- +static InstructionDefinition cv_add_div4_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_add_div4", + (uint32_t) 0x6c00407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADD_DIV4\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 2ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> 2ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADD_DIV4\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_add_div4" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_ADD_DIV8 ----------------------------------------------------------------- +static InstructionDefinition cv_add_div8_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_add_div8", + (uint32_t) 0x6c00607b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_ADD_DIV8\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 3ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) + (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> 3ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_ADD_DIV8\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_add_div8" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUB_DIV2 ----------------------------------------------------------------- +static InstructionDefinition cv_sub_div2_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sub_div2", + (uint32_t) 0x7400207b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUB_DIV2\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> 1ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUB_DIV2\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sub_div2" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUB_DIV4 ----------------------------------------------------------------- +static InstructionDefinition cv_sub_div4_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sub_div4", + (uint32_t) 0x7400407b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUB_DIV4\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 2ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> 2ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUB_DIV4\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sub_div4" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CV_SUB_DIV8 ----------------------------------------------------------------- +static InstructionDefinition cv_sub_div8_rd_rs1_rs2 ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "cv_sub_div8", + (uint32_t) 0x7400607b, + (uint32_t) 0xfe00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CV_SUB_DIV8\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +if (rd != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744073709486080U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (0ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (0ULL)) & 65535))) >> 3ULL)) >> (0ULL)) & 65535) << 0ULL) & 65535U));\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL] = (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd) + "ULL]) & (18446744069414649855U)) | (((((((etiss_int16)(((((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1) + "ULL]) >> (16ULL)) & 65535) - (((*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2) + "ULL]) >> (16ULL)) & 65535))) >> 3ULL)) >> (0ULL)) & 65535) << 16ULL) & 4294901760U));\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CV_SUB_DIV8\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "cv_sub_div8" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_ZifenceiInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_ZifenceiInstr.cpp new file mode 100644 index 0000000000..228a4ec55b --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_ZifenceiInstr.cpp @@ -0,0 +1,143 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the Zifencei + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// FENCE_I --------------------------------------------------------------------- +static InstructionDefinition fence_i_rd_rs1_imm ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "fence_i", + (uint32_t) 0x00100f, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//FENCE_I\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "cpu->exception = ETISS_RETURNCODE_RELOADBLOCKS;\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->FENCE[1ULL] = " + std::to_string(imm) + "ULL;\n"; +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//FENCE_I\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 imm = 0; +static BitArrayRange R_imm_0(31, 20); +imm += R_imm_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "fence_i" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_tum_csrInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_tum_csrInstr.cpp new file mode 100644 index 0000000000..86a2cb2861 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_tum_csrInstr.cpp @@ -0,0 +1,847 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the tum_csr + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// CSRRW ----------------------------------------------------------------------- +static InstructionDefinition csrrw_rd_rs1_csr ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "csrrw", + (uint32_t) 0x001073, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 csr = 0; +static BitArrayRange R_csr_0(31, 20); +csr += R_csr_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CSRRW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 xrs1 = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 xrd = csr_read(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL);\n"; +cp.code() += "csr_write(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL, xrs1);\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = xrd;\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +else { // conditional +{ // block +cp.code() += "{ // block\n"; +cp.code() += "csr_write(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL, xrs1);\n"; +cp.code() += "} // block\n"; +} // block +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CSRRW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 csr = 0; +static BitArrayRange R_csr_0(31, 20); +csr += R_csr_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "csrrw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | csr=" + std::to_string(csr) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CSRRS ----------------------------------------------------------------------- +static InstructionDefinition csrrs_rd_rs1_csr ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "csrrs", + (uint32_t) 0x002073, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 csr = 0; +static BitArrayRange R_csr_0(31, 20); +csr += R_csr_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CSRRS\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 xrd = csr_read(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL);\n"; +cp.code() += "etiss_uint32 xrs1 = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +if (rs1 != 0ULL) { // conditional +cp.code() += "csr_write(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL, xrd | xrs1);\n"; +} // conditional +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = xrd;\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CSRRS\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 csr = 0; +static BitArrayRange R_csr_0(31, 20); +csr += R_csr_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "csrrs" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | csr=" + std::to_string(csr) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CSRRC ----------------------------------------------------------------------- +static InstructionDefinition csrrc_rd_rs1_csr ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "csrrc", + (uint32_t) 0x003073, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 csr = 0; +static BitArrayRange R_csr_0(31, 20); +csr += R_csr_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CSRRC\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 xrd = csr_read(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL);\n"; +cp.code() += "etiss_uint32 xrs1 = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +if (rs1 != 0ULL) { // conditional +cp.code() += "csr_write(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL, xrd & ~(xrs1));\n"; +} // conditional +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = xrd;\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CSRRC\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint16 csr = 0; +static BitArrayRange R_csr_0(31, 20); +csr += R_csr_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "csrrc" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | csr=" + std::to_string(csr) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CSRRWI ---------------------------------------------------------------------- +static InstructionDefinition csrrwi_rd_zimm_csr ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "csrrwi", + (uint32_t) 0x005073, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 zimm = 0; +static BitArrayRange R_zimm_0(19, 15); +zimm += R_zimm_0.read(ba) << 0; +etiss_uint16 csr = 0; +static BitArrayRange R_csr_0(31, 20); +csr += R_csr_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CSRRWI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 xrd = csr_read(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL);\n"; +cp.code() += "csr_write(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL, " + std::to_string((etiss_uint32)(zimm)) + "ULL);\n"; +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = xrd;\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CSRRWI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 zimm = 0; +static BitArrayRange R_zimm_0(19, 15); +zimm += R_zimm_0.read(ba) << 0; +etiss_uint16 csr = 0; +static BitArrayRange R_csr_0(31, 20); +csr += R_csr_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "csrrwi" << " # " << ba << (" [rd=" + std::to_string(rd) + " | zimm=" + std::to_string(zimm) + " | csr=" + std::to_string(csr) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CSRRSI ---------------------------------------------------------------------- +static InstructionDefinition csrrsi_rd_zimm_csr ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "csrrsi", + (uint32_t) 0x006073, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 zimm = 0; +static BitArrayRange R_zimm_0(19, 15); +zimm += R_zimm_0.read(ba) << 0; +etiss_uint16 csr = 0; +static BitArrayRange R_csr_0(31, 20); +csr += R_csr_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CSRRSI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 xrd = csr_read(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL);\n"; +if (zimm != 0ULL) { // conditional +cp.code() += "csr_write(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL, xrd | " + std::to_string((etiss_uint32)(zimm)) + "ULL);\n"; +} // conditional +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = xrd;\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CSRRSI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 zimm = 0; +static BitArrayRange R_zimm_0(19, 15); +zimm += R_zimm_0.read(ba) << 0; +etiss_uint16 csr = 0; +static BitArrayRange R_csr_0(31, 20); +csr += R_csr_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "csrrsi" << " # " << ba << (" [rd=" + std::to_string(rd) + " | zimm=" + std::to_string(zimm) + " | csr=" + std::to_string(csr) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// CSRRCI ---------------------------------------------------------------------- +static InstructionDefinition csrrci_rd_zimm_csr ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "csrrci", + (uint32_t) 0x007073, + (uint32_t) 0x00707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 zimm = 0; +static BitArrayRange R_zimm_0(19, 15); +zimm += R_zimm_0.read(ba) << 0; +etiss_uint16 csr = 0; +static BitArrayRange R_csr_0(31, 20); +csr += R_csr_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//CSRRCI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 xrd = csr_read(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL);\n"; +if (zimm != 0ULL) { // conditional +cp.code() += "csr_write(cpu, system, plugin_pointers, " + std::to_string(csr) + "ULL, xrd & " + std::to_string(~(((etiss_uint32)(zimm)))) + "ULL);\n"; +} // conditional +if ((rd % 32ULL) != 0ULL) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = xrd;\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//CSRRCI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 zimm = 0; +static BitArrayRange R_zimm_0(19, 15); +zimm += R_zimm_0.read(ba) << 0; +etiss_uint16 csr = 0; +static BitArrayRange R_csr_0(31, 20); +csr += R_csr_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "csrrci" << " # " << ba << (" [rd=" + std::to_string(rd) + " | zimm=" + std::to_string(zimm) + " | csr=" + std::to_string(csr) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_tum_retInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_tum_retInstr.cpp new file mode 100644 index 0000000000..f8c505bf52 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_tum_retInstr.cpp @@ -0,0 +1,504 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the tum_ret + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// ECALL ----------------------------------------------------------------------- +static InstructionDefinition ecall_ ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "ecall", + (uint32_t) 0x000073, + (uint32_t) 0xffffffff, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//ECALL\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 8LL + ((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//ECALL\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "ecall" << " # " << ba << (" []"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// MRET ------------------------------------------------------------------------ +static InstructionDefinition mret_ ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "mret", + (uint32_t) 0x30200073, + (uint32_t) 0xffffffff, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//MRET\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV < 3LL) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2LL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = *((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[833LL];\n"; +cp.code() += "etiss_uint32 s = csr_read(cpu, system, plugin_pointers, 768LL);\n"; +cp.code() += "etiss_uint32 prev_prv = get_field(s, 6144LL);\n"; +cp.code() += "if (prev_prv != 3LL) { // conditional\n"; +cp.code() += "s = set_field(s, 131072LL, 0ULL);\n"; +cp.code() += "} // conditional\n"; +cp.code() += "s = set_field(s, 8LL, get_field(s, 128LL));\n"; +cp.code() += "s = set_field(s, 128LL, 1ULL);\n"; +cp.code() += "s = set_field(s, 6144LL, (extension_enabled(cpu, system, plugin_pointers, 85ULL)) ? (0LL) : (3LL));\n"; +cp.code() += "csr_write(cpu, system, plugin_pointers, 768LL, s);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV = (prev_prv) & 0x7;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//MRET\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "mret" << " # " << ba << (" []"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// WFI ------------------------------------------------------------------------- +static InstructionDefinition wfi_ ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "wfi", + (uint32_t) 0x10500073, + (uint32_t) 0xffffffff, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//WFI\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//WFI\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "wfi" << " # " << ba << (" []"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SRET ------------------------------------------------------------------------ +static InstructionDefinition sret_ ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "sret", + (uint32_t) 0x10200073, + (uint32_t) 0xffffffff, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SRET\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV < ((get_field(csr_read(cpu, system, plugin_pointers, 768LL), 4194304LL)) ? (3LL) : (1LL))) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2LL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = *((RV32IMAFDXCoreVHwlpV0*)cpu)->CSR[321LL];\n"; +cp.code() += "etiss_uint32 s = csr_read(cpu, system, plugin_pointers, 256LL);\n"; +cp.code() += "etiss_uint32 prev_prv = get_field(s, 256LL);\n"; +cp.code() += "s = set_field(s, 2LL, get_field(s, 32LL));\n"; +cp.code() += "s = set_field(s, 32LL, 1ULL);\n"; +cp.code() += "s = set_field(s, 256LL, 0LL);\n"; +cp.code() += "csr_write(cpu, system, plugin_pointers, 768LL, s);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->PRIV = (prev_prv) & 0x7;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SRET\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "sret" << " # " << ba << (" []"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_tum_rvaInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_tum_rvaInstr.cpp new file mode 100644 index 0000000000..354371daab --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_tum_rvaInstr.cpp @@ -0,0 +1,327 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the tum_rva + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// LRW ------------------------------------------------------------------------- +static InstructionDefinition lrw_rd_rs1_rl_aq ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "lrw", + (uint32_t) 0x1000202f, + (uint32_t) 0xf9f0707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//LRW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_int32 res = (etiss_int32)(mem_val_0);\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->RES_ADDR = offs;\n"; +if (rd) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int32)(res);\n"; +} // conditional +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//LRW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "lrw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rl=" + std::to_string(rl) + " | aq=" + std::to_string(aq) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); + +// SCW ------------------------------------------------------------------------- +static InstructionDefinition scw_rd_rs1_rs2_rl_aq ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "scw", + (uint32_t) 0x1800202f, + (uint32_t) 0xf800707f, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//SCW\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 offs = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->RES_ADDR == offs) { // conditional\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "mem_val_0 = (etiss_int32)(*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n"; +cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "} // conditional\n"; +if (rd) { // conditional +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = ((RV32IMAFDXCoreVHwlpV0*)cpu)->RES_ADDR != offs;\n"; +} // conditional +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->RES_ADDR = -1LL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//SCW\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- +etiss_uint8 rd = 0; +static BitArrayRange R_rd_0(11, 7); +rd += R_rd_0.read(ba) << 0; +etiss_uint8 rs1 = 0; +static BitArrayRange R_rs1_0(19, 15); +rs1 += R_rs1_0.read(ba) << 0; +etiss_uint8 rs2 = 0; +static BitArrayRange R_rs2_0(24, 20); +rs2 += R_rs2_0.read(ba) << 0; +etiss_uint8 rl = 0; +static BitArrayRange R_rl_0(25, 25); +rl += R_rl_0.read(ba) << 0; +etiss_uint8 aq = 0; +static BitArrayRange R_aq_0(26, 26); +aq += R_aq_0.read(ba) << 0; + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "scw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + " | rl=" + std::to_string(rl) + " | aq=" + std::to_string(aq) + "]"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +); diff --git a/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_tum_semihostingInstr.cpp b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_tum_semihostingInstr.cpp new file mode 100644 index 0000000000..db7b211929 --- /dev/null +++ b/ArchImpl/RV32IMAFDXCoreVHwlpV0/RV32IMAFDXCoreVHwlpV0_tum_semihostingInstr.cpp @@ -0,0 +1,199 @@ +/** + * Generated on Fri, 17 Nov 2023 19:17:42 +0100. + * + * This file contains the instruction behavior models of the tum_semihosting + * instruction set for the RV32IMAFDXCoreVHwlpV0 core architecture. + */ + +#include "RV32IMAFDXCoreVHwlpV0Arch.h" + +#define ETISS_ARCH_STATIC_FN_ONLY +#include "RV32IMAFDXCoreVHwlpV0Funcs.h" + +using namespace etiss; +using namespace etiss::instr; + + +// EBREAK ---------------------------------------------------------------------- +static InstructionDefinition ebreak_ ( + ISA32_RV32IMAFDXCoreVHwlpV0, + "ebreak", + (uint32_t) 0x100073, + (uint32_t) 0xffffffff, + [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic) + { + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + + { + CodePart & cp = cs.append(CodePart::INITIALREQUIRED); + + cp.code() = std::string("//EBREAK\n"); + +// ----------------------------------------------------------------------------- +{ // block +cp.code() += "{ // block\n"; +cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_1 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_1;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_1 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (" + std::to_string(ic.current_address_) + "ULL == ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 && ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 > 1ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (((RV32IMAFDXCoreVHwlpV0*)cpu)->lpend_0 - ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0 < 8ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 2ULL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "cpu->nextPc = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpstart_0;\n"; +cp.code() += "((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 = ((RV32IMAFDXCoreVHwlpV0*)cpu)->lpcount_0 - 1ULL;\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +{ // block +cp.code() += "{ // block\n"; +cp.code() += "if (etiss_semihost_enabled()) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 mem_val_0;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, " + std::to_string(ic.current_address_ - 4ULL) + "ULL, (etiss_uint8*)&mem_val_0, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint32 pre = (etiss_uint32)(mem_val_0);\n"; +cp.code() += "etiss_uint32 mem_val_1;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, " + std::to_string(ic.current_address_ + 0ULL) + "ULL, (etiss_uint8*)&mem_val_1, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint32 ebreak = (etiss_uint32)(mem_val_1);\n"; +cp.code() += "etiss_uint32 mem_val_2;\n"; +cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, " + std::to_string(ic.current_address_ + 4ULL) + "ULL, (etiss_uint8*)&mem_val_2, 4);\n"; +cp.code() += "if (cpu->exception) { // conditional\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // conditional\n"; +cp.code() += "etiss_uint32 post = (etiss_uint32)(mem_val_2);\n"; +cp.code() += "if (pre == 32509971ULL && ebreak == 1048691ULL && post == 1081102355ULL) { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +cp.code() += "etiss_uint32 operation = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[10ULL];\n"; +cp.code() += "etiss_uint32 parameter = *((RV32IMAFDXCoreVHwlpV0*)cpu)->X[11ULL];\n"; +cp.code() += "*((RV32IMAFDXCoreVHwlpV0*)cpu)->X[10ULL] = (etiss_int32)(etiss_semihost(cpu, system, plugin_pointers, 32ULL, operation, parameter));\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 3LL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "else { // conditional\n"; +{ // block +cp.code() += "{ // block\n"; +{ // procedure +cp.code() += "{ // procedure\n"; +cp.code() += "raise(cpu, system, plugin_pointers, 0ULL, 3LL);\n"; +cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n"; +cp.code() += "} // procedure\n"; +} // procedure +cp.code() += "} // block\n"; +} // block +cp.code() += "} // conditional\n"; +cp.code() += "} // block\n"; +} // block +cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n"; +cp.code() += "cpu->instructionPointer = cpu->nextPc;\n"; +// ----------------------------------------------------------------------------- + cp.getAffectedRegisters().add("instructionPointer", 32); + } + { + CodePart & cp = cs.append(CodePart::APPENDEDRETURNINGREQUIRED); + + cp.code() = std::string("//EBREAK\n"); + +// ----------------------------------------------------------------------------- +cp.code() += "if (cpu->return_pending | cpu->exception | cpu->nextPc != " + std::to_string(ic.current_address_ + 4) + "ULL) return cpu->exception;\n"; +// ----------------------------------------------------------------------------- + } + + return true; + }, + 0, + [] (BitArray & ba, Instruction & instr) + { +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + + std::stringstream ss; +// ----------------------------------------------------------------------------- +ss << "ebreak" << " # " << ba << (" []"); +// ----------------------------------------------------------------------------- + return ss.str(); + } +);