criscv/include/cpu.h

24 lines
457 B
C
Raw Normal View History

#ifndef CPU_H
#define CPU_H
2024-10-14 19:48:56 +02:00
#include "address_space.h"
#include <stdint.h>
struct CPU_s {
// [32] of 32bit (uint32_t) registers
2024-10-14 19:48:56 +02:00
uint32_t registers[32];
// Points to the byte of current instruction. Also known as pc
2024-10-14 19:48:56 +02:00
uint32_t programCounter;
// 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);
int cpu_cycle(CPU *cpu);
void print_registers(CPU *cpu);
#endif