swar.h 1.66 KB
/* -----------------------------------------------------------------------------
 *  Copyright (C) 2019 daiteq s.r.o.                     http://www.daiteq.com
 *
 *  This program is distributed WITHOUT ANY WARRANTY; without even
 *  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 *  PURPOSE.
 *
 * -----------------------------------------------------------------------------
 *  Filename    : swar.h
 *  Authors     : Martin Danek
 *  Description : configuration of SWAR instructions
 *  Release     :
 *  Version     : 1.0
 *  Date        : 9.4.2019
 * -----------------------------------------------------------------------------
 */
#ifndef SWAR_H

#define SWAR_H

// SWAR configuration register definitions
#define SW_OP_ADD    0x0
#define SW_OP_SUB    0x8
#define SW_OP_MUL    0xc
//
#define SW_OP_COR1b  0x4
#define SW_OP_COR2b  0x5
#define SW_OP_COR3b  0x6
#define SW_OP_COR4b  0x7
//
#define SW_OP_DEMR2b  0x9
#define SW_OP_DEMR3b  0xa
#define SW_OP_DEMR4b  0xb
//
#define SW_OP_DEMC2b  0xd
#define SW_OP_DEMC3b  0xe
#define SW_OP_DEMC4b  0xf
//
#define SW_OP_DEMC2bG 0x1
#define SW_OP_DEMC3bG 0x2
#define SW_OP_DEMC4bG 0x3
//
#define SW_OP_SC1b    0x10
#define SW_OP_SC2b    0x20
#define SW_OP_SC3b    0x30
#define SW_OP_SC4b    0x40
//
#define SW_SGND       0x100
#define SW_RED        0x200
#define SW_SAT        0x400
#define SW_NORM       0x800
//
#define SW_AUDIO      0x1000
#define SW_VIDEO      0x2000
#define SW_ALU        0x4000



void swar_config(unsigned config);
unsigned swar_readconfig(void);
void swar_selacc(unsigned accid);
int swar_readacc(void);
unsigned exec_swar(unsigned a, unsigned b);
unsigned exec_swarcc(unsigned a, unsigned b);

#endif