-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessor.cpp
More file actions
32 lines (20 loc) · 769 Bytes
/
processor.cpp
File metadata and controls
32 lines (20 loc) · 769 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
//
// Created by Ignacio Mora on 2019-09-13.
//
#include <iostream>
#include "processor.h"
Processor::Processor(bool *clk, int num_cores, int dist_number, float parameter, Memory* memory):memory_controller(&cache_bus, clk, memory) {
this->clk = clk;
this->num_cores = num_cores;
this->memory = memory;
Program* program = new Program(dist_number, parameter);
for (int i = 0; i < num_cores; ++i) {
cores.push_back(new Core(clk, i, new Program(dist_number, parameter), &cache_bus, memory));
}
}
void Processor::run() {
for (int i = 0; i < num_cores; ++i) {
core_threads.push_back(std::thread(&Core::run,*cores[i]));
}
mem_ctrl_thread = std::thread(&MemoryController::startCheckingBus, &memory_controller);
}