1*bc92ec78Smacallan /* $NetBSD: sxreg.h,v 1.22 2024/05/12 13:43:27 macallan Exp $ */ 23b60920aSmacallan 33b60920aSmacallan /*- 43b60920aSmacallan * Copyright (c) 2013 The NetBSD Foundation, Inc. 53b60920aSmacallan * All rights reserved. 63b60920aSmacallan * 73b60920aSmacallan * This code is derived from software contributed to The NetBSD Foundation 83b60920aSmacallan * by Michael Lorenz. 93b60920aSmacallan * 103b60920aSmacallan * Redistribution and use in source and binary forms, with or without 113b60920aSmacallan * modification, are permitted provided that the following conditions 123b60920aSmacallan * are met: 133b60920aSmacallan * 1. Redistributions of source code must retain the above copyright 143b60920aSmacallan * notice, this list of conditions and the following disclaimer. 153b60920aSmacallan * 2. Redistributions in binary form must reproduce the above copyright 163b60920aSmacallan * notice, this list of conditions and the following disclaimer in the 173b60920aSmacallan * documentation and/or other materials provided with the distribution. 183b60920aSmacallan * 193b60920aSmacallan * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 203b60920aSmacallan * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 213b60920aSmacallan * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 223b60920aSmacallan * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 233b60920aSmacallan * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 243b60920aSmacallan * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 253b60920aSmacallan * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 263b60920aSmacallan * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 273b60920aSmacallan * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 283b60920aSmacallan * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 293b60920aSmacallan * POSSIBILITY OF SUCH DAMAGE. 303b60920aSmacallan */ 313b60920aSmacallan 323b60920aSmacallan /* register definitions for Sun's SX / SPAM rendering engine */ 333b60920aSmacallan 343b60920aSmacallan #ifndef SXREG_H 353b60920aSmacallan #define SXREG_H 363b60920aSmacallan 373b60920aSmacallan /* SX control registers */ 383b60920aSmacallan #define SX_CONTROL_STATUS 0x00000000 393b60920aSmacallan #define SX_ERROR 0x00000004 403b60920aSmacallan #define SX_PAGE_BOUND_LOWER 0x00000008 413b60920aSmacallan #define SX_PAGE_BOUND_UPPER 0x0000000c 423b60920aSmacallan #define SX_PLANEMASK 0x00000010 433b60920aSmacallan #define SX_ROP_CONTROL 0x00000014 /* 8 bit ROP */ 443b60920aSmacallan #define SX_IQ_OVERFLOW_COUNTER 0x00000018 453b60920aSmacallan #define SX_DIAGNOSTICS 0x0000001c 463b60920aSmacallan #define SX_INSTRUCTIONS 0x00000020 473b60920aSmacallan #define SX_ID 0x00000028 483b60920aSmacallan #define SX_R0_INIT 0x0000002c 493b60920aSmacallan #define SX_SOFTRESET 0x00000030 509a79811eSmacallan #define SX_SYNC 0x00000034 /* write will stall CPU until */ 519a79811eSmacallan /* SX is idle */ 523b60920aSmacallan /* write registers directly, only when processor is stopped */ 533b60920aSmacallan #define SX_DIRECT_R0 0x00000100 543b60920aSmacallan #define SX_DIRECT_R1 0x00000104 /* and so on until R127 */ 553b60920aSmacallan /* write registers via pseudo instructions */ 563b60920aSmacallan #define SX_QUEUED_R0 0x00000300 573b60920aSmacallan #define SX_QUEUED_R1 0x00000304 /* and so on until R127 */ 58d4cb83d8Smacallan #define SX_QUEUED(r) (0x300 + ((r) << 2)) 59d211f15bSmacallan 60d211f15bSmacallan /* special purpose registers */ 61d211f15bSmacallan #define R_ZERO 0 62d211f15bSmacallan #define R_SCAM 1 63d211f15bSmacallan #define R_MASK 2 /* bitmask for SX_STORE_SELECT */ 643b60920aSmacallan 653b60920aSmacallan /* 663b60920aSmacallan * registers are repeated at 0x1000 with certain parts read only 6743e7cffbSmacallan * ( like the PAGE_BOUND registers ) which userland has no business writing to 683b60920aSmacallan */ 693b60920aSmacallan 703b60920aSmacallan /* SX_CONTROL_STATUS */ 713b60920aSmacallan #define SX_EE1 0x00000001 /* illegal instruction */ 723b60920aSmacallan #define SX_EE2 0x00000002 /* page bound error */ 733b60920aSmacallan #define SX_EE3 0x00000004 /* illegal memory access */ 743b60920aSmacallan #define SX_EE4 0x00000008 /* illegal register access */ 753b60920aSmacallan #define SX_EE5 0x00000010 /* alignment violation */ 763b60920aSmacallan #define SX_EE6 0x00000020 /* illegal instruction queue write */ 773b60920aSmacallan #define SX_EI 0x00000080 /* interrupt on error */ 789a79811eSmacallan /* 799a79811eSmacallan * XXX 809a79811eSmacallan * the following bit definitions are from the SX manual. They're defined in a 819a79811eSmacallan * different way in SunOS's sxreg.h, the hardware seems to follow the latter. 829a79811eSmacallan */ 839a79811eSmacallan #if 0 843b60920aSmacallan #define SX_PB 0x00001000 /* enable page bound checking */ 85cbf5c65aSandvar #define SX_WO 0x00002000 /* write occurred ( by SX ) */ 863b60920aSmacallan #define SX_GO 0x00004000 /* start/stop the processor */ 873b60920aSmacallan #define SX_MT 0x00008000 /* instruction queue is empty */ 889a79811eSmacallan #endif 899a79811eSmacallan 909a79811eSmacallan #define SX_PB 0x00000400 /* enable page bound checking */ 91cbf5c65aSandvar #define SX_WO 0x00000800 /* write occurred ( by SX ) */ 929a79811eSmacallan #define SX_GO 0x00001000 /* start/stop the processor */ 939a79811eSmacallan #define SX_JB 0x00002000 /* Jammed/Busy specifies the type of events */ 949a79811eSmacallan /* which increment the SX timer */ 959a79811eSmacallan #define SX_MT 0x00004000 /* instruction queue is empty */ 969a79811eSmacallan #define SX_BZ 0x00008000 /* Busy bit. When set it indicates that SX */ 979a79811eSmacallan /* is processing an instruction or an */ 989a79811eSmacallan /* instruction is pending in the Q */ 999a79811eSmacallan #define SX_B0MOD 0x00010000 /* When set by SX it indicates that a write */ 1009a79811eSmacallan /* to bank zero of the SX registers (0-31) */ 101cbf5c65aSandvar /* occurred */ 1029a79811eSmacallan #define SX_B1MOD 0x00020000 /* When set by SX it indicates that a write */ 1039a79811eSmacallan /* to bank 1 of the SX registers (32-63) */ 104cbf5c65aSandvar /* occurred */ 1059a79811eSmacallan #define SX_B2MOD 0x00040000 /* When set by SX it indicates that a write */ 1069a79811eSmacallan /* to bank 2 of the SX registers (64-95) */ 107cbf5c65aSandvar /* occurred */ 1089a79811eSmacallan #define SX_B3MOD 0x00080000 /* When set by SX it indicates that a write */ 1099a79811eSmacallan /* to bank 3 of the SX registers (96-127) */ 110cbf5c65aSandvar /* occurred */ 1113b60920aSmacallan 1123b60920aSmacallan /* SX_ERROR */ 1133b60920aSmacallan #define SX_SE1 0x00000001 /* illegal instruction */ 1143b60920aSmacallan #define SX_SE2 0x00000002 /* page bound error */ 1153b60920aSmacallan #define SX_SE3 0x00000004 /* illegal memory access */ 1163b60920aSmacallan #define SX_SE4 0x00000008 /* illegal register access */ 1173b60920aSmacallan #define SX_SE5 0x00000010 /* alignment violation */ 1183b60920aSmacallan #define SX_SE6 0x00000020 /* illegal instruction queue write */ 1193b60920aSmacallan #define SX_SI 0x00000080 /* interrupt on error */ 1203b60920aSmacallan 1219a79811eSmacallan /* SX_ID from the manual */ 1229a79811eSmacallan #if 0 1233b60920aSmacallan #define SX_ARCHITECTURE_MASK 0x000000ff 1243b60920aSmacallan #define SX_CHIP_REVISION 0x0000ff00 1259a79811eSmacallan #endif 1269a79811eSmacallan 1279a79811eSmacallan #define SX_ARCHITECTURE_MASK 0x00000003 1289a79811eSmacallan #define SX_CHIP_REVISION 0x000000f8 1293b60920aSmacallan 1303b60920aSmacallan /* SX_DIAGNOSTICS */ 1313b60920aSmacallan #define SX_IQ_FIFO_ACCESS 0x00000001 /* allow memory instructions 1323b60920aSmacallan * in SX_INSTRUCTIONS */ 1339a79811eSmacallan #define SX_SERIAL_INSTRUCTIONS 0x00000002 /* force inst. serializing */ 1349a79811eSmacallan #define SX_RAM_PAGE_CROSS 0x00000004 /* indicates page crossing */ 1359a79811eSmacallan #define SX_ARRAY_CONSTRAINING 0x00000008 /* When set constrains VRAM */ 1369a79811eSmacallan /* array offset effective */ 1379a79811eSmacallan /* address calculation */ 1389a79811eSmacallan #define SX_UPG_MPG_DISABLE 0x00000010 /* When set, disables page */ 1399a79811eSmacallan /* cross input into ld/st */ 1409a79811eSmacallan /* state machines */ 1419a79811eSmacallan #define SX_DIAG_INIT 0x4804 /* Setting of the diag reg */ 1429a79811eSmacallan /* upon reset */ 1439a79811eSmacallan 1443b60920aSmacallan 1453b60920aSmacallan /* 1463b60920aSmacallan * memory referencing instructions are written to 0x800000000 + PA 1473b60920aSmacallan * so we have to go through ASI 0x28 ( ASI_BYPASS + 8 ) 1483b60920aSmacallan */ 1493b60920aSmacallan #define ASI_SX 0x28 1503b60920aSmacallan 1513b60920aSmacallan /* load / store instructions */ 1523b60920aSmacallan #define SX_STORE_COND (0x4 << 19) /* conditional write with mask */ 1533b60920aSmacallan #define SX_STORE_CLAMP (0x2 << 19) 1543b60920aSmacallan #define SX_STORE_MASK (0x1 << 19) /* apply plane mask */ 155d211f15bSmacallan #define SX_STORE_SELECT (0x8 << 19) /* expand with plane reg dest[0]/dest[1] */ 1563b60920aSmacallan #define SX_LOAD (0xa << 19) 1573b60920aSmacallan #define SX_STORE (0x0 << 19) 1583b60920aSmacallan 1593b60920aSmacallan /* data type */ 1603b60920aSmacallan #define SX_UBYTE_0 (0x00 << 14) 1613b60920aSmacallan #define SX_UBYTE_8 (0x01 << 14) 1623b60920aSmacallan #define SX_UBYTE_16 (0x02 << 14) 1633b60920aSmacallan #define SX_UBYTE_24 (0x03 << 14) 1643b60920aSmacallan #define SX_SBYTE_0 (0x04 << 14) 1653b60920aSmacallan #define SX_SBYTE_8 (0x05 << 14) 1663b60920aSmacallan #define SX_SBYTE_16 (0x06 << 14) 1673b60920aSmacallan #define SX_SBYTE_24 (0x07 << 14) 1683b60920aSmacallan #define SX_UQUAD_0 (0x08 << 14) 1693b60920aSmacallan #define SX_UQUAD_8 (0x09 << 14) 1703b60920aSmacallan #define SX_UQUAD_16 (0x0a << 14) 1713b60920aSmacallan #define SX_UQUAD_24 (0x0b << 14) 1723b60920aSmacallan #define SX_SQUAD_0 (0x0c << 14) 1733b60920aSmacallan #define SX_SQUAD_8 (0x0d << 14) 1743b60920aSmacallan #define SX_SQUAD_16 (0x0e << 14) 1753b60920aSmacallan #define SX_SQUAD_24 (0x0f << 14) 1763b60920aSmacallan #define SX_UCHAN_0 (0x10 << 14) 1773b60920aSmacallan #define SX_UCHAN_8 (0x11 << 14) 1783b60920aSmacallan #define SX_UCHAN_16 (0x12 << 14) 1793b60920aSmacallan #define SX_UCHAN_24 (0x13 << 14) 1803b60920aSmacallan #define SX_SCHAN_0 (0x14 << 14) 1813b60920aSmacallan #define SX_SCHAN_8 (0x15 << 14) 1823b60920aSmacallan #define SX_SCHAN_16 (0x16 << 14) 1833b60920aSmacallan #define SX_SCHAN_24 (0x17 << 14) 1843b60920aSmacallan #define SX_USHORT_0 (0x18 << 14) 1853b60920aSmacallan #define SX_USHORT_8 (0x19 << 14) 1863b60920aSmacallan #define SX_USHORT_16 (0x1a << 14) 1873b60920aSmacallan #define SX_SSHORT_0 (0x1c << 14) 1883b60920aSmacallan #define SX_SSHORT_8 (0x1d << 14) 1893b60920aSmacallan #define SX_SSHORT_16 (0x1e << 14) 1903b60920aSmacallan #define SX_LONG (0x1b << 14) 1913b60920aSmacallan #define SX_PACKED (0x1f << 14) 1923b60920aSmacallan 1933b60920aSmacallan 194d211f15bSmacallan #define SX_LD(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \ 195d211f15bSmacallan SX_LONG | (dreg << 7) | (o)) 196d211f15bSmacallan #define SX_LDB(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \ 197d211f15bSmacallan SX_UBYTE_0 | (dreg << 7) | (o)) 198*bc92ec78Smacallan #define SX_LDW(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \ 199*bc92ec78Smacallan SX_USHORT_0 | (dreg << 7) | (o)) 200d211f15bSmacallan #define SX_LDP(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \ 201d211f15bSmacallan SX_PACKED | (dreg << 7) | (o)) 20274a80711Smacallan #define SX_LDUQ0(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \ 20374a80711Smacallan SX_UQUAD_0 | (dreg << 7) | (o)) 20474a80711Smacallan #define SX_LDUQ8(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \ 20574a80711Smacallan SX_UQUAD_8 | (dreg << 7) | (o)) 20674a80711Smacallan #define SX_LDUQ16(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \ 20774a80711Smacallan SX_UQUAD_16 | (dreg << 7) | (o)) 20874a80711Smacallan #define SX_LDUQ24(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \ 20974a80711Smacallan SX_UQUAD_24 | (dreg << 7) | (o)) 2105738d835Smacallan #define SX_LDUC0(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \ 2115738d835Smacallan SX_UCHAN_0 | (dreg << 7) | (o)) 2125738d835Smacallan #define SX_LDUC8(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \ 2135738d835Smacallan SX_UCHAN_8 | (dreg << 7) | (o)) 2145738d835Smacallan #define SX_LDUC16(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \ 2155738d835Smacallan SX_UCHAN_16 | (dreg << 7) | (o)) 2165738d835Smacallan #define SX_LDUC24(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \ 2175738d835Smacallan SX_UCHAN_24 | (dreg << 7) | (o)) 218d211f15bSmacallan #define SX_ST(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \ 219d211f15bSmacallan SX_LONG | (sreg << 7) | (o)) 220cfaf702bSmacallan #define SX_STM(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_MASK | \ 221cfaf702bSmacallan SX_LONG | (sreg << 7) | (o)) 222d211f15bSmacallan #define SX_STB(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \ 223d211f15bSmacallan SX_UBYTE_0 | (sreg << 7) | (o)) 2244b66d9e2Smacallan #define SX_STBM(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_MASK | \ 2254b66d9e2Smacallan SX_UBYTE_0 | (sreg << 7) | (o)) 22694cfee89Smacallan #define SX_STBC(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_CLAMP | \ 22794cfee89Smacallan SX_UBYTE_0 | (sreg << 7) | (o)) 228*bc92ec78Smacallan #define SX_STW(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \ 229*bc92ec78Smacallan SX_USHORT_0 | (sreg << 7) | (o)) 230d211f15bSmacallan #define SX_STP(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \ 231d211f15bSmacallan SX_PACKED | (sreg << 7) | (o)) 232d6922aa9Smacallan #define SX_STPS(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_SELECT | \ 233d6922aa9Smacallan SX_PACKED | (sreg << 7) | (o)) 234d211f15bSmacallan #define SX_STS(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_SELECT \ 235d211f15bSmacallan | SX_LONG | (sreg << 7) | (o)) 236d211f15bSmacallan #define SX_STBS(reg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_SELECT \ 237d211f15bSmacallan | SX_UBYTE_0 | (reg << 7) | (o)) 23874a80711Smacallan #define SX_STUQ0(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \ 23974a80711Smacallan SX_UQUAD_0 | (sreg << 7) | (o)) 24094cfee89Smacallan #define SX_STUQ0C(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_CLAMP | \ 24194cfee89Smacallan SX_UQUAD_0 | (sreg << 7) | (o)) 24274a80711Smacallan #define SX_STUQ8(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \ 24374a80711Smacallan SX_UQUAD_8 | (sreg << 7) | (o)) 24474a80711Smacallan #define SX_STUQ16(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \ 24574a80711Smacallan SX_UQUAD_16 | (sreg << 7) | (o)) 24674a80711Smacallan #define SX_STUQ24(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \ 24774a80711Smacallan SX_UQUAD_24 | (sreg << 7) | (o)) 2485738d835Smacallan #define SX_STUC0(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \ 2495738d835Smacallan SX_UCHAN_0 | (sreg << 7) | (o)) 2505738d835Smacallan #define SX_STUC0C(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_CLAMP | \ 2515738d835Smacallan SX_UCHAN_0 | (sreg << 7) | (o)) 2525738d835Smacallan #define SX_STUC8(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \ 2535738d835Smacallan SX_UCHAN_8 | (sreg << 7) | (o)) 2545738d835Smacallan #define SX_STUC16(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \ 2555738d835Smacallan SX_UCHAN_16 | (sreg << 7) | (o)) 2565738d835Smacallan #define SX_STUC24(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \ 2575738d835Smacallan SX_UCHAN_24 | (sreg << 7) | (o)) 2583b60920aSmacallan 25974a80711Smacallan /* ROP and SELECT instructions */ 260ab9f2444Smacallan #define SX_ROP_B (0x0 << 21) /* mask bits apply to bytes */ 261ab9f2444Smacallan #define SX_ROP_M (0x1 << 21) /* mask bits apply to each bit */ 262ab9f2444Smacallan #define SX_ROP_L (0x2 << 21) /* mask bits apply per register */ 263ab9f2444Smacallan #define SX_SEL_B (0x4 << 21) /* byte select scalar */ 264ab9f2444Smacallan #define SX_SEL_V (0x6 << 21) /* register select vector */ 265ab9f2444Smacallan #define SX_SEL_S (0x7 << 21) /* register select scalar */ 266328b697bSmacallan 267ab9f2444Smacallan #define SX_ROP(sa, sb, d, cnt) (0x90000000 | ((cnt) << 24) | SX_ROP_L | \ 268328b697bSmacallan ((sa) << 14) | (sb) | ((d) << 7)) 269ab9f2444Smacallan #define SX_ROPB(sa, sb, d, cnt) (0x90000000 | ((cnt) << 24) | SX_ROP_B | \ 27014208555Smacallan ((sa) << 14) | (sb) | ((d) << 7)) 271ab9f2444Smacallan #define SX_SELECT_S(sa, sb, d, cnt) (0x90000000 | ((cnt) << 24) | SX_SEL_S | \ 272d9d04577Smacallan ((sa) << 14) | (sb) | ((d) << 7)) 27374a80711Smacallan 27474a80711Smacallan /* multiply group */ 27574a80711Smacallan #define SX_M16X16SR0 (0x0 << 28) /* 16bit multiply, no shift */ 27674a80711Smacallan #define SX_M16X16SR8 (0x1 << 28) /* 16bit multiply, shift right 8 */ 27774a80711Smacallan #define SX_M16X16SR16 (0x2 << 28) /* 16bit multiply, shift right 16 */ 27874a80711Smacallan #define SX_M32X16SR0 (0x4 << 28) /* 32x16bit multiply, no shift */ 27974a80711Smacallan #define SX_M32X16SR8 (0x5 << 28) /* 32x16bit multiply, shift right 8 */ 28074a80711Smacallan #define SX_M32X16SR16 (0x6 << 28) /* 32x16bit multiply, shift right 16 */ 28174a80711Smacallan 28274a80711Smacallan #define SX_MULTIPLY (0x0 << 21) /* normal multiplication */ 28374a80711Smacallan #define SX_DOT (0x1 << 21) /* dot product of A and B */ 28474a80711Smacallan #define SX_SAXP (0x2 << 21) /* A * SCAM + B */ 28574a80711Smacallan 28674a80711Smacallan #define SX_ROUND (0x1 << 23) /* round results */ 28774a80711Smacallan 28874a80711Smacallan #define SX_MUL16X16(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt) << 24) | \ 289b2dfd674Smacallan SX_MULTIPLY | ((sa) << 14) | ((d) << 7) | (sb)) 29074a80711Smacallan #define SX_MUL16X16R(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt) << 24) | \ 291b2dfd674Smacallan SX_MULTIPLY | ((sa) << 14) | ((d) << 7) | (sb) | SX_ROUND) 29274a80711Smacallan #define SX_MUL16X16SR8(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt) << 24) | \ 293b2dfd674Smacallan SX_MULTIPLY | ((sa) << 14) | ((d) << 7) | (sb)) 29474a80711Smacallan #define SX_MUL16X16SR8R(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt) << 24) | \ 295b2dfd674Smacallan SX_MULTIPLY | ((sa) << 14) | ((d) << 7) | (sb) | SX_ROUND) 29674a80711Smacallan 29774a80711Smacallan #define SX_SAXP16X16(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt) << 24) | \ 298b2dfd674Smacallan SX_SAXP | ((sa) << 14) | ((d) << 7) | (sb)) 29974a80711Smacallan #define SX_SAXP16X16R(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt) << 24) | \ 300b2dfd674Smacallan SX_SAXP | ((sa) << 14) | ((d) << 7) | (sb) | SX_ROUND) 30174a80711Smacallan #define SX_SAXP16X16SR8(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt) << 24) | \ 302b2dfd674Smacallan SX_SAXP | ((sa) << 14) | ((d) << 7) | (sb)) 30374a80711Smacallan #define SX_SAXP16X16SR8R(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt) << 24) | \ 304b2dfd674Smacallan SX_SAXP | ((sa) << 14) | ((d) << 7) | (sb) | SX_ROUND) 30574a80711Smacallan 30674a80711Smacallan /* logic group */ 30774a80711Smacallan #define SX_AND_V (0x0 << 21) /* vector AND vector */ 30874a80711Smacallan #define SX_AND_S (0x1 << 21) /* vector AND scalar */ 30974a80711Smacallan #define SX_AND_I (0x2 << 21) /* vector AND immediate */ 31074a80711Smacallan #define SX_XOR_V (0x3 << 21) /* vector XOR vector */ 31174a80711Smacallan #define SX_XOR_S (0x4 << 21) /* vector XOR scalar */ 31274a80711Smacallan #define SX_XOR_I (0x5 << 21) /* vector XOR immediate */ 31374a80711Smacallan #define SX_OR_V (0x6 << 21) /* vector OR vector */ 31474a80711Smacallan #define SX_OR_S (0x7 << 21) /* vector OR scalar */ 31574a80711Smacallan /* immediates are 7bit sign extended to 32bit */ 31674a80711Smacallan 31774a80711Smacallan #define SX_ANDV(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_AND_V | \ 318b2dfd674Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 31974a80711Smacallan #define SX_ANDS(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_AND_S | \ 320b2dfd674Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 32174a80711Smacallan #define SX_ANDI(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_AND_I | \ 322b2dfd674Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 32374a80711Smacallan #define SX_XORV(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_XOR_V | \ 324b2dfd674Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 32574a80711Smacallan #define SX_XORS(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_XOR_S | \ 326b2dfd674Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 32774a80711Smacallan #define SX_XORI(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_XOR_I | \ 328b2dfd674Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 32974a80711Smacallan #define SX_ORV(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_OR_V | \ 330b2dfd674Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 33174a80711Smacallan #define SX_ORS(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_OR_S | \ 332b2dfd674Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 333b2dfd674Smacallan 334b2dfd674Smacallan /* arithmetic group */ 3353a5f3d03Smacallan #define SX_ADD_V (0x00 << 21) /* vector + vector */ 3363a5f3d03Smacallan #define SX_ADD_S (0x01 << 21) /* vector + scalar */ 3373a5f3d03Smacallan #define SX_ADD_I (0x02 << 21) /* vector + immediate */ 3383a5f3d03Smacallan #define SX_SUM (0x03 << 21) /* sum of vector and scalar */ 339263f0a1bSmacallan #define SX_SUB_V (0x04 << 21) /* vector - vector */ 3403a5f3d03Smacallan #define SX_SUB_S (0x05 << 21) /* vector - scalar */ 3413a5f3d03Smacallan #define SX_SUB_I (0x06 << 21) /* vector - immediate */ 3423a5f3d03Smacallan #define SX_ABS (0x07 << 21) /* abs(sb) with sa=R0 */ 3433a5f3d03Smacallan /* hardware does sa - sb for sb < 0 and sa + sb if sb > 0 */ 344b2dfd674Smacallan 345b2dfd674Smacallan #define SX_ADDV(sa, sb, d, cnt) (0xa0000000 | ((cnt) << 24) | SX_ADD_V | \ 346b2dfd674Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 34774a80711Smacallan 348abd9e70dSmacallan /* MISC group */ 349abd9e70dSmacallan #define SX_GTHR (3 << 21) /* sa with spacing sb -> d */ 350abd9e70dSmacallan #define SX_SCTR (2 << 21) /* sa -> d with spacing sb */ 351f6a791a3Smacallan #define SX_GATHER(sa, sb, d, cnt) (0xe0000000 | ((cnt) << 24) | SX_GTHR | \ 352f6a791a3Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 353f6a791a3Smacallan #define SX_SCATTER(sa, sb, d, cnt) (0xe0000000 | ((cnt) << 24) | SX_SCTR | \ 354f6a791a3Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 355abd9e70dSmacallan 356d6922aa9Smacallan /* shift group */ 357ab9f2444Smacallan #define SX_SRL_V (0 << 21) /* shift right logical, by vector */ 358ab9f2444Smacallan #define SX_SRL_I (1 << 21) /* shift right logical, by immediate */ 359ab9f2444Smacallan #define SX_SRA_V (2 << 21) /* shift right arithmetic, by vector */ 360ab9f2444Smacallan #define SX_SRA_I (3 << 21) /* shift right arithmetic, by immediate */ 361ab9f2444Smacallan #define SX_SLL_V (4 << 21) /* shift left logical, by vector */ 362ab9f2444Smacallan #define SX_SLL_I (5 << 21) /* shift left logical, by immediate */ 363ab9f2444Smacallan #define SX_SLF_S (6 << 21) /* shift left funnel, by SRCB */ 364ab9f2444Smacallan #define SX_SLF_I (7 << 21) /* shift left funnel, by immediate */ 365d6922aa9Smacallan 366ab9f2444Smacallan #define SX_SRLV(sa, sb, d, cnt) (0xc0000000 | ((cnt) << 24) | SX_SRL_V | \ 367d6922aa9Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 368ab9f2444Smacallan #define SX_SRLI(sa, sb, d, cnt) (0xc0000000 | ((cnt) << 24) | SX_SRL_I | \ 369d6922aa9Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 370ab9f2444Smacallan #define SX_SRAV(sa, sb, d, cnt) (0xc0000000 | ((cnt) << 24) | SX_SRA_V | \ 371d6922aa9Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 372ab9f2444Smacallan #define SX_SRAI(sa, sb, d, cnt) (0xc0000000 | ((cnt) << 24) | SX_SRA_I | \ 373d6922aa9Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 374ab9f2444Smacallan #define SX_SLLV(sa, sb, d, cnt) (0xc0000000 | ((cnt) << 24) | SX_SLL_V | \ 375d6922aa9Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 376ab9f2444Smacallan #define SX_SLLI(sa, sb, d, cnt) (0xc0000000 | ((cnt) << 24) | SX_SLL_I | \ 377d6922aa9Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 378ab9f2444Smacallan #define SX_FUNNEL_S(sa, sb, d, cnt) (0xc0000000 | ((cnt) << 24) | SX_SLF_S | \ 379d6922aa9Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 380ab9f2444Smacallan #define SX_FUNNEL_I(sa, sb, d, cnt) (0xc0000000 | ((cnt) << 24) | SX_SLF_I | \ 381d6922aa9Smacallan ((sa) << 14) | ((d) << 7) | (sb)) 382d6922aa9Smacallan 3833b60920aSmacallan #endif /* SXREG_H */ 384