br_w.c
1.49 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
/****************************************************************
WHAT: RSP TEST GENERATOR
SCCS: @(#)br_w.c 1.1 03 Aug 1994
FILE: br_w.c
WHO: Project Reality - Evan Y. Wang
(C): 1994 Silicon Graphics, Inc.
****************************************************************/
#include <stdio.h>
#include "software.h"
#include "gen.h"
#include "suregre.h"
#define MAX_TCS MAX_BR_W_TCS
#define GenCase(tmpl) \
fprintf(outp,tmpl,CurTcNo,ip->name,rA,HHW(OpA),LHW(OpA),rT);
/* Macro for condition true */
PRIVATE char *TemplT =
/* ChkBrWT( n,Op, rA, OpAH, OpAL, rT); */
"\tChkBrWT(%2d,%s,r%-2d,0x%4.4X,0x%4.4X,r%-2d)\n";
/* Macro for condition false */
PRIVATE char *TemplF =
/* ChkBrWF( n,Op, rA, OpAH, OpAL, rT); */
"\tChkBrWF(%2d,%s,r%-2d,0x%4.4X,0x%4.4X,r%-2d)\n";
int BrWGen(outp, ip)
FILE *outp;
I_TABLE *ip;
{
int i = 0;
FILE_SPLIT {
/* Generate initial case - operand is zero */
if (ip->proc(OpA)) { GenCase(TemplT); }
else { GenCase(TemplF); }
}
CurTcNo++;
/* Generate remaining cases */
i = 0;
do {
/* generate next input vector */
if (OpA & 0x80000000) {
OpA = (OpA << 1) | 0x80000001;
} else {
OpA = 1 << i;
}
FILE_SPLIT {
/* based on predicted result, use correct template */
if (ip->proc(OpA)) { GenCase(TemplT); }
else { GenCase(TemplF); }
}
/* use a different register */
UpdRegID();
} while (CurTcNo++, i++, OpA != 0xFFFFFFFF);
return CurTcNo = 0;
} /* BrWGen */