-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstruction.hpp
More file actions
45 lines (42 loc) · 1.07 KB
/
instruction.hpp
File metadata and controls
45 lines (42 loc) · 1.07 KB
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
//
// instruction.hpp
// Computer Architecture Project1
//
// Created by York You on 2017/3/14.
// Copyright © 2017年 York You. All rights reserved.
//
#ifndef instruction_hpp
#define instruction_hpp
//
// instruction.cpp
// Computer Architecture Project1
//
// Created by York You on 2017/3/14.
// Copyright © 2017年 York You. All rights reserved.
//
using namespace::std;
class stage;
#include <iostream>
#include "register.hpp"
#include "memory.hpp"
#include "stage.hpp"
class Instruction{//implementation
friend class Reg;
friend class stage;
public:
Instruction(){error="";output="";std::fill(Oldreg,Oldreg+34,0);};
void StartInstrctuion(Reg *r,Memory *m,stage *s);
void RecordRegAndUpdate(Reg *r,int cycle);//need to fix
void RecordStage();
void RecordError(Reg *r);
string BinaryToHex(bitset<32>);
std::string getOut(){return output;}
std::string getError(){return error;}
int cycle;
private:
bitset<32> Oldreg[35];
string stageOutput[5];
std::string output;
std::string error;
};
#endif /* instruction_hpp */