xref: /onnv-gate/usr/src/uts/sparc/v9/sys/vis_simulator.h (revision 8829:441ff9004eed)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*8829SSree.Vemuri@Sun.COM  * Common Development and Distribution License (the "License").
6*8829SSree.Vemuri@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*8829SSree.Vemuri@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_VIS_SIMULATOR_H
270Sstevel@tonic-gate #define	_SYS_VIS_SIMULATOR_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /*
300Sstevel@tonic-gate  * VIS opf codes, instruction type
310Sstevel@tonic-gate  */
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #ifdef	__cplusplus
340Sstevel@tonic-gate extern "C" {
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate 
370Sstevel@tonic-gate /* kstat structure for reporting kstats */
380Sstevel@tonic-gate extern struct visinfo_kstat visinfo;
390Sstevel@tonic-gate 
400Sstevel@tonic-gate typedef			/* typical VIS instruction. */
410Sstevel@tonic-gate 	struct {
420Sstevel@tonic-gate 	unsigned int		op	: 2;	/* Top two bits. */
430Sstevel@tonic-gate 	unsigned int		rd	: 5;	/* Destination. */
440Sstevel@tonic-gate 	unsigned int		op3	: 6;	/* Main op code. */
450Sstevel@tonic-gate 	unsigned int		rs1	: 5;	/* First operand. */
460Sstevel@tonic-gate 	unsigned int		opf	: 9;	/* Floating-point op code. */
470Sstevel@tonic-gate 	unsigned int		rs2	: 5;	/* Second operand. */
480Sstevel@tonic-gate } vis_inst_type;
490Sstevel@tonic-gate 
500Sstevel@tonic-gate enum vis_opf {		/* VIS opf codes. */
510Sstevel@tonic-gate 	edge8		= 0x0,
520Sstevel@tonic-gate 	edge8n		= 0x1,
530Sstevel@tonic-gate 	edge8l		= 0x2,
540Sstevel@tonic-gate 	edge8ln		= 0x3,
550Sstevel@tonic-gate 	edge16		= 0x4,
560Sstevel@tonic-gate 	edge16n		= 0x5,
570Sstevel@tonic-gate 	edge16l		= 0x6,
580Sstevel@tonic-gate 	edge16ln	= 0x7,
590Sstevel@tonic-gate 	edge32		= 0x8,
600Sstevel@tonic-gate 	edge32n		= 0x9,
610Sstevel@tonic-gate 	edge32l		= 0xa,
620Sstevel@tonic-gate 	edge32ln	= 0xb,
630Sstevel@tonic-gate 	array8		= 0x10,
640Sstevel@tonic-gate 	array16		= 0x12,
650Sstevel@tonic-gate 	array32		= 0x14,
660Sstevel@tonic-gate 	alignaddr	= 0x18,
670Sstevel@tonic-gate 	bmask		= 0x19,
680Sstevel@tonic-gate 	alignaddrl	= 0x1a,
690Sstevel@tonic-gate 	fcmple16	= 0x20,
700Sstevel@tonic-gate 	fcmpne16	= 0x22,
710Sstevel@tonic-gate 	fcmple32	= 0x24,
720Sstevel@tonic-gate 	fcmpne32	= 0x26,
730Sstevel@tonic-gate 	fcmpgt16	= 0x28,
740Sstevel@tonic-gate 	fcmpeq16	= 0x2a,
750Sstevel@tonic-gate 	fcmpgt32	= 0x2c,
760Sstevel@tonic-gate 	fcmpeq32	= 0x2e,
770Sstevel@tonic-gate 	fmul8x16	= 0x31,
780Sstevel@tonic-gate 	fmul8x16au	= 0x33,
790Sstevel@tonic-gate 	fmul8x16al	= 0x35,
800Sstevel@tonic-gate 	fmul8sux16	= 0x36,
810Sstevel@tonic-gate 	fmul8ulx16	= 0x37,
820Sstevel@tonic-gate 	fmuld8sux16	= 0x38,
830Sstevel@tonic-gate 	fmuld8ulx16	= 0x39,
840Sstevel@tonic-gate 	fpack32		= 0x3a,
850Sstevel@tonic-gate 	fpack16		= 0x3b,
860Sstevel@tonic-gate 	fpackfix	= 0x3d,
870Sstevel@tonic-gate 	pdist		= 0x3e,
88*8829SSree.Vemuri@Sun.COM 	pdistn		= 0x3f,
890Sstevel@tonic-gate 	faligndata	= 0x48,
900Sstevel@tonic-gate 	fpmerge		= 0x4b,
910Sstevel@tonic-gate 	bshuffle	= 0x4c,
920Sstevel@tonic-gate 	fexpand		= 0x4d,
930Sstevel@tonic-gate 	fpadd16		= 0x50,
940Sstevel@tonic-gate 	fpadd16s	= 0x51,
950Sstevel@tonic-gate 	fpadd32		= 0x52,
960Sstevel@tonic-gate 	fpadd32s	= 0x53,
970Sstevel@tonic-gate 	fpsub16		= 0x54,
980Sstevel@tonic-gate 	fpsub16s	= 0x55,
990Sstevel@tonic-gate 	fpsub32		= 0x56,
1000Sstevel@tonic-gate 	fpsub32s	= 0x57,
1010Sstevel@tonic-gate 	fzero		= 0x60,
1020Sstevel@tonic-gate 	fzeros		= 0x61,
1030Sstevel@tonic-gate 	fnor		= 0x62,
1040Sstevel@tonic-gate 	fnors		= 0x63,
1050Sstevel@tonic-gate 	fandnot2	= 0x64,
1060Sstevel@tonic-gate 	fandnot2s	= 0x65,
1070Sstevel@tonic-gate 	fnot2		= 0x66,
1080Sstevel@tonic-gate 	fnot2s		= 0x67,
1090Sstevel@tonic-gate 	fandnot1	= 0x68,
1100Sstevel@tonic-gate 	fandnot1s	= 0x69,
1110Sstevel@tonic-gate 	fnot1		= 0x6a,
1120Sstevel@tonic-gate 	fnot1s		= 0x6b,
1130Sstevel@tonic-gate 	fxor		= 0x6c,
1140Sstevel@tonic-gate 	fxors		= 0x6d,
1150Sstevel@tonic-gate 	fnand		= 0x6e,
1160Sstevel@tonic-gate 	fnands		= 0x6f,
1170Sstevel@tonic-gate 	fand		= 0x70,
1180Sstevel@tonic-gate 	fands		= 0x71,
1190Sstevel@tonic-gate 	fxnor		= 0x72,
1200Sstevel@tonic-gate 	fxnors		= 0x73,
1210Sstevel@tonic-gate 	fsrc1		= 0x74,
1220Sstevel@tonic-gate 	fsrc1s		= 0x75,
1230Sstevel@tonic-gate 	fornot2		= 0x76,
1240Sstevel@tonic-gate 	fornot2s	= 0x77,
1250Sstevel@tonic-gate 	fsrc2		= 0x78,
1260Sstevel@tonic-gate 	fsrc2s		= 0x79,
1270Sstevel@tonic-gate 	fornot1		= 0x7a,
1280Sstevel@tonic-gate 	fornot1s	= 0x7b,
1290Sstevel@tonic-gate 	for_op		= 0x7c,		/* compiler does not like the use */
1300Sstevel@tonic-gate 	fors_op		= 0x7d,		/* of the key word "for" ! */
1310Sstevel@tonic-gate 	fone		= 0x7e,
1320Sstevel@tonic-gate 	fones		= 0x7f,
1330Sstevel@tonic-gate 	siam		= 0x81
1340Sstevel@tonic-gate };
1350Sstevel@tonic-gate 
1360Sstevel@tonic-gate #define	GSR_ALIGN_MASK	UINT64_C(0x0000000000000007)
1370Sstevel@tonic-gate #define	GSR_ALIGN_SHIFT	0
1380Sstevel@tonic-gate #define	GSR_SCALE_MASK	UINT64_C(0x00000000000000f8)
1390Sstevel@tonic-gate #define	GSR_SCALE_SHIFT	3
1400Sstevel@tonic-gate #define	GSR_IRND_MASK	UINT64_C(0x0000000006000000)
1410Sstevel@tonic-gate #define	GSR_IRND_SHIFT	25
1420Sstevel@tonic-gate #define	GSR_IM_MASK	UINT64_C(0x0000000008000000)
1430Sstevel@tonic-gate #define	GSR_IM_SHIFT	27
1440Sstevel@tonic-gate #define	GSR_MASK_MASK	UINT64_C(0xffffffff00000000)
1450Sstevel@tonic-gate #define	GSR_MASK_SHIFT	32
1460Sstevel@tonic-gate 
1470Sstevel@tonic-gate #define	GSR_IM_IRND_MASK	(GSR_IM_MASK | GSR_IRND_MASK)
1480Sstevel@tonic-gate #define	GSR_ALIGN(gsr)	((gsr & GSR_ALIGN_MASK) >> GSR_ALIGN_SHIFT)
1490Sstevel@tonic-gate #define	GSR_SCALE(gsr)	((gsr & GSR_SCALE_MASK) >> GSR_SCALE_SHIFT)
1500Sstevel@tonic-gate #define	GSR_IRND(gsr)	((gsr & GSR_IRND_MASK) >> GSR_IRND_SHIFT)
1510Sstevel@tonic-gate #define	GSR_IM(gsr)	((gsr & GSR_IM_MASK) >> GSR_IM_SHIFT)
1520Sstevel@tonic-gate #define	GSR_MASK(gsr)	((gsr & GSR_MASK_MASK) >> GSR_MASK_SHIFT)
1530Sstevel@tonic-gate 
1540Sstevel@tonic-gate /* PUBLIC FUNCTIONS */
1550Sstevel@tonic-gate 
1560Sstevel@tonic-gate /*
1570Sstevel@tonic-gate  * vis_fpu_simulator simulates VIS FPU instructions only; reads and writes
1580Sstevel@tonic-gate  * FPU data registers directly.
1590Sstevel@tonic-gate  */
1600Sstevel@tonic-gate 
1610Sstevel@tonic-gate extern enum ftt_type vis_fpu_simulator(fp_simd_type *, fp_inst_type,
1620Sstevel@tonic-gate 			struct regs *, void *, kfpu_t *);
1630Sstevel@tonic-gate 
1640Sstevel@tonic-gate /*
1650Sstevel@tonic-gate  * Simulator for VIS loads and stores between floating-point unit and memory.
1660Sstevel@tonic-gate  */
1670Sstevel@tonic-gate enum ftt_type vis_fldst(fp_simd_type *, fp_inst_type, struct regs *,
1680Sstevel@tonic-gate 			void *, unsigned);
1690Sstevel@tonic-gate 
1700Sstevel@tonic-gate /*
1710Sstevel@tonic-gate  * Simulator for rd %gsr instruction.
1720Sstevel@tonic-gate  */
1730Sstevel@tonic-gate enum ftt_type vis_rdgsr(fp_simd_type *, fp_inst_type, struct regs *,
1740Sstevel@tonic-gate 			void *, kfpu_t *);
1750Sstevel@tonic-gate 
1760Sstevel@tonic-gate /*
1770Sstevel@tonic-gate  * Simulator for wr %gsr instruction.
1780Sstevel@tonic-gate  */
1790Sstevel@tonic-gate enum ftt_type vis_wrgsr(fp_simd_type *, fp_inst_type, struct regs *,
1800Sstevel@tonic-gate 			void *, kfpu_t *);
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate #ifdef	__cplusplus
1830Sstevel@tonic-gate }
1840Sstevel@tonic-gate #endif
1850Sstevel@tonic-gate 
1860Sstevel@tonic-gate #endif	/* _SYS_VIS_SIMULATOR_H */
187