simulator work
This commit is contained in:
parent
27b8de1bc2
commit
9cc0c10e35
584 changed files with 29988 additions and 0 deletions
51
ass2/simulator/machine.h
Normal file
51
ass2/simulator/machine.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#ifndef MACHINE_H
|
||||
#define MACHINE_H
|
||||
|
||||
class Machine {
|
||||
private:
|
||||
int A;
|
||||
int B;
|
||||
int L;
|
||||
int T;
|
||||
int S;
|
||||
int X;
|
||||
int PC;
|
||||
int SW;
|
||||
double F;
|
||||
static const int MEMORY_SIZE = 1000000;
|
||||
static const int MAX_ADDRESS = MEMORY_SIZE - 1;
|
||||
unsigned char memory[MEMORY_SIZE];
|
||||
|
||||
public:
|
||||
Machine();
|
||||
|
||||
int getA() { return A; }
|
||||
int getB() { return B; }
|
||||
int getL() { return L; }
|
||||
int getT() { return T; }
|
||||
int getS() { return S; }
|
||||
int getX() { return X; }
|
||||
int getPC() { return PC; }
|
||||
double getF() { return F; }
|
||||
|
||||
void setA(int val) { A = val; }
|
||||
void setB(int val) { B = val; }
|
||||
void setL(int val) { L = val; }
|
||||
void setT(int val) { T = val; }
|
||||
void setS(int val) { S = val; }
|
||||
void setX(int val) { X = val; }
|
||||
void setPC(int val) { PC = val; }
|
||||
void setF(double val) { F = val; }
|
||||
|
||||
int getReg(int reg);
|
||||
void setReg(int reg, int val);
|
||||
|
||||
unsigned char readByte(unsigned int address);
|
||||
void writeByte(unsigned int address, unsigned char val);
|
||||
|
||||
unsigned int getWord(unsigned int address);
|
||||
void setWord(unsigned int address, unsigned int val);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue