2024-01-23 19:35:57 +00:00
|
|
|
#ifndef SIMDATA_HEADER
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2024-02-06 23:14:33 +00:00
|
|
|
enum CPU_STATE_t{
|
|
|
|
CPU_RUNNING,
|
|
|
|
CPU_HALTED
|
|
|
|
};
|
|
|
|
|
2024-01-22 12:11:07 +00:00
|
|
|
struct simdata_t{
|
|
|
|
long unsigned int current_clock;
|
2024-01-23 19:35:57 +00:00
|
|
|
uint8_t *RAM;
|
2024-02-13 21:28:42 +00:00
|
|
|
|
2024-02-03 22:54:20 +00:00
|
|
|
struct fetch_data_t *fetch_data;
|
|
|
|
struct decode_data_t *decode_data;
|
|
|
|
struct exec_data_t *exec_data;
|
2024-02-05 21:25:00 +00:00
|
|
|
struct registers_t *registers;
|
2024-02-13 21:28:42 +00:00
|
|
|
|
2024-02-06 23:14:33 +00:00
|
|
|
enum CPU_STATE_t cpu_state;
|
2024-02-13 21:28:42 +00:00
|
|
|
|
2024-02-07 00:31:23 +00:00
|
|
|
struct cpu_gui_hints_t *cpu_gui_hints;
|
2024-02-13 21:28:42 +00:00
|
|
|
|
2024-02-14 02:42:10 +00:00
|
|
|
uint32_t* terminal_output;
|
2024-02-13 21:28:42 +00:00
|
|
|
uint64_t terminal_output_size;
|
2024-02-07 00:31:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
2024-01-22 12:11:07 +00:00
|
|
|
};
|
2024-01-23 19:35:57 +00:00
|
|
|
|
2024-01-22 12:11:07 +00:00
|
|
|
struct simdata_t *init_simdata();
|
|
|
|
|
|
|
|
void free_simdata(struct simdata_t *);
|
2024-02-07 00:31:23 +00:00
|
|
|
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);
|
2024-02-14 02:42:10 +00:00
|
|
|
int terminal_output(uint32_t c,struct simdata_t *simdata);
|
2024-02-20 15:27:24 +00:00
|
|
|
float uint32_to_ieee754_float(uint32_t in);
|
|
|
|
uint32_t ieee754_float_to_uint32(float in);
|
2024-01-23 17:38:44 +00:00
|
|
|
|
2024-02-06 23:14:33 +00:00
|
|
|
enum GUI_CPU_STATE_t{
|
|
|
|
GUI_CPU_RUNNING,
|
|
|
|
GUI_CPU_SINGLE_STEPPING,
|
|
|
|
GUI_CPU_STOPPED
|
2024-01-23 17:38:44 +00:00
|
|
|
};
|
2024-02-03 22:54:20 +00:00
|
|
|
|
2024-01-23 19:35:57 +00:00
|
|
|
#endif
|
|
|
|
#define SIMDATA_HEADER
|