First/simdata.h

54 lines
1.1 KiB
C

#ifndef SIMDATA_HEADER
#include <stdint.h>
enum CPU_STATE_t{
CPU_RUNNING,
CPU_HALTED
};
struct simdata_t{
long unsigned int current_clock;
uint8_t *RAM;
struct fetch_data_t *fetch_data;
struct decode_data_t *decode_data;
struct exec_data_t *exec_data;
struct registers_t *registers;
enum CPU_STATE_t cpu_state;
struct cpu_gui_hints_t *cpu_gui_hints;
uint32_t* terminal_output;
uint64_t terminal_output_size;
};
struct instr_list_t{
uint32_t address;
struct instr_list_t *next;
};
struct cpu_gui_hints_t{
struct instr_list_t *fetching_list;
struct instr_list_t *decoding_list;
struct instr_list_t *executing_list;
};
struct simdata_t *init_simdata();
void free_simdata(struct simdata_t *);
int add_to_instr_list(struct instr_list_t **addr_of_toadd,uint32_t address);
void free_instr_list(struct instr_list_t **addr_of_tofree);
int terminal_output(uint32_t c,struct simdata_t *simdata);
float uint32_to_ieee754_float(uint32_t in);
uint32_t ieee754_float_to_uint32(float in);
enum GUI_CPU_STATE_t{
GUI_CPU_RUNNING,
GUI_CPU_SINGLE_STEPPING,
GUI_CPU_STOPPED
};
#endif
#define SIMDATA_HEADER