127 lines
4.1 KiB
C
127 lines
4.1 KiB
C
#include <stdint.h>
|
|
|
|
// The layout of this file is slightly unusual due to 32+64bit support,
|
|
// it includes the files srve_core_h.h (structures) and srve_core_c.h (code)
|
|
// with some bookkeeping.
|
|
|
|
#ifdef SRVE_CORE_64BIT
|
|
|
|
#define SRVE_SREG_T int64_t
|
|
#define SRVE_UREG_T uint64_t
|
|
#define SRVE_CORE_T srve_core64_t
|
|
#define STRUCT_SRVE_CORE struct srve_core64
|
|
#define SRVE_CORE_INIT srve_core64_init
|
|
#define SRVE_CORE_INSTRFUNC_T srve_core64_instrfunc_t
|
|
#define SRVE_CORE_INSTR_BAD srve_core64_instr_bad
|
|
#define SRVE_CORE_INSTR_REGALU srve_core64_instr_regalu
|
|
#define SRVE_CORE_INSTR_IMMALU srve_core64_instr_immalu
|
|
#define SRVE_CORE_INSTR_LOAD srve_core64_instr_load
|
|
#define SRVE_CORE_INSTR_STORE srve_core64_instr_store
|
|
#define SRVE_CORE_INSTR_AMO srve_core64_instr_amo
|
|
#define SRVE_CORE_INSTR_FENCE srve_core64_instr_fence
|
|
#define SRVE_CORE_INSTR_LUI srve_core64_instr_lui
|
|
#define SRVE_CORE_INSTR_AUIPC srve_core64_instr_auipc
|
|
#define SRVE_CORE_INSTR_SYSTEM srve_core64_instr_system
|
|
#define SRVE_CORE_INSTR_BRANCH srve_core64_instr_branch
|
|
#define SRVE_CORE_INSTR_JAL srve_core64_instr_jal
|
|
#define SRVE_CORE_INSTR_JALR srve_core64_instr_jalr
|
|
#define SRVE_CORE_DOALU srve_core64_doalu
|
|
#define SRVE_CORE_READCSR srve_core64_readcsr
|
|
#define SRVE_CORE_WRITECSR srve_core64_writecsr
|
|
#define SRVE_CORE_TRANSLATE srve_core64_translate
|
|
#define SRVE_CORE_LOAD srve_core64_load
|
|
#define SRVE_CORE_STORE srve_core64_store
|
|
#define SRVE_CORE_FETCH srve_core64_fetch
|
|
#define SRVE_CORE_FUNCNAME srve_core64_funcname
|
|
#define SRVE_CORE_DISASM srve_core64_disasm
|
|
#define SRVE_CORE_DOINSTR srve_core64_doinstr
|
|
|
|
#ifndef SRVE_CORE_H64
|
|
#define SRVE_CORE_H64
|
|
|
|
#include "srve_core_h.h"
|
|
|
|
// From ifndef of SRVE_CORE_H64:
|
|
#endif
|
|
// From ifdef of SRVE_CORE_64BIT:
|
|
#else
|
|
#ifndef SRVE_CORE_32BIT
|
|
#error Either SRVE_CORE_64BIT or SRVE_CORE_32BIT must be defined to compile srve_core.h
|
|
#endif
|
|
|
|
#define SRVE_SREG_T int32_t
|
|
#define SRVE_UREG_T uint32_t
|
|
#define SRVE_CORE_T srve_core32_t
|
|
#define STRUCT_SRVE_CORE struct srve_core32
|
|
#define SRVE_CORE_INIT srve_core32_init
|
|
#define SRVE_CORE_INSTRFUNC_T srve_core32_instrfunc_t
|
|
#define SRVE_CORE_INSTR_BAD srve_core32_instr_bad
|
|
#define SRVE_CORE_INSTR_REGALU srve_core32_instr_regalu
|
|
#define SRVE_CORE_INSTR_IMMALU srve_core32_instr_immalu
|
|
#define SRVE_CORE_INSTR_LOAD srve_core32_instr_load
|
|
#define SRVE_CORE_INSTR_STORE srve_core32_instr_store
|
|
#define SRVE_CORE_INSTR_AMO srve_core32_instr_amo
|
|
#define SRVE_CORE_INSTR_FENCE srve_core32_instr_fence
|
|
#define SRVE_CORE_INSTR_LUI srve_core32_instr_lui
|
|
#define SRVE_CORE_INSTR_AUIPC srve_core32_instr_auipc
|
|
#define SRVE_CORE_INSTR_SYSTEM srve_core32_instr_system
|
|
#define SRVE_CORE_INSTR_BRANCH srve_core32_instr_branch
|
|
#define SRVE_CORE_INSTR_JAL srve_core32_instr_jal
|
|
#define SRVE_CORE_INSTR_JALR srve_core32_instr_jalr
|
|
#define SRVE_CORE_DOALU srve_core32_doalu
|
|
#define SRVE_CORE_READCSR srve_core32_readcsr
|
|
#define SRVE_CORE_WRITECSR srve_core32_writecsr
|
|
#define SRVE_CORE_TRANSLATE srve_core32_translate
|
|
#define SRVE_CORE_LOAD srve_core32_load
|
|
#define SRVE_CORE_STORE srve_core32_store
|
|
#define SRVE_CORE_FETCH srve_core32_fetch
|
|
#define SRVE_CORE_FUNCNAME srve_core32_funcname
|
|
#define SRVE_CORE_DISASM srve_core32_disasm
|
|
#define SRVE_CORE_DOINSTR srve_core32_doinstr
|
|
|
|
#ifndef SRVE_CORE_H32
|
|
#define SRVE_CORE_H32
|
|
|
|
#include "srve_core_h.h"
|
|
|
|
// From ifndef of SRVE_CORE_H32:
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef SRVE_IMPLEMENTATION
|
|
|
|
#include "srve_core_c.h"
|
|
|
|
// From ifdef of SRVE_IMPLEMENTATION
|
|
#endif
|
|
|
|
#undef SRVE_SREG_T
|
|
#undef SRVE_UREG_T
|
|
#undef SRVE_CORE_T
|
|
#undef SRVE_CORE_INSTRFUNC_T
|
|
#undef STRUCT_SRVE_CORE
|
|
#undef SRVE_CORE_INSTR_BAD
|
|
#undef SRVE_CORE_INSTR_REGALU
|
|
#undef SRVE_CORE_INSTR_IMMALU
|
|
#undef SRVE_CORE_INSTR_LOAD
|
|
#undef SRVE_CORE_INSTR_STORE
|
|
#undef SRVE_CORE_INSTR_AMO
|
|
#undef SRVE_CORE_INSTR_FENCE
|
|
#undef SRVE_CORE_INSTR_LUI
|
|
#undef SRVE_CORE_INSTR_AUIPC
|
|
#undef SRVE_CORE_INSTR_SYSTEM
|
|
#undef SRVE_CORE_INSTR_BRANCH
|
|
#undef SRVE_CORE_INSTR_JAL
|
|
#undef SRVE_CORE_INSTR_JALR
|
|
#undef SRVE_CORE_DOALU
|
|
#undef SRVE_CORE_READCSR
|
|
#undef SRVE_CORE_WRITECSR
|
|
#undef SRVE_CORE_INIT
|
|
#undef SRVE_CORE_TRANSLATE
|
|
#undef SRVE_CORE_LOAD
|
|
#undef SRVE_CORE_STORE
|
|
#undef SRVE_CORE_FETCH
|
|
#undef SRVE_CORE_FUNCNAME
|
|
#undef SRVE_CORE_DISASM
|
|
#undef SRVE_CORE_DOINSTR
|