Implementation of the logic.h interface. More...
Functions | |
LC3_WORD | logic_read_reg (int regNum) |
void | logic_write_reg (int regNum, LC3_WORD val) |
LC3_WORD | logic_read_memory (LC3_WORD addr) |
void | logic_write_memory (LC3_WORD addr, LC3_WORD value) |
void | logic_fetch_instruction (instruction_t *inst) |
int | logic_decode_instruction (instruction_t *inst) |
int | logic_execute_instruction (instruction_t *inst) |
LC3_WORD | logic_MARMUX (instruction_t *inst, int ADDRMUX1sel, int ADDRMUX2sel) |
This is a implementation of the interface that you will write for the assignment.
int logic_decode_instruction | ( | instruction_t * | inst | ) |
int logic_execute_instruction | ( | instruction_t * | inst | ) |
void logic_fetch_instruction | ( | instruction_t * | inst | ) |
LC3_WORD logic_MARMUX | ( | instruction_t * | inst, |
int | ADDRMUX1sel, | ||
int | ADDRMUX2sel | ||
) |
This function encapsulates the details of how memory is actually read. It must deal with getting the MAR set correctly, peforming the read, and returning a value. This involve accessing the resources described in the hardware.h file.
LC3_WORD logic_read_reg | ( | int | regNum | ) |
This function encapsulates the details of how to get the value of a register. While it is nothing more than a direct call to a function described in hardware.h, it means that the programmer need only understand this set of methods. Only the implementor of this code will need to deal with the hardware interface.