gamma.h 3.54 KB
/*
 * Copyright (C) 1998 by the Board of Trustees
 *    of Leland Stanford Junior University.
 * Copyright (C) 1998 Digital Equipment Corporation
 *
 * This file is part of the SimOS distribution.
 * See LICENSE file for terms of the license.
 *
 */



#ifndef GAMMA_H
#define GAMMA_H

#include "simtypes.h"
#include "alpha.h"

typedef struct GammaParams {
   int debugLoadStore;
   int recognizePrefetches;
} GammaParams;
extern GammaParams gammaParams;

typedef void (*OperateFunction)(Reg,Reg,const Reg *rcp,Reg *rdestp);
typedef void (*MemoryFunction)(Reg *rdestp,const Reg *rap, Reg *, PA, VA);
typedef void (*FPFunction)(const double *a, const double *b, const double *c, double *dest, Reg *fpcr);

extern OperateFunction gammaOperateTable[];
extern MemoryFunction  gammaMemoryTable[];
extern FPFunction      gammaFPTable[];
extern void GammaInitTables(void);
extern void GammaStall(AlphaState *,CPUStatus);

/* **********************************************************
 * Opcode flags
 * **********************************************************/

#define AXPTYPE_INT             (1<<0)
#define AXPTYPE_INT_CONDITIONAL (1<<1)
#define AXPTYPE_FP              (1<<2)
#define AXPTYPE_FP_SINGLE       (1<<3)
#define AXPTYPE_FP_CVT          (1<<4)
#define AXPTYPE_FP_EMPTY        (1<<5)
#define AXPTYPE_FP_CONDITIONAL  (1<<6)
#define AXPTYPE_CANTRAP         (1<<7)
#define AXPTYPE_GAMMA           (1<<8)   /* implemented in gamma but not delta, so callout */


extern uint gammaOperateFlags[];
extern uint gammaFPFlags[];

/* **********************************************************
 * LL/SC support. Functions defined in gamma.c
 * **********************************************************/

extern void ldl_l_ff(Reg *, const Reg *, Reg *, PA, VA);
extern void stl_c_ff(Reg *, const Reg *, Reg *, PA, VA);
extern void ldq_l_ff(Reg *, const Reg *, Reg *, PA, VA);
extern void stq_c_ff(Reg *, const Reg *, Reg *, PA, VA);

extern void GammaFPInit(); /* installs SIGFPE handler */
extern int GammaFPCRIndicatesTrap(AlphaState *P);

int GammaBranchOpcode( AlphaState *P, int opcode, Reg *pra, Reg_s r, double f);
int GammaOperateOpcode(AlphaState *P, int code_func, Reg ra, Reg rb, const Reg *rcPtr, Reg *rdestPtr);
int GammaFloatingOpcode(AlphaState *P,int opcode,int func, 
			const double *rap, const double *rbp, const double *rcp, double *rdestp);
int GammaMiscOpcode(AlphaState *P, uint instr, Reg *rdestp);
Result GammaUncachedOperation(VA  vAddr, int type, void *data);
int GammaMemoryReadOpcode(int opcode,Reg *rdestp, Reg vAddr);
int GammaMemoryWriteOpcode(int opcode, Reg *rdestp, const Reg *raPtr, Reg vAddr);

/* ******************************
 * debugging interface. in cpu_interface.c
 * ******************************/

extern void    GammaCPUVectorInit(void);
extern SimTime GammaCycleCount(int);
extern SimTime GammaInstructionCount(int);
extern int     GammaDebug(int cpunum, int is_break_instruction);
extern Result  GammaPutReg(int cpunum, int regnum, Reg val);
extern Result  GammaPutMem(int cpunum, VA vAddr, uint nbytes, char *buf);

extern void    GammaUnstall(int cpuNum); 
extern void    GammaTakeBusError(int cpuNum, bool isIRef, VA vAddr);

extern void    GammaTurnOnCaches(void);
extern void    GammaTurnOffCaches(void);
extern bool    GammaCachesAreOn(void);

extern char *GammaStats(void);


#define GAMMA_NOBREAK      (-2)
#define GAMMA_BREAKANYCPU  (-1)

extern int gamma_debug_mode;
extern int gamma_break_nexti;
extern int gamma_sigusr;
extern int gammaArithTrap;

extern int gammaSkipCaches;


extern void DeltaGammaRun(AlphaState *);

void GammaInitStats(void);


#endif  /* GAMMA_H */