First/cpu.h

69 lines
973 B
C
Raw Normal View History

#ifndef CPU_HEADER
#include "simdata.h"
struct fetch_data_t{
};
struct decode_data_t{
uint32_t in_bytecode;
};
///// EXEC DATA STRUCTURES ///////
enum EXEC_ACTION_t {
EXEC_ALU,
JUMP
};
enum ALU_OP_t {
ALU_ADD,
ALU_SUB,
ALU_SL,
ALU_SR,
ALU_CMP
};
enum OP_ADDR_t {
IMMEDIATE,
REGISTER,
};
struct exec_op_t {
enum OP_ADDR_t OP_ADDR;
uint32_t data;
};
struct exec_data_t {
enum EXEC_ACTION_t EXEC_ACTION;
enum ALU_OP_t ALU_OP;
struct exec_op_t *in_op1;
struct exec_op_t *in_op2;
struct exec_op_t *out_op;
};
void cpu_simdata_free(struct simdata_t *simdata);
int cpu_simdata_malloc(struct simdata_t *simdata);
int cpu_cycle_clock(struct simdata_t *simdata);
// +===================+
// | BIT | USAGE |
// |-----+-------------|
// | 0 | ZERO |
// |-----+-------------|
// | 1 | CARRY |
// |-----+-------------|
// | 2 | SIGN |
//
struct registers_t{
uint32_t GPR[8];
uint32_t FLAGS;
};
#endif
#define CPU_HEADER