Add test for cmpeqb
[soc.git] / src / soc / decoder / isa / comparefixed.patch
1 --- comparefixed.py.orig 2020-05-15 10:02:00.087668937 -0400
2 +++ comparefixed.py 2020-05-15 12:32:36.834556205 -0400
3 @@ -21,7 +21,7 @@
4 c = SelectableInt(value=0x2, bits=3)
5 else:
6 c = SelectableInt(value=0x1, bits=3)
7 - CR[4 * BF + 32:4 * BF + 35 + 1] = concat(c, XER[SO])
8 + CR.si[4 * BF + 32:4 * BF + 35 + 1] = concat(c, XER[SO])
9 return (CR,)
10
11 @inject()
12 @@ -38,7 +38,7 @@
13 c = SelectableInt(value=0x2, bits=3)
14 else:
15 c = SelectableInt(value=0x1, bits=3)
16 - CR[4 * BF + 32:4 * BF + 35 + 1] = concat(c, XER[SO])
17 + CR.si[4 * BF + 32:4 * BF + 35 + 1] = concat(c, XER[SO])
18 return (CR,)
19
20 @inject()
21 @@ -53,7 +53,7 @@
22 c = SelectableInt(value=0x2, bits=3)
23 else:
24 c = SelectableInt(value=0x1, bits=3)
25 - CR[4 * BF + 32:4 * BF + 35 + 1] = concat(c, XER[SO])
26 + CR.si[4 * BF + 32:4 * BF + 35 + 1] = concat(c, XER[SO])
27 return (CR,)
28
29 @inject()
30 @@ -70,7 +70,7 @@
31 c = SelectableInt(value=0x2, bits=3)
32 else:
33 c = SelectableInt(value=0x1, bits=3)
34 - CR[4 * BF + 32:4 * BF + 35 + 1] = concat(c, XER[SO])
35 + CR.si[4 * BF + 32:4 * BF + 35 + 1] = concat(c, XER[SO])
36 return (CR,)
37
38 @inject()
39 @@ -85,23 +85,22 @@
40 else:
41 in_range = le(src21lo, src1) & le(src1, src21hi) | le(src22lo, src1) & le(
42 src1, src22hi)
43 - CR[4 * BF + 32] = SelectableInt(value=0x0, bits=1)
44 - CR[4 * BF + 33] = in_range
45 - CR[4 * BF + 34] = SelectableInt(value=0x0, bits=1)
46 - CR[4 * BF + 35] = SelectableInt(value=0x0, bits=1)
47 + CR.si[4 * BF + 32] = SelectableInt(value=0x0, bits=1)
48 + CR.si[4 * BF + 33] = in_range
49 + CR.si[4 * BF + 34] = SelectableInt(value=0x0, bits=1)
50 + CR.si[4 * BF + 35] = SelectableInt(value=0x0, bits=1)
51 return (CR,)
52
53 @inject()
54 - def op_cmpeqb(self, RB, CR):
55 - src1 = GPR[RA]
56 - src1 = src1[56:64]
57 + def op_cmpeqb(self, RA, RB, CR):
58 + src1 = RA[56:64]
59 match = eq(src1, RB[0:8]) | eq(src1, RB[8:16]) | eq(src1, RB[16:24]) | eq(src1,
60 RB[24:32]) | eq(src1, RB[32:40]) | eq(src1, RB[40:48]) | eq(src1, RB[48:56]
61 ) | eq(src1, RB[56:64])
62 - CR[4 * BF + 32] = SelectableInt(value=0x0, bits=1)
63 - CR[4 * BF + 33] = match
64 - CR[4 * BF + 34] = SelectableInt(value=0x0, bits=1)
65 - CR[4 * BF + 35] = SelectableInt(value=0x0, bits=1)
66 + CR.si[4 * BF + 32] = SelectableInt(value=0x0, bits=1)
67 + CR.si[4 * BF + 33] = match
68 + CR.si[4 * BF + 34] = SelectableInt(value=0x0, bits=1)
69 + CR.si[4 * BF + 35] = SelectableInt(value=0x0, bits=1)
70 return (CR,)
71
72 comparefixed_instrs = {}
73 @@ -136,7 +135,7 @@
74 form='X',
75 asmregs=[['BF', 'L', 'RA', 'RB']])
76 comparefixed_instrs['cmpeqb'] = instruction_info(func=op_cmpeqb,
77 - read_regs=OrderedSet(['RB']),
78 + read_regs=OrderedSet(['RA', 'RB']),
79 uninit_regs=OrderedSet(), write_regs=OrderedSet(['CR']),
80 special_regs=OrderedSet(['CR']), op_fields=OrderedSet(['BF']),
81 form='X',