Newer
Older
emul / emul_inst_decipher.c
@TakayunDev TakayunDev on 6 May 2016 951 bytes initial commit
#include "emul_inst_decipher.h"
#include <stdio.h>

/*
typedef struct {
    int opecode;
    int string;
} emul_isa_t;
*/

emul_isa_t isa_dict[] {
    { ADD, "add" },
    { ADDI, "addi" },
    { SUB, "sub" },

    { SLT, "slt" },
    { SLTI, "slti" },
    { SEQ, "seq" },
    { SGE, "sge" },
    { SGT, "sgt" },
    { SLE, "sle"},
    { SNE, "sne" },

    { B, "b"},
    { BEQ, "beq" },
    { BNE, "bne" },
    { J, "j" },

    { LW, "lw" },

    { SW, "sw" },

    { MOVE, "move" }
};

FILE *fp;

void emul_inst_dec_init() {
}

void emul_inst_dec_load(char *filename) {
    if ((fp = open(filename_cache, "r")) == NULL) {
	fprintf(stderr, "%s is can not open", filename);
    }
}
void emul_inst_dec_close() {
    fclose(fp);
}

// Example:
//   ASM: add St0, Ss0, Ss1
//   RETURN: add
int emul_inst_dec_get_opecode() {

}

// Example:
//   ASM: add St0, Ss0, Ss1
//   RETURN: St0
//   RETURN: Ss0
//   RETURN: Ss1
int emul_inst_dec_get_operand() {
}