summaryrefslogtreecommitdiff
path: root/src/sim/if.cc
blob: f5a2bb98a9c0314855894cd73ee26a7fd4948315 (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 r;
	signed int bits;

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

	return r;
}