OpenASIP 2.2
|
#include <stdint.h>
Go to the source code of this file.
Functions | |
int | initializeMachine (const char *machinePath, char **error) |
int | resetMachine () |
int | unpackInstruction (uint32_t instruction, char **output, char **error) |
int | executeInstruction32 (const char *opName, const uint32_t *inputs, uint32_t inputsCount, uint32_t *output, char **error) |
int | executeInstruction64 (const char *opName, const uint64_t *inputs, uint32_t inputsCount, uint64_t *output, char **error) |
Declaration of RISCVInstructionExecutor class.
Definition in file RISCVInstructionExecutor.hh.
int executeInstruction32 | ( | const char * | opName, |
const uint32_t * | inputs, | ||
uint32_t | inputsCount, | ||
uint32_t * | output, | ||
char ** | error | ||
) |
Executes a custom 32-wide instruction.
The instruction behavior is searched automatically by OperationPool from the OSAL search paths. See chapter 4.4 in the manual.
opName | The operation name as it is in the machine file. |
inputs | Input value(s) of the operation. Can contain more values than the operation needs, in that case only the first values will be used. |
inputsCount | number of inputs |
output | The result of the operation. |
error | Will not be touched in case of success. Must be freed by the client. |
Definition at line 286 of file RISCVInstructionExecutor.cc.
References Exception::errorMessage(), and RISCVInstructionExecutor::executeInstructionHelper().
int executeInstruction64 | ( | const char * | opName, |
const uint64_t * | inputs, | ||
uint32_t | inputsCount, | ||
uint64_t * | output, | ||
char ** | error | ||
) |
Executes a custom 64-wide instruction.
The instruction behavior is searched automatically by OperationPool from the OSAL search paths. See chapter 4.4 in the manual.
opName | The operation name as it is in the machine file. |
inputs | Input value(s) of the operation. Can contain more values than the operation needs, in that case only the first values will be used. |
inputsCount | number of inputs |
output | The result of the operation. |
error | Will not be touched in case of success. Must be freed by the client. |
Definition at line 335 of file RISCVInstructionExecutor.cc.
References Exception::errorMessage(), and RISCVInstructionExecutor::executeInstructionHelper().
int initializeMachine | ( | const char * | machinePath, |
char ** | error | ||
) |
Initializes the OpenASIP Machine.
Should be called before other functions. Creates the <instruction name, opcode> map for the custom operations, and the OperationPool instruction cache object.
machinePath | path to the .adf machine file. |
error | error messages in case of failure. Can also be a nullptr if desired. Must be freed by the client. |
Definition at line 147 of file RISCVInstructionExecutor.cc.
References RISCVInstructionExecutor::customOps, Exception::errorMessage(), RISCVTools::findCustomOps(), BEMGenerator::generate(), TTAMachine::Machine::loadFromADF(), machine, and RISCVInstructionExecutor::pool.
int resetMachine | ( | ) |
Resets the machine to uninitialized state.
Deletes the customOps map loaded and deletes the OperationPool instruction cache.
Definition at line 189 of file RISCVInstructionExecutor.cc.
References RISCVInstructionExecutor::customOps, and RISCVInstructionExecutor::pool.
int unpackInstruction | ( | uint32_t | instruction, |
char ** | output, | ||
char ** | error | ||
) |
Unpacks a RISC-V R4-type instruction and returns its string representation if found from the machine file.
Remember to call Initialize machine first.
opcode | full RISC-V opcode. Register values are ignored. |
output | The char* representation of the opcode, if it is found. Must be freed by the client. |
error | Error messages in case of failure. Must be freed by the client. |
Definition at line 209 of file RISCVInstructionExecutor.cc.
References R4Instruction::baseopcode, RISCVInstructionExecutor::customOps, RISCVTools::decodeR4Instruction(), R4Instruction::funct2, R4Instruction::funct3, R4Instruction::funct7, RISCVTools::getFunc2Int(), RISCVTools::getFunc3Int(), RISCVTools::getFunc7Int(), RISCVInstructionExecutor::OPC_CUSTOM_0, and RISCVInstructionExecutor::OPC_CUSTOM_1.