forked from j1m5s3/comparch_lab2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.h
44 lines (33 loc) · 1.45 KB
/
shell.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/***************************************************************/
/* */
/* MIPS Instruction Level Simulator */
/* */
/* This file is modifed from UChicago's Comp Arch course */
/* */
/***************************************************************/
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
/* DO NOT MODIFY THIS FILE! */
/* You should only change sim.c! */
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
#ifndef _SIM_SHELL_H_
#define _SIM_SHELL_H_
#include <inttypes.h>
#define FALSE 0
#define TRUE 1
#define MIPS_REGS 32
typedef struct CPU_State_Struct {
uint32_t PC; /* program counter */
int32_t REGS[MIPS_REGS]; /* register file. */
int FLAG_N; /* negative flag or sign flag*/
int FLAG_Z; /* zero flag */
int FLAG_V; /* overflow flag */
int FLAG_C; /* carry flag */
} CPU_State;
/* Data Structure for Latch */
extern CPU_State CURRENT_STATE, NEXT_STATE;
extern int RUN_BIT; /* run bit */
uint32_t mem_read_32(uint32_t address);
void mem_write_32(uint32_t address, uint32_t value);
/* YOU IMPLEMENT THIS FUNCTION */
void process_instruction();
#endif