summaryrefslogtreecommitdiff
path: root/qdme.h
blob: 26f043e42dfb97f77cce2508627c1fff30925f95 (plain)
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
45
46
47
48
49
50
#ifndef _QDME_H
#define _QDME_H

#include <stdint.h>

#define MEM_SIZE		4096
#define RA				31
#define V0				2
#define V1				3
#define A0				4
#define A1				5
#define A2				6
#define A3				7
#define WORD_SIZE		4

typedef struct {
	unsigned int op: 6;
	unsigned int rs: 5;
	unsigned int rt: 5;
	unsigned int rd: 5;
	unsigned int shamt: 5;
	unsigned int func: 6;
} rtype_t;

typedef struct {
	unsigned int op: 6;
	unsigned int rs: 5;
	unsigned int rt: 5;
	unsigned int imm: 16;
} itype_t;

typedef struct {
	unsigned int op: 6;
	unsigned int addr: 26;
} jtype_t;

typedef enum { NOP, RTYPE, ITYPE, JTYPE } type_t;

typedef struct {
	type_t type;
	union {
		rtype_t r;
		jtype_t j;
		itype_t i;
		uint32_t value;
	};
} inst_t;

#endif