-
Notifications
You must be signed in to change notification settings - Fork 2
/
XCoreVMac.core_desc
188 lines (179 loc) · 8.54 KB
/
XCoreVMac.core_desc
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
import "../rv_base/RISCVBase.core_desc"
InstructionSet XCoreVMac extends RISCVBase {
instructions {
// 32-Bit x 32-Bit Multiplication Operations (Signed)
CV_MAC {
encoding: 7'b1001000 :: rs2[4:0] :: rs1[4:0] :: 3'b011 :: rd[4:0] :: 7'b0101011;
assembly: {"cv.mac", "{name(rd)}, {name(rs1)}, {name(rs2)}"};
behavior: {
signed<65> result = (signed)X[rs1] * (signed)X[rs2] + (signed)X[rd];
// signed<64> result = (signed)X[rs1] * (signed)X[rs2] + (signed)X[rd];
// if(rd != 0) X[rd] = result[31:0];
if(rd != 0) X[rd] = (unsigned<32>)result;
}
}
CV_MSU {
encoding: 7'b1001001 :: rs2[4:0] :: rs1[4:0] :: 3'b011 :: rd[4:0] :: 7'b0101011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}";
behavior: {
// signed<65> result = (signed)X[rd] - (signed)X[rs1] * (signed)X[rs2] ;
signed<64> result = (signed)X[rd] - (signed)X[rs1] * (signed)X[rs2] ;
if(rd != 0) X[rd] = result[31:0];
}
}
// 16-Bit x 16-Bit Multiplication
CV_MULUN {
encoding: 2'b00 :: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b101 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
unsigned<32> result = ((unsigned)X[rs1][15:0] * (unsigned)X[rs2][15:0]) >> Is3;
if(rd != 0) X[rd] = result[31:0];
}
}
CV_MULHHUN {
encoding: 2'b01 :: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b101 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
unsigned<32> result = ((unsigned)X[rs1][31:16] * (unsigned)X[rs2][31:16]) >> Is3;
if(rd != 0) X[rd] = result[31:0];
}
}
CV_MULSN {
encoding: 2'b00 :: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b100 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
signed<32> result = ((signed)X[rs1][15:0] * (signed)X[rs2][15:0]) >> Is3;
if(rd != 0) X[rd] = result[31:0];
}
}
CV_MULHHSN {
encoding: 2'b01 :: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b100 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
signed<32> result = ((signed)X[rs1][31:16] * (signed)X[rs2][31:16]) >> Is3;
if(rd != 0) X[rd] = result[31:0];
}
}
CV_MULURN {
encoding: 2'b10:: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b101 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
signed<31> product = (unsigned)X[rs1][15:0] * (unsigned)X[rs2][15:0];
unsigned<30> powerOf2 = 1 << (Is3-1); // TODO: Is3 = max(Is3, 1)
unsigned<32> sum = product + powerOf2;
unsigned<32> rounded = sum >> Is3;
X[rd] = rounded[31:0];
}
}
CV_MULHHURN {
encoding: 2'b11:: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b101 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
signed<31> product = (unsigned)X[rs1][31:16] * (unsigned)X[rs2][31:16];
unsigned<30> powerOf2 = 1 << (Is3-1); // TODO: Is3 = max(Is3, 1)
unsigned<32> sum = product + powerOf2;
unsigned<32> rounded = sum >> Is3;
X[rd] = rounded[31:0];
}
}
CV_MULSRN {
encoding: 2'b10:: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b100 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
signed<31> product = (signed)X[rs1][15:0] * (signed)X[rs2][15:0];
unsigned<30> powerOf2 = 1 << (Is3-1); // TODO: Is3 = max(Is3, 1)
signed<32> sum = product + powerOf2;
signed<32> rounded = sum >> Is3;
X[rd] = rounded[31:0];
}
}
CV_MULHHSRN {
encoding: 2'b11:: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b100 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
signed<31> product = (signed)X[rs1][31:16] * (signed)X[rs2][31:16];
unsigned<30> powerOf2 = 1 << (Is3-1); // TODO: Is3 = max(Is3, 1)
signed<32> sum = product + powerOf2;
signed<32> rounded = sum >> Is3;
X[rd] = rounded[31:0];
}
}
// 16-Bit x 16-Bit Multiply-Accumulate
CV_MACUN {
encoding: 2'b00 :: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b111 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
unsigned<32> result = ((unsigned)X[rs1][15:0] * (unsigned)X[rs2][15:0] + (unsigned)X[rd]) >> Is3;
if(rd != 0) X[rd] = result[31:0];
}
}
CV_MACHHUN {
encoding: 2'b01 :: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b111 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
unsigned<32> result = ((unsigned)X[rs1][31:16] * (unsigned)X[rs2][31:16] + (unsigned)X[rd]) >> Is3;
if(rd != 0) X[rd] = result[31:0];
}
}
CV_MACSN {
encoding: 2'b10 :: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b001 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
signed<32> result = ((signed)X[rs1][15:0] * (signed)X[rs2][15:0] + (signed)X[rd]) >> Is3;
if(rd != 0) X[rd] = result[31:0];
}
}
CV_MACHHSN {
encoding: 2'b11 :: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b001 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
signed<32> result = ((signed)X[rs1][31:16] * (signed)X[rs2][31:16] + (signed)X[rd]) >> Is3;
if(rd != 0) X[rd] = result[31:0];
}
}
CV_MACURN {
encoding: 2'b10 :: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b110 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
unsigned<30> product = (unsigned)(X[rs1][15:0]) * (unsigned)(X[rs2][15:0]);
unsigned<30> powerOf2 = 1 << (Is3-1); // TODO: Is3 = max(Is3, 1)
unsigned<33> sum = product + (unsigned)X[rd] + powerOf2;
unsigned<33> rounded = sum >> Is3;
X[rd] = rounded[31:0];
}
}
CV_MACHHURN {
encoding: 2'b11 :: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b110 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
unsigned<30> product = (unsigned)(X[rs1][31:16]) * (unsigned)(X[rs2][31:16]);
unsigned<30> powerOf2 = 1 << (Is3-1); // TODO: Is3 = max(Is3, 1)
unsigned<33> sum = product + (unsigned)X[rd] + powerOf2;
unsigned<33> rounded = sum >> Is3;
X[rd] = rounded[31:0];
}
}
CV_MACSRN {
encoding: 2'b10 :: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b111 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
signed<31> product = (signed)X[rs1][15:0] * (signed)X[rs2][15:0];
unsigned<30> powerOf2 = 1 << (Is3-1); // TODO: Is3 = max(Is3, 1)
signed<32> sum = product + (signed)X[rd] + powerOf2;
signed<32> rounded = sum >> Is3;
X[rd] = rounded[31:0];
}
}
CV_MACHHSRN {
encoding: 2'b11 :: Is3[4:0] :: rs2[4:0] :: rs1[4:0] :: 3'b111 :: rd[4:0] :: 7'b1011011;
assembly:"{name(rd)}, {name(rs1)}, {name(rs2)}, {Is3}";
behavior: {
signed<31> product = (signed)X[rs1][31:16] * (signed)X[rs2][31:16];
unsigned<30> powerOf2 = 1 << (Is3-1); // TODO: Is3 = max(Is3, 1)
signed<32> sum = product + (signed)X[rd] + powerOf2;
signed<32> rounded = sum >> Is3;
X[rd] = rounded[31:0];
}
}
}
}