definitions of the LC3 instruction set architecture (ISA) (do not modify) More...
Go to the source code of this file.
Data Structures | |
struct | inst_info |
Macros | |
#define | LC3_WORD unsigned short |
#define | LC3_MEM_SIZE 65538 |
#define | LC3_NUM_REGS 8 |
#define | RETURN_ADDR_REG 7 |
Typedefs | |
typedef enum opcode_t | opcode_t |
typedef enum inst_field | inst_field_t |
typedef enum inst_format | inst_format_t |
typedef struct inst_info | inst_info_t |
Enumerations | |
enum | opcode_t { OP_BR = 0, OP_ADD, OP_LD, OP_ST, OP_JSR, OP_AND, OP_LDR, OP_STR, OP_RTI, OP_NOT, OP_LDI, OP_STI, OP_JMP_RET, OP_RESERVED, OP_LEA, OP_TRAP, NUM_OPS } |
enum | inst_field { FMT_R1 = 0x001, FMT_R2 = 0x002, FMT_R3 = 0x004, FMT_CC = 0x008, FMT_IMM5 = 0x010, FMT_IMM6 = 0x020, FMT_VEC8 = 0x040, FMT_ASC8 = 0x080, FMT_IMM9 = 0x100, FMT_IMM11 = 0x200, FMT_IMM16 = 0x400 } |
enum | inst_format { FMT_ = 0, FMT_RRR = (FMT_R1 | FMT_R2 | FMT_R3), FMT_RRI5 = (FMT_R1 | FMT_R2 | FMT_IMM5), FMT_CL = (FMT_CC | FMT_IMM9), FMT_R = FMT_R2, FMT_I11 = FMT_IMM11, FMT_RL = (FMT_R1 | FMT_IMM9), FMT_RRI6 = (FMT_R1 | FMT_R2 | FMT_IMM6), FMT_RR = (FMT_R1 | FMT_R2), FMT_V = FMT_VEC8, FMT_A = FMT_ASC8, FMT_16 = FMT_IMM16 } |
Functions | |
inst_info_t * | lc3_get_inst_info (opcode_t opcode) |
This defines the details of the LC3 instruction set architecture (ISA). It is a separate file so that it could be shared by both an assembler (not yet completed) and the simulator.
#define LC3_MEM_SIZE 65538 |
The LC3 defines a memory accessed by a 16 bit address
#define LC3_NUM_REGS 8 |
The LC3 contains 8 general purpose register, named R0..R7
#define LC3_WORD unsigned short |
LC3 words are 16 bits
#define RETURN_ADDR_REG 7 |
Return address stored in R7
typedef enum inst_field inst_field_t |
A bit field used to define the types of parameters an individual LC3 instruction may have. Each value represents a different bit in the final result. When you see C code like this, it is likely that an integer value is used to represent an "array" of up to 32 boolean values. Each value is accessed with a mask that extracts the bit of interest. See the inst_format_t below.
typedef enum inst_format inst_format_t |
Define a combinatin of parameters an opcode may have. For example, the the BR, LD, LDI, ST and STI instructions all have two parameters. The first is a register, the second is a nine bit offset. This form stores multiple boolean values in a single integer values by using individual bits to encode information.
typedef struct inst_info inst_info_t |
This structure stores the information about a single instruction. See the usage in lc3.c where the information for each LC3 instruction is defined.
enum inst_field |
A bit field used to define the types of parameters an individual LC3 instruction may have. Each value represents a different bit in the final result. When you see C code like this, it is likely that an integer value is used to represent an "array" of up to 32 boolean values. Each value is accessed with a mask that extracts the bit of interest. See the inst_format_t below.
enum inst_format |
Define a combinatin of parameters an opcode may have. For example, the the BR, LD, LDI, ST and STI instructions all have two parameters. The first is a register, the second is a nine bit offset. This form stores multiple boolean values in a single integer values by using individual bits to encode information.
enum opcode_t |
The sixteen LC3 opcodes
inst_info_t* lc3_get_inst_info | ( | opcode_t | opcode | ) |
Get the information for an instruction, given its opcode This is simply an access into an array of values initialized with the information for each of the LC3's sixteen instructions.