-
Notifications
You must be signed in to change notification settings - Fork 3
/
ex.h
50 lines (44 loc) · 1.03 KB
/
ex.h
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 EX_H
#define EX_H
#include "reg_def.h"
#include <cstdio>
class EX
{
public:
unsigned char type;
ERROR_NUM err_no;
EX();
void set_RegImm(unsigned int arg_rd,
REG arg_rs1,
REG arg_rs2,
unsigned long long arg_imm64);
void set_pc(REG arg_pc);
void set_ctrl(INST32_CTRL_BIT arg_ctrl);
ERROR_NUM BranchCmp();
ERROR_NUM ALU();
ERROR_NUM set_next_pc();
INST32_CTRL_BIT get_ctrl();
unsigned long long get_ALU_output();
REG get_pc();
REG get_next_pc();
REG get_rs2();
unsigned int get_rd();
void print();
unsigned long long get_cycles();
bool is_mul64();
bool is_divrem();
private:
unsigned long long A, B;
REG rs1, rs2;
unsigned int rd;
REG pc, next_pc;
unsigned long long imm64;
unsigned long long ALU_output;
INST32_CTRL_BIT ctrl;
BRUN_CTRL get_BrUn();
BSEL_CTRL get_BSel();
ASEL_CTRL get_ASel();
ALUSEL_CTRL get_ALUSel();
PCSEL_CTRL get_PCSel();
};
#endif // EX_H