2024-10-15 17:07:18 +02:00
|
|
|
#ifndef CPU_H
|
|
|
|
#define CPU_H
|
|
|
|
|
2024-10-14 19:48:56 +02:00
|
|
|
#include "address_space.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
struct CPU_s {
|
2024-10-19 20:16:31 +02:00
|
|
|
// [32] of 32bit (uint32_t) registers
|
2024-10-14 19:48:56 +02:00
|
|
|
uint32_t registers[32];
|
2024-10-19 20:16:31 +02:00
|
|
|
|
|
|
|
// Points to the byte of current instruction. Also known as pc
|
2024-10-14 19:48:56 +02:00
|
|
|
uint32_t programCounter;
|
2024-10-19 20:16:31 +02:00
|
|
|
|
|
|
|
// The address space
|
2024-10-14 19:48:56 +02:00
|
|
|
AddressSpace *addressSpace;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct CPU_s CPU;
|
|
|
|
|
2024-10-15 13:30:45 +02:00
|
|
|
CPU create_cpu(AddressSpace *addressSpace);
|
2024-10-15 17:07:18 +02:00
|
|
|
int cpu_cycle(CPU *cpu);
|
|
|
|
|
|
|
|
#endif
|