flycast/core/hw/aica/dsp.h

133 lines
1.9 KiB
C
Raw Normal View History

2013-12-19 17:10:14 +00:00
#pragma once
2020-03-28 16:58:01 +00:00
#include "types.h"
2013-12-19 17:10:14 +00:00
struct dsp_t
{
//Dynarec
u8 DynCode[4096*8]; //32 kb, 8 pages
//buffered DSP state
//24 bit wide
2018-07-29 19:47:30 +00:00
s32 TEMP[128];
2013-12-19 17:10:14 +00:00
//24 bit wide
2018-07-29 19:47:30 +00:00
s32 MEMS[32];
2013-12-19 17:10:14 +00:00
//20 bit wide
s32 MIXS[16];
//RBL/RBP (decoded)
u32 RBP;
u32 RBL;
struct
{
bool MAD_OUT;
bool MEM_ADDR;
bool MEM_RD_DATA;
bool MEM_WT_DATA;
bool FRC_REG;
bool ADRS_REG;
bool Y_REG;
bool MDEC_CT;
bool MWT_1;
bool MRD_1;
//bool MADRS;
bool MEMS;
bool NOFL_1;
bool NOFL_2;
bool TEMPS;
bool EFREG;
}regs_init;
//s32 -> stored as signed extended to 32 bits
struct
{
s32 MAD_OUT;
s32 MEM_ADDR;
s32 MEM_RD_DATA;
s32 MEM_WT_DATA;
s32 FRC_REG;
s32 ADRS_REG;
s32 Y_REG;
u32 MDEC_CT;
u32 MWT_1;
u32 MRD_1;
u32 MADRS;
u32 NOFL_1;
u32 NOFL_2;
}regs;
//DEC counter :)
2018-07-29 19:47:30 +00:00
//u32 DEC;
2013-12-19 17:10:14 +00:00
//various dsp regs
signed int ACC; //26 bit
signed int SHIFTED; //24 bit
signed int B; //26 bit
2019-01-23 21:46:05 +00:00
signed int MEMVAL[4];
signed int FRC_REG; //13 bit
signed int Y_REG; //24 bit
2013-12-19 17:10:14 +00:00
unsigned int ADDR;
unsigned int ADRS_REG; //13 bit
2013-12-19 17:10:14 +00:00
//Direct Mapped data :
//COEF *128
//MADRS *64
//MPRO(dsp code) *4 *128
//EFREG *16
//EXTS *2
2018-07-29 19:47:30 +00:00
// Interpreter flags
bool Stopped;
2013-12-19 17:10:14 +00:00
//Dynarec flags
2013-12-19 17:10:14 +00:00
bool dyndirty;
};
2020-02-19 22:20:32 +00:00
alignas(4096) extern dsp_t dsp;
2013-12-19 17:10:14 +00:00
void dsp_init();
void dsp_term();
void dsp_step();
2018-07-29 19:47:30 +00:00
void dsp_writenmem(u32 addr);
2021-01-26 17:48:17 +00:00
void dsp_rec_init();
void dsp_rec_step();
void dsp_recompile();
2018-07-29 19:47:30 +00:00
struct _INST
{
u8 TRA;
bool TWT;
u8 TWA;
bool XSEL;
u8 YSEL;
u8 IRA;
bool IWT;
u8 IWA;
bool EWT;
u8 EWA;
bool ADRL;
bool FRCL;
u8 SHIFT;
bool YRL;
bool NEGB;
bool ZERO;
bool BSEL;
bool NOFL; //MRQ set
bool TABLE; //MRQ set
bool MWT; //MRQ set
bool MRD; //MRQ set
u8 MASA; //MRQ set
bool ADREB; //MRQ set
bool NXADR; //MRQ set
2018-07-29 19:47:30 +00:00
};
void DecodeInst(const u32 *IPtr, _INST *i);
2018-07-29 19:47:30 +00:00
u16 DYNACALL PACK(s32 val);
s32 DYNACALL UNPACK(u16 val);