vu.h 3.91 KB

/**************************************************************************
 *                                                                        *
 *               Copyright (C) 1994, Silicon Graphics, Inc.               *
 *                                                                        *
 *  These coded instructions, statements, and computer programs  contain  *
 *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
 *  are protected by Federal copyright  law.  They  may not be disclosed  *
 *  to  third  parties  or copied or duplicated in any form, in whole or  *
 *  in part, without the prior written consent of Silicon Graphics, Inc.  *
 *                                                                        *
 *************************************************************************/

/*
 * File:	vu.h
 * Creator:	hsa@sgi.com
 * Create Date:	Wed Feb  9 13:40:43 PST 1994
 *
 * Include file for the vector unit module.
 *
 */

#ifndef _rsp_vu_h_
#define _rsp_vu_h_ 1

/*
 * The vu pipe depth is really 5. But, the fetch happens
 * in the rspctl module, and doesn't get passed to the vu
 * until the RD stage, really.
 */
#define rsp_VUPIPEDEPTH		5-1
#define rsp_VUPIPE_STAGE_IF	4
#define rsp_VUPIPE_STAGE_RD	3	/* these are atomic */
#define rsp_VUPIPE_STAGE_EX	3
#define rsp_VUPIPE_STAGE_DF	3
#define rsp_VUPIPE_STAGE_WB	0

typedef struct {
    u32		flags;
    i16		delay;
    boolean	stalled;
    u32		inst;
    u32		pc;
    i16		rs;
    i16		rt;
    i16		rd;
    i16		format;
    i128	result;
    i128	result8[8];
    u32		addr;	/* used for loads/stores */
    char	opString[12];
    u16		res16;
    u16		res16_element;
    boolean	inhibit_wb;
} rsp_vuPipe_t;

extern int VUZeroPipe;

/* VU registers: */
extern i128	rsp_VUR[32];	/* 64-bit VU GPR */
extern i64	rsp_ACC[8];	/* 48-bit accumulator(s) */
extern u16	rsp_VCO; 	/* carry in/out */
extern u16 	rsp_VCC;	/* vector compare code */
extern u8 	rsp_VCE;	/* control used by double precision vch/vcl*/

#define VU_ACC_MASK       ((1LL<<48)-1)

/* tables for fancy element encoding (see sketch): */
extern int	cmask_tab[];
extern int	emask_tab[];
 
extern boolean	rsp_VUStalled;	/* VU pipeline is stalled or not */

extern void	rsp_VuInit(int init_regs);
extern boolean	rsp_VUIsStalled(void);
extern void	rsp_VUExec(u32 inst, u32 pc);

/* register locking for stall support: */
extern void	rsp_VURegLock(int reg, u32 pc);
extern void	rsp_VURegUnLock(int reg, u32 pc);
extern boolean	rsp_VURegIsLocked(int reg, u32 pc);

/* load/store */
extern boolean	rsp_VULoadStoreCheckStall(void);
extern void	rsp_VULoadInstall(u32 inst, u32 pc);
extern void	rsp_VUStoreInstall(u32 inst, u32 pc);
extern boolean	rsp_VULoadStorePipeStep(void);

/* cp2 moves */
extern boolean	rsp_VUMoveCheckStall(void);
extern void	rsp_VUMoveToInstall(u32 inst, u32 pc);
extern void	rsp_VUMoveFromInstall(u32 inst, u32 pc);
extern boolean	rsp_VUMovePipeStep(void);

/* mult */
extern boolean	rsp_VUMultCheckStall(void);
extern void	rsp_VUMultInstall(u32 inst, u32 pc);
extern boolean	rsp_VUMultPipeStep(void);

/* add */
extern boolean	rsp_VUAddCheckStall(void);
extern void	rsp_VUAddInstall(u32 inst, u32 pc);
extern boolean	rsp_VUAddPipeStep(void);

/* select */
extern boolean	rsp_VUSelectCheckStall(void);
extern void	rsp_VUSelectInstall(u32 inst, u32 pc);
extern boolean	rsp_VUSelectPipeStep(void);

/* add */
extern boolean	rsp_VULogicalCheckStall(void);
extern void	rsp_VULogicalInstall(u32 inst, u32 pc);
extern boolean	rsp_VULogicalPipeStep(void);

/* div */
extern boolean	rsp_VUDivCheckStall(void);
extern void	rsp_VUDivInstall(u32 inst, u32 pc);
extern boolean	rsp_VUDivPipeStep(void);

/* pack */
extern boolean	rsp_VUPackCheckStall(void);
extern void	rsp_VUPackInstall(u32 inst, u32 pc);
extern boolean	rsp_VUPackPipeStep(void);

/*
 * Debugging operations.
 */
extern i128	rsp_VURGet(i16 reg);
extern void	rsp_VURSet(i16 reg, i128 value);

/*
 * Debugging print controls
 */
extern int rsp_VUSpacing;

#endif