Functions
logic.c File Reference

Implementation of the logic.h interface. More...

#include "lc3.h"
#include "hardware.h"
#include "field.h"
#include "logic.h"

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)
 

Detailed Description

This is a implementation of the interface that you will write for the assignment.

Author
your name here

Function Documentation

int logic_decode_instruction ( instruction_t inst)
Todo:
implement this function
int logic_execute_instruction ( instruction_t inst)
Todo:
implement this function
void logic_fetch_instruction ( instruction_t inst)
Todo:
implement this function
LC3_WORD logic_MARMUX ( instruction_t inst,
int  ADDRMUX1sel,
int  ADDRMUX2sel 
)
Todo:
implement this function
LC3_WORD logic_read_memory ( LC3_WORD  addr)

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.

void logic_write_memory ( LC3_WORD  addr,
LC3_WORD  value 
)
Todo:
implement this function
void logic_write_reg ( int  regNum,
LC3_WORD  val 
)
Todo:
implement this function