/*
 * sys_debug.h
 *
 *  Created on: 2016/12/02
 *      Author: takayun
 */

#ifndef SYS_DEBUG_H_
#define SYS_DEBUG_H_

#include "inst_decoder.h"
#include "sys_register.h"

/**************************************************
 *						Defines
 **************************************************/

#define INST_NAME_ARRAY_LEN 5

#define STRING_INST_END		"END"
#define STRING_INST_JUMP	"JUMP"
#define STRING_INST_OUTPUT	"OUT"
#define STRING_INST_LOAD	"LOAD"
#define STRING_INST_STORE	"STOR"
#define STRING_INST_DELAY	"DELY"
#define STRING_INST_ADD		"ADD"
#define STRING_INST_COMP	"COMP"
#define STRING_INST_JEQ		"JEQ"
#define STRING_INST_JNE		"JNE"
#define STRING_INST_JIEQ	"JIEQ"
#define STRING_INST_JINE	"JINE"
#define STRING_INST_SUB		"SUB"


#define REG_NAME_ARRAY_LEN 4

#define STRING_REG_ZERO		"ZE"
#define STRING_REG_PC		"PC"
#define STRING_REG_SP		"SP"
#define STRING_REG_GP0		"GP0"
#define STRING_REG_GP1		"GP1"
#define STRING_REG_ACC		"ACC"
#define STRING_REG_FLG		"FLG"

/**************************************************
 *						Variables
 **************************************************/


/**************************************************
 *						Functions
 **************************************************/

void convertInstName(char inst_name[INST_NAME_ARRAY_LEN], unsigned char inst_code);
void convertRegName(char reg_name[REG_NAME_ARRAY_LEN], enum Register reg_code);

void display_inst(struct InstRec inst, unsigned int pc);
void display_mem(unsigned char memi, char memv);

void delay10ms(unsigned int s);

#endif /* SYS_DEBUG_H_ */
