在进行GMPY4指令的时候,该指令受到两个参数的影响,一个是多项式,另一个是galois field。我想问一下,在具体指令执行的时候哪一个优先级高?还是同时作用?,另外galois field的格式是什么?例子中给出了galois field为256时的情况,我想问一下在这种情况下对应的寄存器里面是什么情况?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
galois field 不是一个参数
参数有两个,多项式和多项式的size,配置在GFPGFR寄存器
GMPY4的功能如下:
typedef struct _INT32X4U
{
uint8 lo1;
uint8 lo2;
uint8 hi1;
uint8 hi2;
} int32x4u;
union reg32
{
int32 x1;
int32x4u x4u;
};
int32 _gmpy4(int32 a,int32 b)
{
uint16 k,m,mask;
int32 maxpower2;
uint32 poly,c,ytmp[4];
union reg32 a32,b32,y32;
a32.x1 = a;
b32.x1 = b;
m = (GFPGFR >> 24) + 1;
poly = (GFPGFR & 0xFF) | 0x100;
mask = 1;
/* zero out the tmp array */
for(k=0;k<4;k++)
ytmp[k] = 0;
/* multiply the four sets of polynomials together */
for(k=0;k<8;k++)
{
c = mask&a32.x4u.hi2;
ytmp[3] ^= b32.x4u.hi2*c;
c = mask&a32.x4u.hi1;
ytmp[2] ^= b32.x4u.hi1*c;
c = mask&a32.x4u.lo2;
ytmp[1] ^= b32.x4u.lo2*c;
c = mask&a32.x4u.lo1;
ytmp[0] ^= b32.x4u.lo1*c;
mask <<= 1;
}
/* divide each result by the generator polynomial */
for(k=0;k<4;k++)
{
maxpower2 = 30-_norm(ytmp[k]);
while(maxpower2 >= m)
{
c = poly << (maxpower2 - m);
ytmp[k] ^= c;
maxpower2 = 30-_norm(ytmp[k]);
}
}
y32.x4u.hi2 = (uint8)ytmp[3];
y32.x4u.hi1 = (uint8)ytmp[2];
y32.x4u.lo2 = (uint8)ytmp[1];
y32.x4u.lo1 = (uint8)ytmp[0];
return(y32.x1);
} /* end of _gmpy4() function */
GMPY4指令涉及到三个参数和1和寄存器:
参数分别是src1,src2,dst
寄存器是GFPGFR
其功能是将src1和src2看做4个单独的8bit byte来执行。
执行 dst = (src1.byten * src2.byten)% GFPGFR.poly
备注:这里的乘和取余都是指伽罗华操作