⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 structures.h

📁 run mips program using C++
💻 H
字号:
#ifndef _STRUCTURES_H_#define _STRUCTURES_H_#include <assert.h>#include <iostream>#include <string.h>#include <fstream>#include <math.h>#include <stdlib.h>#define MAX_INSTR_NUM	100		// max number of instructions in a program#define INSTR_TYPE		17		// type of instructions#define KEY_LENGTH		6#define REGISTER_NUM	32#define MAX_LINE_LENGTH 30		// max length of a line of instruction#define MAX_LABEL_NUM	10#define LABEL_LENGTH	10#define MAX_FILE_NAME   30// the structure of an instructiontypedef struct{	unsigned int OP;	// opcode	unsigned int RS;	unsigned int RT;	unsigned int RD;	unsigned int SH;	// shamt	unsigned int FN;	// funct	unsigned int IM;	// immediate number 	unsigned int AD;	// address}Instr;// a line of instructiontypedef struct{	unsigned int instrCode;						// 32-bit code of an instruction	char		 instrName[MAX_LINE_LENGTH];	// a line of instruction in characters	Instr		 instr;							// the decoded structure of an instruction}CodeLine;// the operator structuretypedef struct{	int			 type;				// type 0 for R, type 1 for I, type 2 for J, type 3 for jr because it only uses one reg	unsigned int code;				// the opcode	unsigned int funct;				// the funct section of the instruction used for distingishing operators	char		 name[KEY_LENGTH];	// the name of the operator}Operator;// the register structuretypedef struct{	int used;				// indicate if the register is ever used in the program	unsigned int code;		// the code of the register	char name[KEY_LENGTH];	// the name of the register	unsigned int value;		// the value of the register}Reg;// the label structure used to store the labels appearing in the programtypedef struct{	unsigned int offset;		// the offset value of the label indicating	char name[LABEL_LENGTH];	// the name of the label}Label;// the set of all signalstypedef struct{	unsigned int RegDst;	unsigned int RegWrite;	unsigned int MemtoReg;	unsigned int MemRead;	unsigned int MemWrite;	unsigned int IorD;	unsigned int IRWrite;	unsigned int ALUSrcA;	unsigned int ALUSrcB;	unsigned int PCWrite;	unsigned int PCWriteCond;	unsigned int PCSource;}SignalSet;#endif // _STRUCTURES_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -