summaryrefslogtreecommitdiff
path: root/src/sim/if.cc
blob: 099ff1c499f518f5c4a818c2ec2e5951270e8ae6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "if.h"
#include "accessor.h"
#include "instrDTO.h"
#include "response.h"
#include "stage.h"

IF::IF(Stage *stage) : Stage(stage) { this->id = FETCH; }

Response IF::advance(InstrDTO &i, Response p)
{
	Response r;
	signed int bits;

	r = this->storage->read_word(this->id, this->pc, bits);
	if (r == OK) {
		++this->pc;
		i.set_time_of(this->id, this->clock_cycle);
		i.set_instr_bits(bits);
	}

	return r;
}