void dataProcessingInstr(struct ProcessorState *processor, int address)
Executes a data processing instruction
Executes a data processing instruction stored in (*processor).memory[address]
uses: isValidCond(...), barrelShift(...)
void multiplyInstr(struct ProcessorState *processor, int address)
Executes a multiplication instruction
uses: isValidCond(...),
Executes a multiplication instruction stored in (*processor).memory[address]
uses: isValidCond(...)
void dataTransferInstr(struct ProcessorState *processor, int address)
Executes a single data transfer instruction
Executes a single data transfer instruction stored in (*processor).memory[address]
uses: isValidCond(...), barrelShift(...)
void branchInstr(stuct ProcessorState *processor, int address)
uses: isValidCond(...),
uses: isValidCond(...),
struct ProcessorState *loadBinary(char* src)
creates a new processor and loads its memory from a binary file.
creates a new ProcessorState and loads its memory from a binary file.
Helper functions (used in more than one method):
...
...
@@ -51,7 +52,7 @@ int validCond(int cond, struct ProcessorState *processor)
IMPLEMENTED
int32_t barrelShift(int immediate, int32_t operand, int *carry, struct ProcessorState *processor)
Implements the functionality of the barrel shifter
Implements the functionality of the barrel shifter. The carry output is written to (*carry), just in case you need it.
NOTE: for some reason the I bit is used in opposite ways for data processing instructions vs for data transfer instructions. Arbitrarily, let this method
assume that the data processing instruction interpretation is the right one (so for data transfer instructions just call this method with NOT i).