Implementiral clock, dodal machine.h in popravu pol vsa shit v machine.cpp, naredu ukaze za f1, f2
This commit is contained in:
parent
3cfdd46516
commit
cf3dd766d0
5 changed files with 308 additions and 88 deletions
24
ass2/cpu.h
Normal file
24
ass2/cpu.h
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
#include "machine.h"
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
class cpu {
|
||||
private:
|
||||
std::atomic<bool> running;
|
||||
std::thread nitUre;
|
||||
int hitrostKhz;
|
||||
int operacijeNaTick;
|
||||
machine *m;
|
||||
|
||||
public:
|
||||
cpu(machine *m) : running(false), hitrostKhz(1), operacijeNaTick(10), m(m) {}
|
||||
void start();
|
||||
void stop();
|
||||
bool isRunning();
|
||||
void setSpeed(int kHz);
|
||||
int getSpeed();
|
||||
private:
|
||||
void zankaUre();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue