-
Notifications
You must be signed in to change notification settings - Fork 17
/
mul7u_0ED.c
230 lines (229 loc) · 7.95 KB
/
mul7u_0ED.c
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
/***
* This code is a part of EvoApproxLib library (ehw.fit.vutbr.cz/approxlib) distributed under The MIT License.
* When used, please cite the following article(s): V. Mrazek, S. S. Sarwar, L. Sekanina, Z. Vasicek and K. Roy, "Design of power-efficient approximate multipliers for approximate artificial neural networks," 2016 IEEE/ACM International Conference on Computer-Aided Design (ICCAD), Austin, TX, 2016, pp. 1-7. doi: 10.1145/2966986.2967021
* This file contains a circuit from a sub-set of pareto optimal circuits with respect to the pwr and ep parameters
***/
// MAE% = 0.13 %
// MAE = 21
// WCE% = 0.49 %
// WCE = 80
// WCRE% = 300.00 %
// EP% = 92.88 %
// MRE% = 3.06 %
// MSE = 709
// PDK45_PWR = 0.204 mW
// PDK45_AREA = 399.4 um2
// PDK45_DELAY = 1.19 ns
#include <stdint.h>
#include <stdlib.h>
uint64_t mul7u_0ED(uint64_t a, uint64_t b) {
int wa[7];
int wb[7];
uint64_t y = 0;
wa[0] = (a >> 0) & 0x01;
wb[0] = (b >> 0) & 0x01;
wa[1] = (a >> 1) & 0x01;
wb[1] = (b >> 1) & 0x01;
wa[2] = (a >> 2) & 0x01;
wb[2] = (b >> 2) & 0x01;
wa[3] = (a >> 3) & 0x01;
wb[3] = (b >> 3) & 0x01;
wa[4] = (a >> 4) & 0x01;
wb[4] = (b >> 4) & 0x01;
wa[5] = (a >> 5) & 0x01;
wb[5] = (b >> 5) & 0x01;
wa[6] = (a >> 6) & 0x01;
wb[6] = (b >> 6) & 0x01;
int sig_20 = wa[6] & wb[0];
int sig_25 = wa[3] & wb[2];
int sig_26 = wa[5] & wb[1];
int sig_27 = wa[6] & wb[1];
int sig_36 = wa[4] ^ sig_25;
int sig_37 = wa[4] & sig_25;
int sig_38 = sig_20 ^ sig_26;
int sig_39 = sig_20 & sig_26;
int sig_44 = wa[4] & wb[2];
int sig_45 = wa[5] & wb[2];
int sig_46 = wa[6] & wb[2];
int sig_63 = sig_36 & wb[1];
int sig_66 = sig_63;
int sig_67 = sig_38 ^ sig_44;
int sig_68 = sig_38 & sig_44;
int sig_69 = wa[3] & sig_37;
int sig_70 = sig_67 ^ sig_37;
int sig_71 = sig_68 | sig_69;
int sig_72 = sig_27 ^ sig_45;
int sig_73 = sig_27 & sig_45;
int sig_74 = wa[6] & sig_39;
int sig_75 = sig_72 ^ sig_39;
int sig_76 = sig_73 | sig_74;
int sig_80 = wa[3] & wb[3];
int sig_81 = wa[4] & wb[3];
int sig_82 = wa[5] & wb[3];
int sig_83 = wa[6] & wb[3];
int sig_93 = wa[3] & wb[0];
int sig_97 = wb[4] & wa[1];
int sig_98 = wa[2] & wb[3];
int sig_99 = sig_70 ^ sig_80;
int sig_100 = sig_70 & sig_80;
int sig_101 = sig_99 & sig_66;
int sig_102 = sig_99 ^ sig_66;
int sig_103 = sig_100 ^ sig_101;
int sig_104 = sig_75 ^ sig_81;
int sig_105 = sig_75 & sig_81;
int sig_106 = sig_104 & sig_71;
int sig_107 = sig_104 ^ sig_71;
int sig_108 = sig_105 | sig_106;
int sig_109 = sig_46 ^ sig_82;
int sig_110 = sig_46 & sig_82;
int sig_111 = sig_109 & sig_76;
int sig_112 = sig_109 ^ sig_76;
int sig_113 = sig_110 | sig_111;
int sig_115 = wa[1] & wb[4];
int sig_116 = wa[2] & wb[4];
int sig_117 = wa[3] & wb[4];
int sig_118 = wa[4] & wb[4];
int sig_119 = wa[5] & wb[4];
int sig_120 = wa[6] & wb[4];
int sig_125 = wa[0] & wb[5];
int sig_126 = sig_97 ^ sig_115;
int sig_127 = wa[1] & wa[0];
int sig_129 = sig_126 | sig_93;
int sig_130 = sig_127 & wb[4];
int sig_131 = sig_102 ^ sig_116;
int sig_132 = sig_102 & sig_116;
int sig_133 = sig_131 & sig_98;
int sig_134 = sig_131 ^ sig_98;
int sig_135 = sig_132 ^ sig_133;
int sig_136 = sig_107 ^ sig_117;
int sig_137 = sig_107 & sig_117;
int sig_138 = sig_136 & sig_103;
int sig_139 = sig_136 ^ sig_103;
int sig_140 = sig_137 ^ sig_138;
int sig_141 = sig_112 ^ sig_118;
int sig_142 = sig_112 & sig_118;
int sig_143 = sig_141 & sig_108;
int sig_144 = sig_141 ^ sig_108;
int sig_145 = sig_142 ^ sig_143;
int sig_146 = sig_83 ^ sig_119;
int sig_147 = sig_83 & sig_119;
int sig_148 = sig_146 & sig_113;
int sig_149 = sig_146 ^ sig_113;
int sig_150 = sig_147 ^ sig_148;
int sig_151 = wa[5] & wb[0];
int sig_152 = wa[1] & wb[5];
int sig_153 = wa[2] & wb[5];
int sig_154 = wa[3] & wb[5];
int sig_155 = wa[4] & wb[5];
int sig_156 = wa[5] & wb[5];
int sig_157 = wa[6] & wb[5];
int sig_158 = sig_129 ^ sig_151;
int sig_159 = wa[3] & sig_151;
int sig_160 = sig_158 & sig_125;
int sig_161 = sig_158 ^ sig_125;
int sig_162 = sig_159 ^ sig_160;
int sig_163 = sig_134 ^ sig_152;
int sig_164 = sig_134 & sig_152;
int sig_165 = sig_163 & sig_130;
int sig_166 = sig_163 ^ sig_130;
int sig_167 = sig_164 ^ sig_165;
int sig_168 = sig_139 ^ sig_153;
int sig_169 = sig_139 & sig_153;
int sig_170 = sig_168 & sig_135;
int sig_171 = sig_168 ^ sig_135;
int sig_172 = sig_169 ^ sig_170;
int sig_173 = sig_144 ^ sig_154;
int sig_174 = sig_144 & sig_154;
int sig_175 = sig_173 & sig_140;
int sig_176 = sig_173 ^ sig_140;
int sig_177 = sig_174 ^ sig_175;
int sig_178 = sig_149 ^ sig_155;
int sig_179 = sig_149 & sig_155;
int sig_180 = sig_178 & sig_145;
int sig_181 = sig_178 ^ sig_145;
int sig_182 = sig_179 ^ sig_180;
int sig_183 = sig_120 ^ sig_156;
int sig_184 = sig_120 & sig_156;
int sig_185 = sig_183 & sig_150;
int sig_186 = sig_183 ^ sig_150;
int sig_187 = sig_184 ^ sig_185;
int sig_188 = wa[0] & wb[6];
int sig_189 = wa[1] & wb[6];
int sig_190 = wa[2] & wb[6];
int sig_191 = wa[3] & wb[6];
int sig_192 = wa[4] & wb[6];
int sig_193 = wa[5] & wb[6];
int sig_194 = wa[6] & wb[6];
int sig_195 = sig_166 ^ sig_188;
int sig_196 = sig_166 & sig_188;
int sig_197 = sig_195 & sig_162;
int sig_198 = sig_195 ^ sig_162;
int sig_199 = sig_196 | sig_197;
int sig_200 = sig_171 ^ sig_189;
int sig_201 = sig_171 & sig_189;
int sig_202 = sig_200 & sig_167;
int sig_203 = sig_200 ^ sig_167;
int sig_204 = sig_201 ^ sig_202;
int sig_205 = sig_176 ^ sig_190;
int sig_206 = sig_176 & sig_190;
int sig_207 = sig_205 & sig_172;
int sig_208 = sig_205 ^ sig_172;
int sig_209 = sig_206 | sig_207;
int sig_210 = sig_181 ^ sig_191;
int sig_211 = sig_181 & sig_191;
int sig_212 = sig_210 & sig_177;
int sig_213 = sig_210 ^ sig_177;
int sig_214 = sig_211 | sig_212;
int sig_215 = sig_186 ^ sig_192;
int sig_216 = sig_186 & sig_192;
int sig_217 = sig_215 & sig_182;
int sig_218 = sig_215 ^ sig_182;
int sig_219 = sig_216 | sig_217;
int sig_220 = sig_157 ^ sig_193;
int sig_221 = sig_157 & sig_193;
int sig_222 = sig_220 & sig_187;
int sig_223 = sig_220 ^ sig_187;
int sig_224 = sig_221 | sig_222;
int sig_225 = sig_203 ^ sig_199;
int sig_226 = sig_203 & sig_199;
int sig_227 = sig_208 ^ sig_204;
int sig_228 = sig_208 & sig_204;
int sig_229 = sig_227 & sig_226;
int sig_230 = sig_227 ^ sig_226;
int sig_231 = sig_228 | sig_229;
int sig_232 = sig_213 ^ sig_209;
int sig_233 = sig_213 & sig_209;
int sig_234 = sig_232 & sig_231;
int sig_235 = sig_232 ^ sig_231;
int sig_236 = sig_233 | sig_234;
int sig_237 = sig_218 ^ sig_214;
int sig_238 = sig_218 & sig_214;
int sig_239 = sig_237 & sig_236;
int sig_240 = sig_237 ^ sig_236;
int sig_241 = sig_238 ^ sig_239;
int sig_242 = sig_223 ^ sig_219;
int sig_243 = sig_223 & sig_219;
int sig_244 = sig_242 & sig_241;
int sig_245 = sig_242 ^ sig_241;
int sig_246 = sig_243 ^ sig_244;
int sig_247 = sig_194 ^ sig_224;
int sig_248 = wb[6] & sig_224;
int sig_249 = sig_247 & sig_246;
int sig_250 = sig_247 ^ sig_246;
int sig_251 = sig_248 | sig_249;
y |= (sig_239 & 0x01) << 0; // default output
y |= (sig_196 & 0x01) << 1; // default output
y |= (sig_72 & 0x01) << 2; // default output
y |= (sig_107 & 0x01) << 3; // default output
y |= (sig_117 & 0x01) << 4; // default output
y |= (sig_161 & 0x01) << 5; // default output
y |= (sig_198 & 0x01) << 6; // default output
y |= (sig_225 & 0x01) << 7; // default output
y |= (sig_230 & 0x01) << 8; // default output
y |= (sig_235 & 0x01) << 9; // default output
y |= (sig_240 & 0x01) << 10; // default output
y |= (sig_245 & 0x01) << 11; // default output
y |= (sig_250 & 0x01) << 12; // default output
y |= (sig_251 & 0x01) << 13; // default output
return y;
}