utils.c
1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/************************************************************************
WHAT: RSP DUAL-ISSUE VERIFICATION TEST PROGRAM GENERATOR
SCCS: @(#)utils.c 1.2 21 Sep 1994
PTLS: $Id: utils.c,v 1.1.1.1 2002/10/29 08:07:06 blythe Exp $
ENGR: Project Reality - Evan Y. Wang
(CR): 1994 Silicon Graphics, Inc.
************************************************************************/
#include <stdio.h>
#include "software.h"
#include "digen.h"
void fpCOMMENT(of,str)
FILE *of;
char *str;
{
static char *stars = "************************************************";
fprintf(of,"\n\t/%s\n\t %s\n\t %s/\n\n", stars, str, stars);
}
void fpVADD(of,vd,v1,v2)
FILE *of;
int vd, v1, v2;
{
int i;
fprintf(of,"\tvadd\t$v%d, $v%d, $v%d\n",vd,v1,v2);
for (i=0; i<8; i++) {
*(&VReg[vd][0].u.h.hw+i) = *(&VReg[v1][0].u.h.hw+i)
+ *(&VReg[v2][0].u.h.hw+i) + ((VCR[VCO]>>i)&1);
if (*(&VReg[vd][0].u.h.hw+i) > 0x7FFF)
*(&VReg[vd][0].u.h.hw+i) = 0x7FFF;
}
VCR[VCO] = 0;
IP++;
} /* fpvadd */
void fpVADDC(of,vd,v1,v2)
FILE *of;
int vd, v1, v2;
{
int i;
u32 tmp;
fprintf(of,"\tvaddc\t$v%d, $v%d, $v%d\n",vd,v1,v2);
VCR[VCO] = 0;
for (i=0; i<8; i++) {
tmp = *(&VReg[v1][0].u.h.hw+i) + *(&VReg[v2][0].u.h.hw+i);
*(&VReg[vd][0].u.h.hw+i) = tmp & 0xFFFF;
VCR[VCO] |= (tmp&0x10000) >> (16-i);
}
IP++;
} /* fpvadd */
void fpVEQ(of,vd,v1,v2)
FILE *of;
int vd, v1, v2;
{
int i, cond;
fprintf(of,"\tveq\t$v%d, $v%d, $v%d\n",vd,v1,v2);
for (i=0; i<8; i++) {
VCR[VCC] |= ((*(&VReg[v1][0].u.h.hw+i) == *(&VReg[v2][0].u.h.hw+i))
&& !((VCR[VCO]>>(8+i))&1)) << i;
}
VReg[vd][0].w = VReg[v2][0].w;
VReg[vd][1].w = VReg[v2][1].w;
VReg[vd][2].w = VReg[v2][2].w;
VReg[vd][3].w = VReg[v2][3].w;
VCR[VCO] = 0;
IP++;
} /* fpVEQ */