-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWritebackStage.C
More file actions
38 lines (34 loc) · 927 Bytes
/
WritebackStage.C
File metadata and controls
38 lines (34 loc) · 927 Bytes
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
#include <string>
#include <cstdint>
#include "RegisterFile.h"
#include "PipeRegField.h"
#include "PipeReg.h"
#include "Stage.h"
#include "Status.h"
#include "W.h"
#include "WritebackStage.h"
#include "Status.h"
#include "Instructions.h"
#include "Debug.h"
/*
* doClockLow
*/
bool WritebackStage::doClockLow(PipeReg ** pregs, Stage ** stages) {
W * wreg = (W *) pregs[WREG];
uint64_t stat = wreg->getstat()->getOutput();
return (stat != SAOK);
}
/*
* doClockHigh
*/
void WritebackStage::doClockHigh(PipeReg ** pregs) {
RegisterFile * regfile = regfile->getInstance();
W * wreg = (W *) pregs[WREG];
uint64_t W_valE = wreg->getvalE()->getOutput();
uint64_t W_dstE = wreg->getdstE()->getOutput();
uint64_t W_dstM = wreg->getdstM()->getOutput();
uint64_t W_valM = wreg->getvalM()->getOutput();
bool error = false;
regfile->writeRegister(W_valE, W_dstE, error);
regfile->writeRegister(W_valM, W_dstM, error);
}