/* Author : Rick van der Zwet * S-number : 0433373 * Version : $Id: datapath.h 366 2007-12-04 18:29:07Z rick $ * Copyright : FreeBSD Licence * Description : Memory unit header */ #ifndef DATAPATH_H #define DATAPATH_H #include "sim.h" #include "alu.h" #include "constant.h" #include "imm.h" #include "memory.h" typedef enum { NO_COMPONENT, A, B, TEMP, TEMP2, PC, MAR, MDR, CONST, IMM } sx_control_t; typedef enum { DATAPATH, MEMORY } mux_control_t; typedef enum { READONLY, WRITE } buffer_control_t; typedef enum { R_A=1, R_B, R_AB, W_C, R_AxW_C, R_BxW_C, R_ABxW_C } register_control_t; /* XXX: Not that effient, might be the use of bitfields */ typedef struct { sx_control_t s1; sx_control_t s2; mux_control_t mux; const_control_t constant; imm_control_t imm; alu_control_t alu_unit; mem_control_t memory; buffer_control_t a; buffer_control_t b; buffer_control_t c; buffer_control_t temp; buffer_control_t temp2; buffer_control_t pc; buffer_control_t mar; buffer_control_t mdr; buffer_control_t ir; register_control_t reg; address_t register_address_a; address_t register_address_b; address_t register_address_c; } control_t; word a; word b; word c; word temp; word temp2; word pc; word mar; word mdr; word ir; word imm; word constant; word reg[32]; word select_sx(const sx_control_t control); void update_state(control_t control); #endif