|
OpenASIP 2.2
|
#include <memory>#include <string>#include <vector>#include "BEMGenerator.hh"#include "BinaryEncoding.hh"#include "InstructionFormat.hh"#include "Machine.hh"#include "Operation.hh"#include "OperationContext.hh"#include "OperationPool.hh"#include "RISCVFields.hh"#include "RISCVTools.hh"
Go to the source code of this file.
Namespaces | |
| namespace | RISCVInstructionExecutor |
Functions | |
| std::vector< SimValue > | RISCVInstructionExecutor::executeInstructionHelper (const char *opName, uint8_t width, const uint64_t *inputs, int inputsCount) |
| 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) |
Variables | |
| constexpr unsigned | RISCVInstructionExecutor::OPC_CUSTOM_0 = 0b0001011 |
| constexpr unsigned | RISCVInstructionExecutor::OPC_CUSTOM_1 = 0b0101011 |
| std::map< std::string, int > | RISCVInstructionExecutor::customOps = {} |
| std::unique_ptr< OperationPool > | RISCVInstructionExecutor::pool = nullptr |
Definition of RISCVInstructionExecutor class.
Definition in file RISCVInstructionExecutor.cc.
| 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.
