Newer
Older
DE2_115_PROG / software / qsys_tutorial_lcd2 / inst_decoder.h
@takayun takayun on 16 Dec 2016 1 KB initial commit
/*
 * inst_decoder.h
 *
 *  Created on: 2016/11/25
 *      Author: takayun
 */

#ifndef INST_DECODER_H_
#define INST_DECODER_H_

#include "sys_register.h"

#define INST_END	0x0
#define INST_JUMP	0x1
#define INST_OUTPUT	0x2
#define INST_LOAD	0x3
#define INST_STORE	0x4
#define INST_DELAY	0x5
#define INST_ADD	0x6
#define INST_COMP	0x7
#define INST_JEQ	0x8
#define INST_JNE	0x9
#define INST_JIEQ	0xA
#define INST_JINE	0xB

struct InstRec {
	unsigned int inst : 4;
	unsigned int memi : 4;
	unsigned int regi : 4;
};

struct InstRec inst_fetch();

void inst_decode(struct InstRec inst_rec);

void inst_jump(enum Register reg, unsigned char memory_index);
void inst_output(enum Register reg, unsigned char memory_index);
void inst_load(enum Register reg, unsigned char memory_index);
void inst_store(enum Register reg, unsigned char memory_index);
void inst_delay(enum Register reg, unsigned char memory_index);
void inst_add(enum Register reg, unsigned char memory_index);
void inst_comp(enum Register reg, unsigned char memory_index);
void inst_jeq(enum Register reg, unsigned char memory_index);
void inst_jne(enum Register reg, unsigned char memory_index);
void inst_jieq(char im, unsigned char memory_index);
void inst_jine(char im, unsigned char memory_index);


#endif /* INST_DECODER_H_ */