-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathproc.h
53 lines (45 loc) · 2.01 KB
/
proc.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
51
52
#ifndef __KITE_PROC_H__
#define __KITE_PROC_H__
#include <cstdint>
#include "alu.h"
#include "br_predictor.h"
#include "data_cache.h"
#include "data_memory.h"
#include "inst_memory.h"
#include "pipe_reg.h"
#include "reg_file.h"
class proc_t {
public:
proc_t();
~proc_t();
void init(const char *m_program_code); // Processor initialization
void run(); // Run the processor pipeline.
private:
void writeback(); // Writeback stage
void memory(); // Memory stage
void execute(); // Execute stage
void decode(); // Instruction decode stage
void fetch(); // Instruction fetch stage
void flush(); // Flush pipeline.
void print_stats(); // Print pipeline stats.
uint64_t stalls; // Number of stall cycles
uint64_t num_insts; // Number of instructions
#ifdef BR_PRED
uint64_t num_br_predicts; // Number of branch predictions
uint64_t num_br_mispredicts; // Number of branch mis-predictions
uint64_t num_br_tgt_mispredicts; // Number of branch target mis-predictions
#endif
uint64_t num_flushes; // Number of pipeline flushes
uint64_t ticks; // Clock ticks (cycles)
uint64_t pc; // Program counter
inst_memory_t *inst_memory; // Instruction memory
br_predictor_t *br_predictor; // Branch predictor
br_target_buffer_t *br_target_buffer; // Branch target buffer
reg_file_t *reg_file; // Register file
alu_t *alu; // ALU
data_memory_t *data_memory; // Data memory
data_cache_t *data_cache; // Data cache
pipe_reg_t if_id_preg, id_ex_preg; // Pipeline registers
pipe_reg_t ex_mem_preg, mem_wb_preg;
};
#endif