Data Fields
inst_fields Struct Reference

#include <logic.h>

Data Fields

LC3_WORD addr
 
LC3_WORD bits
 
opcode_t opcode
 
int DR
 
int SR1
 
int SR2
 
int bit5
 
int bit11
 
LC3_WORD trapvect8
 
LC3_WORD imm5
 
LC3_WORD offset6
 
LC3_WORD PCoffset9
 
LC3_WORD PCoffset11
 
LC3_WORD SR1OUT
 
LC3_WORD SR2MUX [2]
 
LC3_WORD SR2MUXval
 
LC3_WORD ADDR1MUX [2]
 
LC3_WORD ADDR2MUX [4]
 

Detailed Description

This structure holds all the fields that occur in an instruction. Conceptually, all of these fields are computed in parallel in the combinational logic of the LC3 and the control logic selects the values to use depending on the actual instruction. In hardware, there is "no" cost to computing things you might not use. In the implementation, you may choose to precompute all the fields, or simply get values from the instruction itself as they are needed. This structure is used as the parameter for logic_fetch_instruction(), logic_decode_instruction(), and logic_execute_instruction(), ... .

Field Documentation

LC3_WORD inst_fields::addr

address of the instruction

LC3_WORD inst_fields::ADDR1MUX[2]

the two inputs of ADDR2MUX. One value is a result of adding the BaseR and the offest. The other contains the incremented PC.

LC3_WORD inst_fields::ADDR2MUX[4]

Four inputs of ADDR2MUX. There is a 0 and three different sign extended values.

int inst_fields::bit11

distinguishes JSR/JSRR

int inst_fields::bit5

distinguishes immediate from register

LC3_WORD inst_fields::bits

16 bit instruction

int inst_fields::DR

destination register

LC3_WORD inst_fields::imm5

immediate value

LC3_WORD inst_fields::offset6

a register offset

opcode_t inst_fields::opcode

opcode of instruction

LC3_WORD inst_fields::PCoffset11

offset from program counter

LC3_WORD inst_fields::PCoffset9

offset from program counter

int inst_fields::SR1

source register 1

LC3_WORD inst_fields::SR1OUT

value of SR1

int inst_fields::SR2

source register 2

LC3_WORD inst_fields::SR2MUX[2]
 the two inputs of SR2MUX. The value of bit5

selects the input to use

LC3_WORD inst_fields::SR2MUXval

value of SR2MUX

LC3_WORD inst_fields::trapvect8

value for TRAP


The documentation for this struct was generated from the following file: