Best Python code snippet using pytest-asyncio_python
test_coco.py
Source:test_coco.py
1#!/usr/bin/env python323import numpy as np4import matplotlib.pyplot as plt5import time6import cocotb7from cocotb.clock import Clock8from cocotb.triggers import RisingEdge9import time10from fxpmath import Fxp11from rig.type_casts import fix_to_float1213pi_fxp = Fxp(None, signed=True, n_word=12, n_frac=8) 14pi_fxp.rounding = 'around' 151617def fix_pt(val): 18 return int(pi_fxp(val).bin())192021def fix2float(val):22 f2f= fix_to_float(True,12, 10)23 return f2f(val)242526cnn_data = np.load('cnn_1train_weights_aftest.npz')27new_x = np.zeros((5,5))28layer2 = np.zeros((13,13,20))293031np.set_printoptions(precision=8)32np.set_printoptions(threshold=np.inf)3334correct_predictions = 035363738def print_max_err(i, d, id):39 if i == 0:40 exp = cnn_data[id][0]41 print(f'{np.max(np.abs(exp - d)):.3f}')424344def pwl_activation(acti):45 condition1 = np.less(acti, -2)46 condition2 = np.multiply(np.greater_equal(acti, -2), np.less(acti, -0.6875))47 condition3 = np.multiply(np.greater_equal(acti, -0.6875), np.less(acti, 0.6875))48 condition4 = np.multiply(np.greater_equal(acti, 0.6875), np.less(acti, 2))49 condition5 = np.greater_equal(acti, 2)5051 a = np.multiply(condition1, -1)52 b = np.multiply(condition2, np.multiply((acti - 2), 0.25))53 c = np.multiply(condition3, acti)54 d = np.multiply(condition4, np.multiply((acti + 2), 0.25))55 e = np.multiply(condition5, 1)5657 return a + b + c + d + e5859606162first_conv_max = 063second_conv_max = 064first_conv_avg = 065second_conv_avg = 06667first_layer_kernels = 2068second_layer_kernels = 6069third_layer_kernels = 6070fourth_layer_kernels = 12071# assume square kernels72first_layer_kernel_size = 473second_layer_kernel_size = 374third_layer_kernel_size = 375fourth_layer_kernel_size = 37677# assume 64bit fix point78bytesize = 87980# for each input in the test set81for i, img in enumerate(cnn_data['x_test']):8283 # layer0: conv2d84 weights = cnn_data['l0weights']85 iter=086 count = 08788 while(iter<25):89 ii=090 count2 = 091 while(ii<25):92 new_x = img[ii:ii+5,iter:iter+5]93 # loop = asyncio.new_event_loop()94 # asyncio.set_event_loop(loop)95 # layer2 = loop.run_until_complete(tstbench.test_cnn_hw(new_x,weights,layer2,iter,ii,count,count2))96 979899100 101 102 103 @cocotb.test()104 async def test_cnn_hw(dut, ii=ii, iter=iter, count=count, count2=count2):105 clock = Clock(dut.clk, 10, units="ns") # Create a 10ns period clock on port clk106 cocotb.fork(clock.start()) # Start the clock107108 reset = 0109 110 print("iter before is",iter)111 print("ii before is",ii)112113114 await RisingEdge(dut.clk)115 dut.reset <= reset116 dut.i_activation_0_0 <= fix_pt(new_x[0, 0])117 dut.i_activation_0_1 <= fix_pt(new_x[0, 1])118 dut.i_activation_0_2 <= fix_pt(new_x[0, 2])119 dut.i_activation_0_3 <= fix_pt(new_x[0, 3])120 dut.i_activation_0_4 <= fix_pt(new_x[0, 4])121 dut.i_activation_1_0 <= fix_pt(new_x[1, 0])122 dut.i_activation_1_1 <= fix_pt(new_x[1, 1])123 dut.i_activation_1_2 <= fix_pt(new_x[1, 2])124 dut.i_activation_1_3 <= fix_pt(new_x[1, 3])125 dut.i_activation_1_4 <= fix_pt(new_x[1, 4])126 dut.i_activation_2_0 <= fix_pt(new_x[2, 0])127 dut.i_activation_2_1 <= fix_pt(new_x[2, 1])128 dut.i_activation_2_2 <= fix_pt(new_x[2, 2])129 dut.i_activation_2_3 <= fix_pt(new_x[2, 3])130 dut.i_activation_2_4 <= fix_pt(new_x[2, 4])131 dut.i_activation_3_0 <= fix_pt(new_x[3, 0])132 dut.i_activation_3_1 <= fix_pt(new_x[3, 1])133 dut.i_activation_3_2 <= fix_pt(new_x[3, 2])134 dut.i_activation_3_3 <= fix_pt(new_x[3, 3])135 dut.i_activation_3_4 <= fix_pt(new_x[3, 4])136 dut.i_activation_4_0 <= fix_pt(new_x[4, 0])137 dut.i_activation_4_1 <= fix_pt(new_x[4, 1])138 dut.i_activation_4_2 <= fix_pt(new_x[4, 2])139 dut.i_activation_4_3 <= fix_pt(new_x[4, 3])140 dut.i_activation_4_4 <= fix_pt(new_x[4, 4])141142 dut.i_weight_0_0_0 <= fix_pt(weights[0, 0, 0])143 dut.i_weight_0_0_1 <= fix_pt(weights[0, 1, 0])144 dut.i_weight_0_0_2 <= fix_pt(weights[0, 2, 0])145 dut.i_weight_0_0_3 <= fix_pt(weights[0, 3, 0])146 dut.i_weight_0_1_0 <= fix_pt(weights[1, 0, 0])147 dut.i_weight_0_1_1 <= fix_pt(weights[1, 1, 0])148 dut.i_weight_0_1_2 <= fix_pt(weights[1, 2, 0])149 dut.i_weight_0_1_3 <= fix_pt(weights[1, 3, 0])150 dut.i_weight_0_2_0 <= fix_pt(weights[2, 0, 0])151 dut.i_weight_0_2_1 <= fix_pt(weights[2, 1, 0])152 dut.i_weight_0_2_2 <= fix_pt(weights[2, 2, 0])153 dut.i_weight_0_2_3 <= fix_pt(weights[2, 3, 0])154 dut.i_weight_0_3_0 <= fix_pt(weights[3, 0, 0])155 dut.i_weight_0_3_1 <= fix_pt(weights[3, 1, 0])156 dut.i_weight_0_3_2 <= fix_pt(weights[3, 2, 0])157 dut.i_weight_0_3_3 <= fix_pt(weights[3, 3, 0])158159 dut.i_weight_1_0_0 <= fix_pt(weights[0, 0, 1])160 dut.i_weight_1_0_1 <= fix_pt(weights[0, 1, 1])161 dut.i_weight_1_0_2 <= fix_pt(weights[0, 2, 1])162 dut.i_weight_1_0_3 <= fix_pt(weights[0, 3, 1])163 dut.i_weight_1_1_0 <= fix_pt(weights[1, 0, 1])164 dut.i_weight_1_1_1 <= fix_pt(weights[1, 1, 1])165 dut.i_weight_1_1_2 <= fix_pt(weights[1, 2, 1])166 dut.i_weight_1_1_3 <= fix_pt(weights[1, 3, 1])167 dut.i_weight_1_2_0 <= fix_pt(weights[2, 0, 1])168 dut.i_weight_1_2_1 <= fix_pt(weights[2, 1, 1])169 dut.i_weight_1_2_2 <= fix_pt(weights[2, 2, 1])170 dut.i_weight_1_2_3 <= fix_pt(weights[2, 3, 1])171 dut.i_weight_1_3_0 <= fix_pt(weights[3, 0, 1])172 dut.i_weight_1_3_1 <= fix_pt(weights[3, 1, 1])173 dut.i_weight_1_3_2 <= fix_pt(weights[3, 2, 1])174 dut.i_weight_1_3_3 <= fix_pt(weights[3, 3, 1])175176 dut.i_weight_2_0_0 <= fix_pt(weights[0, 0, 2])177 dut.i_weight_2_0_1 <= fix_pt(weights[0, 1, 2])178 dut.i_weight_2_0_2 <= fix_pt(weights[0, 2, 2])179 dut.i_weight_2_0_3 <= fix_pt(weights[0, 3, 2])180 dut.i_weight_2_1_0 <= fix_pt(weights[1, 0, 2])181 dut.i_weight_2_1_1 <= fix_pt(weights[1, 1, 2])182 dut.i_weight_2_1_2 <= fix_pt(weights[1, 2, 2])183 dut.i_weight_2_1_3 <= fix_pt(weights[1, 3, 2])184 dut.i_weight_2_2_0 <= fix_pt(weights[2, 0, 2])185 dut.i_weight_2_2_1 <= fix_pt(weights[2, 1, 2])186 dut.i_weight_2_2_2 <= fix_pt(weights[2, 2, 2])187 dut.i_weight_2_2_3 <= fix_pt(weights[2, 3, 2])188 dut.i_weight_2_3_0 <= fix_pt(weights[3, 0, 2])189 dut.i_weight_2_3_1 <= fix_pt(weights[3, 1, 2])190 dut.i_weight_2_3_2 <= fix_pt(weights[3, 2, 2])191 dut.i_weight_2_3_3 <= fix_pt(weights[3, 3, 2])192193 dut.i_weight_3_0_0 <= fix_pt(weights[0, 0, 3])194 dut.i_weight_3_0_1 <= fix_pt(weights[0, 1, 3])195 dut.i_weight_3_0_2 <= fix_pt(weights[0, 2, 3])196 dut.i_weight_3_0_3 <= fix_pt(weights[0, 3, 3])197 dut.i_weight_3_1_0 <= fix_pt(weights[1, 0, 3])198 dut.i_weight_3_1_1 <= fix_pt(weights[1, 1, 3])199 dut.i_weight_3_1_2 <= fix_pt(weights[1, 2, 3])200 dut.i_weight_3_1_3 <= fix_pt(weights[1, 3, 3])201 dut.i_weight_3_2_0 <= fix_pt(weights[2, 0, 3])202 dut.i_weight_3_2_1 <= fix_pt(weights[2, 1, 3])203 dut.i_weight_3_2_2 <= fix_pt(weights[2, 2, 3])204 dut.i_weight_3_2_3 <= fix_pt(weights[2, 3, 3])205 dut.i_weight_3_3_0 <= fix_pt(weights[3, 0, 3])206 dut.i_weight_3_3_1 <= fix_pt(weights[3, 1, 3])207 dut.i_weight_3_3_2 <= fix_pt(weights[3, 2, 3])208 dut.i_weight_3_3_3 <= fix_pt(weights[3, 3, 3])209210 dut.i_weight_4_0_0 <= fix_pt(weights[0, 0, 4])211 dut.i_weight_4_0_1 <= fix_pt(weights[0, 1, 4])212 dut.i_weight_4_0_2 <= fix_pt(weights[0, 2, 4])213 dut.i_weight_4_0_3 <= fix_pt(weights[0, 3, 4])214 dut.i_weight_4_1_0 <= fix_pt(weights[1, 0, 4])215 dut.i_weight_4_1_1 <= fix_pt(weights[1, 1, 4])216 dut.i_weight_4_1_2 <= fix_pt(weights[1, 2, 4])217 dut.i_weight_4_1_3 <= fix_pt(weights[1, 3, 4])218 dut.i_weight_4_2_0 <= fix_pt(weights[2, 0, 4])219 dut.i_weight_4_2_1 <= fix_pt(weights[2, 1, 4])220 dut.i_weight_4_2_2 <= fix_pt(weights[2, 2, 4])221 dut.i_weight_4_2_3 <= fix_pt(weights[2, 3, 4])222 dut.i_weight_4_3_0 <= fix_pt(weights[3, 0, 4])223 dut.i_weight_4_3_1 <= fix_pt(weights[3, 1, 4])224 dut.i_weight_4_3_2 <= fix_pt(weights[3, 2, 4])225 dut.i_weight_4_3_3 <= fix_pt(weights[3, 3, 4])226227 dut.i_weight_5_0_0 <= fix_pt(weights[0, 0, 5])228 dut.i_weight_5_0_1 <= fix_pt(weights[0, 1, 5])229 dut.i_weight_5_0_2 <= fix_pt(weights[0, 2, 5])230 dut.i_weight_5_0_3 <= fix_pt(weights[0, 3, 5])231 dut.i_weight_5_1_0 <= fix_pt(weights[1, 0, 5])232 dut.i_weight_5_1_1 <= fix_pt(weights[1, 1, 5])233 dut.i_weight_5_1_2 <= fix_pt(weights[1, 2, 5])234 dut.i_weight_5_1_3 <= fix_pt(weights[1, 3, 5])235 dut.i_weight_5_2_0 <= fix_pt(weights[2, 0, 5])236 dut.i_weight_5_2_1 <= fix_pt(weights[2, 1, 5])237 dut.i_weight_5_2_2 <= fix_pt(weights[2, 2, 5])238 dut.i_weight_5_2_3 <= fix_pt(weights[2, 3, 5])239 dut.i_weight_5_3_0 <= fix_pt(weights[3, 0, 5])240 dut.i_weight_5_3_1 <= fix_pt(weights[3, 1, 5])241 dut.i_weight_5_3_2 <= fix_pt(weights[3, 2, 5])242 dut.i_weight_5_3_3 <= fix_pt(weights[3, 3, 5])243244 dut.i_weight_6_0_0 <= fix_pt(weights[0, 0, 6])245 dut.i_weight_6_0_1 <= fix_pt(weights[0, 1, 6])246 dut.i_weight_6_0_2 <= fix_pt(weights[0, 2, 6])247 dut.i_weight_6_0_3 <= fix_pt(weights[0, 3, 6])248 dut.i_weight_6_1_0 <= fix_pt(weights[1, 0, 6])249 dut.i_weight_6_1_1 <= fix_pt(weights[1, 1, 6])250 dut.i_weight_6_1_2 <= fix_pt(weights[1, 2, 6])251 dut.i_weight_6_1_3 <= fix_pt(weights[1, 3, 6])252 dut.i_weight_6_2_0 <= fix_pt(weights[2, 0, 6])253 dut.i_weight_6_2_1 <= fix_pt(weights[2, 1, 6])254 dut.i_weight_6_2_2 <= fix_pt(weights[2, 2, 6])255 dut.i_weight_6_2_3 <= fix_pt(weights[2, 3, 6])256 dut.i_weight_6_3_0 <= fix_pt(weights[3, 0, 6])257 dut.i_weight_6_3_1 <= fix_pt(weights[3, 1, 6])258 dut.i_weight_6_3_2 <= fix_pt(weights[3, 2, 6])259 dut.i_weight_6_3_3 <= fix_pt(weights[3, 3, 6])260261 dut.i_weight_7_0_0 <= fix_pt(weights[0, 0, 7])262 dut.i_weight_7_0_1 <= fix_pt(weights[0, 1, 7])263 dut.i_weight_7_0_2 <= fix_pt(weights[0, 2, 7])264 dut.i_weight_7_0_3 <= fix_pt(weights[0, 3, 7])265 dut.i_weight_7_1_0 <= fix_pt(weights[1, 0, 7])266 dut.i_weight_7_1_1 <= fix_pt(weights[1, 1, 7])267 dut.i_weight_7_1_2 <= fix_pt(weights[1, 2, 7])268 dut.i_weight_7_1_3 <= fix_pt(weights[1, 3, 7])269 dut.i_weight_7_2_0 <= fix_pt(weights[2, 0, 7])270 dut.i_weight_7_2_1 <= fix_pt(weights[2, 1, 7])271 dut.i_weight_7_2_2 <= fix_pt(weights[2, 2, 7])272 dut.i_weight_7_2_3 <= fix_pt(weights[2, 3, 7])273 dut.i_weight_7_3_0 <= fix_pt(weights[3, 0, 7])274 dut.i_weight_7_3_1 <= fix_pt(weights[3, 1, 7])275 dut.i_weight_7_3_2 <= fix_pt(weights[3, 2, 7])276 dut.i_weight_7_3_3 <= fix_pt(weights[3, 3, 7])277278 dut.i_weight_8_0_0 <= fix_pt(weights[0, 0, 8])279 dut.i_weight_8_0_1 <= fix_pt(weights[0, 1, 8])280 dut.i_weight_8_0_2 <= fix_pt(weights[0, 2, 8])281 dut.i_weight_8_0_3 <= fix_pt(weights[0, 3, 8])282 dut.i_weight_8_1_0 <= fix_pt(weights[1, 0, 8])283 dut.i_weight_8_1_1 <= fix_pt(weights[1, 1, 8])284 dut.i_weight_8_1_2 <= fix_pt(weights[1, 2, 8])285 dut.i_weight_8_1_3 <= fix_pt(weights[1, 3, 8])286 dut.i_weight_8_2_0 <= fix_pt(weights[2, 0, 8])287 dut.i_weight_8_2_1 <= fix_pt(weights[2, 1, 8])288 dut.i_weight_8_2_2 <= fix_pt(weights[2, 2, 8])289 dut.i_weight_8_2_3 <= fix_pt(weights[2, 3, 8])290 dut.i_weight_8_3_0 <= fix_pt(weights[3, 0, 8])291 dut.i_weight_8_3_1 <= fix_pt(weights[3, 1, 8])292 dut.i_weight_8_3_2 <= fix_pt(weights[3, 2, 8])293 dut.i_weight_8_3_3 <= fix_pt(weights[3, 3, 8])294295 dut.i_weight_9_0_0 <= fix_pt(weights[0, 0, 9])296 dut.i_weight_9_0_1 <= fix_pt(weights[0, 1, 9])297 dut.i_weight_9_0_2 <= fix_pt(weights[0, 2, 9])298 dut.i_weight_9_0_3 <= fix_pt(weights[0, 3, 9])299 dut.i_weight_9_1_0 <= fix_pt(weights[1, 0, 9])300 dut.i_weight_9_1_1 <= fix_pt(weights[1, 1, 9])301 dut.i_weight_9_1_2 <= fix_pt(weights[1, 2, 9])302 dut.i_weight_9_1_3 <= fix_pt(weights[1, 3, 9])303 dut.i_weight_9_2_0 <= fix_pt(weights[2, 0, 9])304 dut.i_weight_9_2_1 <= fix_pt(weights[2, 1, 9])305 dut.i_weight_9_2_2 <= fix_pt(weights[2, 2, 9])306 dut.i_weight_9_2_3 <= fix_pt(weights[2, 3, 9])307 dut.i_weight_9_3_0 <= fix_pt(weights[3, 0, 9])308 dut.i_weight_9_3_1 <= fix_pt(weights[3, 1, 9])309 dut.i_weight_9_3_2 <= fix_pt(weights[3, 2, 9])310 dut.i_weight_9_3_3 <= fix_pt(weights[3, 3, 9])311312 dut.i_weight_10_0_0 <= fix_pt(weights[0, 0, 10])313 dut.i_weight_10_0_1 <= fix_pt(weights[0, 1, 10])314 dut.i_weight_10_0_2 <= fix_pt(weights[0, 2, 10])315 dut.i_weight_10_0_3 <= fix_pt(weights[0, 3, 10])316 dut.i_weight_10_1_0 <= fix_pt(weights[1, 0, 10])317 dut.i_weight_10_1_1 <= fix_pt(weights[1, 1, 10])318 dut.i_weight_10_1_2 <= fix_pt(weights[1, 2, 10])319 dut.i_weight_10_1_3 <= fix_pt(weights[1, 3, 10])320 dut.i_weight_10_2_0 <= fix_pt(weights[2, 0, 10])321 dut.i_weight_10_2_1 <= fix_pt(weights[2, 1, 10])322 dut.i_weight_10_2_2 <= fix_pt(weights[2, 2, 10])323 dut.i_weight_10_2_3 <= fix_pt(weights[2, 3, 10])324 dut.i_weight_10_3_0 <= fix_pt(weights[3, 0, 10])325 dut.i_weight_10_3_1 <= fix_pt(weights[3, 1, 10])326 dut.i_weight_10_3_2 <= fix_pt(weights[3, 2, 10])327 dut.i_weight_10_3_3 <= fix_pt(weights[3, 3, 10])328329 dut.i_weight_11_0_0 <= fix_pt(weights[0, 0, 11])330 dut.i_weight_11_0_1 <= fix_pt(weights[0, 1, 11])331 dut.i_weight_11_0_2 <= fix_pt(weights[0, 2, 11])332 dut.i_weight_11_0_3 <= fix_pt(weights[0, 3, 11])333 dut.i_weight_11_1_0 <= fix_pt(weights[1, 0, 11])334 dut.i_weight_11_1_1 <= fix_pt(weights[1, 1, 11])335 dut.i_weight_11_1_2 <= fix_pt(weights[1, 2, 11])336 dut.i_weight_11_1_3 <= fix_pt(weights[1, 3, 11])337 dut.i_weight_11_2_0 <= fix_pt(weights[2, 0, 11])338 dut.i_weight_11_2_1 <= fix_pt(weights[2, 1, 11])339 dut.i_weight_11_2_2 <= fix_pt(weights[2, 2, 11])340 dut.i_weight_11_2_3 <= fix_pt(weights[2, 3, 11])341 dut.i_weight_11_3_0 <= fix_pt(weights[3, 0, 11])342 dut.i_weight_11_3_1 <= fix_pt(weights[3, 1, 11])343 dut.i_weight_11_3_2 <= fix_pt(weights[3, 2, 11])344 dut.i_weight_11_3_3 <= fix_pt(weights[3, 3, 11])345346 dut.i_weight_12_0_0 <= fix_pt(weights[0, 0, 12])347 dut.i_weight_12_0_1 <= fix_pt(weights[0, 1, 12])348 dut.i_weight_12_0_2 <= fix_pt(weights[0, 2, 12])349 dut.i_weight_12_0_3 <= fix_pt(weights[0, 3, 12])350 dut.i_weight_12_1_0 <= fix_pt(weights[1, 0, 12])351 dut.i_weight_12_1_1 <= fix_pt(weights[1, 1, 12])352 dut.i_weight_12_1_2 <= fix_pt(weights[1, 2, 12])353 dut.i_weight_12_1_3 <= fix_pt(weights[1, 3, 12])354 dut.i_weight_12_2_0 <= fix_pt(weights[2, 0, 12])355 dut.i_weight_12_2_1 <= fix_pt(weights[2, 1, 12])356 dut.i_weight_12_2_2 <= fix_pt(weights[2, 2, 12])357 dut.i_weight_12_2_3 <= fix_pt(weights[2, 3, 12])358 dut.i_weight_12_3_0 <= fix_pt(weights[3, 0, 12])359 dut.i_weight_12_3_1 <= fix_pt(weights[3, 1, 12])360 dut.i_weight_12_3_2 <= fix_pt(weights[3, 2, 12])361 dut.i_weight_12_3_3 <= fix_pt(weights[3, 3, 12])362363 dut.i_weight_13_0_0 <= fix_pt(weights[0, 0, 13])364 dut.i_weight_13_0_1 <= fix_pt(weights[0, 1, 13])365 dut.i_weight_13_0_2 <= fix_pt(weights[0, 2, 13])366 dut.i_weight_13_0_3 <= fix_pt(weights[0, 3, 13])367 dut.i_weight_13_1_0 <= fix_pt(weights[1, 0, 13])368 dut.i_weight_13_1_1 <= fix_pt(weights[1, 1, 13])369 dut.i_weight_13_1_2 <= fix_pt(weights[1, 2, 13])370 dut.i_weight_13_1_3 <= fix_pt(weights[1, 3, 13])371 dut.i_weight_13_2_0 <= fix_pt(weights[2, 0, 13])372 dut.i_weight_13_2_1 <= fix_pt(weights[2, 1, 13])373 dut.i_weight_13_2_2 <= fix_pt(weights[2, 2, 13])374 dut.i_weight_13_2_3 <= fix_pt(weights[2, 3, 13])375 dut.i_weight_13_3_0 <= fix_pt(weights[3, 0, 13])376 dut.i_weight_13_3_1 <= fix_pt(weights[3, 1, 13])377 dut.i_weight_13_3_2 <= fix_pt(weights[3, 2, 13])378 dut.i_weight_13_3_3 <= fix_pt(weights[3, 3, 13])379380 dut.i_weight_14_0_0 <= fix_pt(weights[0, 0, 14])381 dut.i_weight_14_0_1 <= fix_pt(weights[0, 1, 14])382 dut.i_weight_14_0_2 <= fix_pt(weights[0, 2, 14])383 dut.i_weight_14_0_3 <= fix_pt(weights[0, 3, 14])384 dut.i_weight_14_1_0 <= fix_pt(weights[1, 0, 14])385 dut.i_weight_14_1_1 <= fix_pt(weights[1, 1, 14])386 dut.i_weight_14_1_2 <= fix_pt(weights[1, 2, 14])387 dut.i_weight_14_1_3 <= fix_pt(weights[1, 3, 14])388 dut.i_weight_14_2_0 <= fix_pt(weights[2, 0, 14])389 dut.i_weight_14_2_1 <= fix_pt(weights[2, 1, 14])390 dut.i_weight_14_2_2 <= fix_pt(weights[2, 2, 14])391 dut.i_weight_14_2_3 <= fix_pt(weights[2, 3, 14])392 dut.i_weight_14_3_0 <= fix_pt(weights[3, 0, 14])393 dut.i_weight_14_3_1 <= fix_pt(weights[3, 1, 14])394 dut.i_weight_14_3_2 <= fix_pt(weights[3, 2, 14])395 dut.i_weight_14_3_3 <= fix_pt(weights[3, 3, 14])396397 dut.i_weight_15_0_0 <= fix_pt(weights[0, 0, 15])398 dut.i_weight_15_0_1 <= fix_pt(weights[0, 1, 15])399 dut.i_weight_15_0_2 <= fix_pt(weights[0, 2, 15])400 dut.i_weight_15_0_3 <= fix_pt(weights[0, 3, 15])401 dut.i_weight_15_1_0 <= fix_pt(weights[1, 0, 15])402 dut.i_weight_15_1_1 <= fix_pt(weights[1, 1, 15])403 dut.i_weight_15_1_2 <= fix_pt(weights[1, 2, 15])404 dut.i_weight_15_1_3 <= fix_pt(weights[1, 3, 15])405 dut.i_weight_15_2_0 <= fix_pt(weights[2, 0, 15])406 dut.i_weight_15_2_1 <= fix_pt(weights[2, 1, 15])407 dut.i_weight_15_2_2 <= fix_pt(weights[2, 2, 15])408 dut.i_weight_15_2_3 <= fix_pt(weights[2, 3, 15])409 dut.i_weight_15_3_0 <= fix_pt(weights[3, 0, 15])410 dut.i_weight_15_3_1 <= fix_pt(weights[3, 1, 15])411 dut.i_weight_15_3_2 <= fix_pt(weights[3, 2, 15])412 dut.i_weight_15_3_3 <= fix_pt(weights[3, 3, 15])413414 dut.i_weight_16_0_0 <= fix_pt(weights[0, 0, 16])415 dut.i_weight_16_0_1 <= fix_pt(weights[0, 1, 16])416 dut.i_weight_16_0_2 <= fix_pt(weights[0, 2, 16])417 dut.i_weight_16_0_3 <= fix_pt(weights[0, 3, 16])418 dut.i_weight_16_1_0 <= fix_pt(weights[1, 0, 16])419 dut.i_weight_16_1_1 <= fix_pt(weights[1, 1, 16])420 dut.i_weight_16_1_2 <= fix_pt(weights[1, 2, 16])421 dut.i_weight_16_1_3 <= fix_pt(weights[1, 3, 16])422 dut.i_weight_16_2_0 <= fix_pt(weights[2, 0, 16])423 dut.i_weight_16_2_1 <= fix_pt(weights[2, 1, 16])424 dut.i_weight_16_2_2 <= fix_pt(weights[2, 2, 16])425 dut.i_weight_16_2_3 <= fix_pt(weights[2, 3, 16])426 dut.i_weight_16_3_0 <= fix_pt(weights[3, 0, 16])427 dut.i_weight_16_3_1 <= fix_pt(weights[3, 1, 16])428 dut.i_weight_16_3_2 <= fix_pt(weights[3, 2, 16])429 dut.i_weight_16_3_3 <= fix_pt(weights[3, 3, 16])430431 dut.i_weight_17_0_0 <= fix_pt(weights[0, 0, 17])432 dut.i_weight_17_0_1 <= fix_pt(weights[0, 1, 17])433 dut.i_weight_17_0_2 <= fix_pt(weights[0, 2, 17])434 dut.i_weight_17_0_3 <= fix_pt(weights[0, 3, 17])435 dut.i_weight_17_1_0 <= fix_pt(weights[1, 0, 17])436 dut.i_weight_17_1_1 <= fix_pt(weights[1, 1, 17])437 dut.i_weight_17_1_2 <= fix_pt(weights[1, 2, 17])438 dut.i_weight_17_1_3 <= fix_pt(weights[1, 3, 17])439 dut.i_weight_17_2_0 <= fix_pt(weights[2, 0, 17])440 dut.i_weight_17_2_1 <= fix_pt(weights[2, 1, 17])441 dut.i_weight_17_2_2 <= fix_pt(weights[2, 2, 17])442 dut.i_weight_17_2_3 <= fix_pt(weights[2, 3, 17])443 dut.i_weight_17_3_0 <= fix_pt(weights[3, 0, 17])444 dut.i_weight_17_3_1 <= fix_pt(weights[3, 1, 17])445 dut.i_weight_17_3_2 <= fix_pt(weights[3, 2, 17])446 dut.i_weight_17_3_3 <= fix_pt(weights[3, 3, 17])447448 dut.i_weight_18_0_0 <= fix_pt(weights[0, 0, 18])449 dut.i_weight_18_0_1 <= fix_pt(weights[0, 1, 18])450 dut.i_weight_18_0_2 <= fix_pt(weights[0, 2, 18])451 dut.i_weight_18_0_3 <= fix_pt(weights[0, 3, 18])452 dut.i_weight_18_1_0 <= fix_pt(weights[1, 0, 18])453 dut.i_weight_18_1_1 <= fix_pt(weights[1, 1, 18])454 dut.i_weight_18_1_2 <= fix_pt(weights[1, 2, 18])455 dut.i_weight_18_1_3 <= fix_pt(weights[1, 3, 18])456 dut.i_weight_18_2_0 <= fix_pt(weights[2, 0, 18])457 dut.i_weight_18_2_1 <= fix_pt(weights[2, 1, 18])458 dut.i_weight_18_2_2 <= fix_pt(weights[2, 2, 18])459 dut.i_weight_18_2_3 <= fix_pt(weights[2, 3, 18])460 dut.i_weight_18_3_0 <= fix_pt(weights[3, 0, 18])461 dut.i_weight_18_3_1 <= fix_pt(weights[3, 1, 18])462 dut.i_weight_18_3_2 <= fix_pt(weights[3, 2, 18])463 dut.i_weight_18_3_3 <= fix_pt(weights[3, 3, 18])464465 dut.i_weight_19_0_0 <= fix_pt(weights[0, 0, 19])466 dut.i_weight_19_0_1 <= fix_pt(weights[0, 1, 19])467 dut.i_weight_19_0_2 <= fix_pt(weights[0, 2, 19])468 dut.i_weight_19_0_3 <= fix_pt(weights[0, 3, 19])469 dut.i_weight_19_1_0 <= fix_pt(weights[1, 0, 19])470 dut.i_weight_19_1_1 <= fix_pt(weights[1, 1, 19])471 dut.i_weight_19_1_2 <= fix_pt(weights[1, 2, 19])472 dut.i_weight_19_1_3 <= fix_pt(weights[1, 3, 19])473 dut.i_weight_19_2_0 <= fix_pt(weights[2, 0, 19])474 dut.i_weight_19_2_1 <= fix_pt(weights[2, 1, 19])475 dut.i_weight_19_2_2 <= fix_pt(weights[2, 2, 19])476 dut.i_weight_19_2_3 <= fix_pt(weights[2, 3, 19])477 dut.i_weight_19_3_0 <= fix_pt(weights[3, 0, 19])478 dut.i_weight_19_3_1 <= fix_pt(weights[3, 1, 19])479 dut.i_weight_19_3_2 <= fix_pt(weights[3, 2, 19])480 dut.i_weight_19_3_3 <= fix_pt(weights[3, 3, 19])481482 time.sleep(10)483 484 485 #print("count is:",count)486 #print("count2 is:",count2)487 print("iter",iter)488 print("ii",ii)489490 layer2[count, count2, 0] = fix2float(dut.o_output_0)491 layer2[count, count2, 1] = fix2float(dut.o_output_1)492 layer2[count, count2, 2] = fix2float(dut.o_output_2)493 layer2[count, count2, 3] = fix2float(dut.o_output_3)494 layer2[count, count2, 4] = fix2float(dut.o_output_4)495 layer2[count, count2, 5] = fix2float(dut.o_output_5)496 layer2[count, count2, 6] = fix2float(dut.o_output_6)497 layer2[count, count2, 7] = fix2float(dut.o_output_7)498 layer2[count, count2, 8] = fix2float(dut.o_output_8)499 layer2[count, count2, 9] = fix2float(dut.o_output_9)500 layer2[count, count2, 10] = fix2float(dut.o_output_10)501 layer2[count, count2, 11] = fix2float(dut.o_output_11)502 layer2[count, count2, 12] = fix2float(dut.o_output_12)503 layer2[count, count2, 13] = fix2float(dut.o_output_13)504 layer2[count, count2, 14] = fix2float(dut.o_output_14)505 layer2[count, count2, 15] = fix2float(dut.o_output_15)506 layer2[count, count2, 16] = fix2float(dut.o_output_16)507 layer2[count, count2, 17] = fix2float(dut.o_output_17)508 layer2[count, count2, 18] = fix2float(dut.o_output_18)509 layer2[count, count2, 19] = fix2float(dut.o_output_19)510 511 512513514 515 ii = ii + 2516 count2 = count2+1517 iter = iter + 2518 519 count=count+1520521522 # if i == 0:523 # print('saving data')524 # np.save('exact_fm.npy', layer2)525526 # # layer3: conv2d527 # weights = cnn_data['l3weights']528 # shape = (first_layer_kernels, second_layer_kernel_size, second_layer_kernel_size, layer2.shape[0] - second_layer_kernel_size + 1,529 # layer2.shape[1] - second_layer_kernel_size + 1)530 # # stride values: bytesize = size of one data value531 # stride = (bytesize, first_layer_kernels * layer2.shape[0] * bytesize, first_layer_kernels * bytesize, layer2.shape[1] * first_layer_kernels * bytesize,532 # first_layer_kernels * bytesize)533 # subs = np.lib.stride_tricks.as_strided(layer2, shape, stride)534 # layer3 = np.einsum('ijhm,hijkl->klm', weights, subs) + [[cnn_data['l3biases']]]535 # #print_max_err(i, layer3, 'test0l3')536537 # # layer4: activation function538 # layer4 = np.maximum(layer3, 0)539540 # # layer5: conv2d541 # weights = cnn_data['l5weights']542 # shape = (second_layer_kernels, third_layer_kernel_size, third_layer_kernel_size, layer4.shape[0] - third_layer_kernel_size + 1,543 # layer4.shape[1] - third_layer_kernel_size + 1)544 # # stride values: bytesize = size of one data value545 # stride = (bytesize, second_layer_kernels * layer4.shape[0] * bytesize, second_layer_kernels * bytesize, layer4.shape[1] * second_layer_kernels * bytesize,546 # second_layer_kernels * bytesize)547 # subs = np.lib.stride_tricks.as_strided(layer4, shape, stride)548 # layer5 = np.einsum('ijhm,hijkl->klm', weights, subs) + [[cnn_data['l5biases']]]549 # #print_max_err(i, layer5, 'test0l5')550551 # # layer6: activation function552 # layer6 = np.maximum(layer5, 0)553 # #print_max_err(i, layer6, 'test0l6')554555 # # layer7: max pooling with 'same' padding556 # layer6_padded = np.zeros(tuple([sum(x) for x in zip(layer6.shape, (1, 1, 0))]))557 # layer6_padded[:9, :9, :] = layer6558 # layer6_padded[9, :9, :] = layer6[8, :, :]559 # layer6_padded[:9, 9, :] = layer6[:, 8, :]560 # layer7 = layer6_padded.reshape(int(layer6_padded.shape[0] / 2), 2, int(layer6_padded.shape[1] / 2), 2, -1).max(axis=(1, 3))561 # #print_max_err(i, layer7, 'test0l7')562563 # # layer8: conv2d564 # weights = cnn_data['l8weights']565 # shape = (third_layer_kernels, fourth_layer_kernel_size, fourth_layer_kernel_size, layer7.shape[0] - fourth_layer_kernel_size + 1,566 # layer7.shape[1] - fourth_layer_kernel_size + 1)567 # # stride values: bytesize = size of one data value568 # stride = (bytesize, third_layer_kernels * layer7.shape[0] * bytesize, third_layer_kernels * bytesize, layer7.shape[1] * third_layer_kernels * bytesize,569 # third_layer_kernels * bytesize)570 # subs = np.lib.stride_tricks.as_strided(layer7, shape, stride)571 # layer8 = np.einsum('ijhm,hijkl->klm', weights, subs) + [[cnn_data['l8biases']]]572 # #print_max_err(i, layer8, 'test0l8')573574 # # layer9: activation function575 # layer9 = np.maximum(layer8, 0)576577 # # layer10: flatten578 # layer10 = layer9.flatten()579580 # # layer11: dense581 # layer11 = np.dot(layer10, cnn_data['l11weights']) + cnn_data['l11biases']582 # #print_max_err(i, layer11, 'test0l11')583584 # # layer12: dense585 # layer12 = np.dot(layer11, cnn_data['l12weights']) + cnn_data['l12biases']586 # #print_max_err(i, layer12, 'test0l12')587588 # # layer13: softmax589 # exp = np.exp(layer12)590 # layer13 = exp / np.sum(exp)591592 # if (np.argmax(layer12) == np.argmax(cnn_data['y_test'][i])):593 # correct_predictions += 1594595 # print(f'Test {i + 1} of 500. Accuracy: {correct_predictions / (i + 1):.3f}')
...
adding.py
Source:adding.py
1async def test_cnn_hw(dut, ii=ii, iter=iter, count=count, count2=count2):2 clock = Clock(dut.clk, 10, units="ns") # Create a 10ns period clock on port clk3 cocotb.fork(clock.start()) # Start the clock4 reset = 05 print("iter before is", iter)6 print("ii before is", ii)7 await RisingEdge(dut.clk)8 dut.reset <= reset9 dut.i_activation_0_0 <= fix_pt(new_x[0, 0])10 dut.i_activation_0_1 <= fix_pt(new_x[0, 1])11 dut.i_activation_0_2 <= fix_pt(new_x[0, 2])12 dut.i_activation_0_3 <= fix_pt(new_x[0, 3])13 dut.i_activation_0_4 <= fix_pt(new_x[0, 4])14 dut.i_activation_1_0 <= fix_pt(new_x[1, 0])15 dut.i_activation_1_1 <= fix_pt(new_x[1, 1])16 dut.i_activation_1_2 <= fix_pt(new_x[1, 2])17 dut.i_activation_1_3 <= fix_pt(new_x[1, 3])18 dut.i_activation_1_4 <= fix_pt(new_x[1, 4])19 dut.i_activation_2_0 <= fix_pt(new_x[2, 0])20 dut.i_activation_2_1 <= fix_pt(new_x[2, 1])21 dut.i_activation_2_2 <= fix_pt(new_x[2, 2])22 dut.i_activation_2_3 <= fix_pt(new_x[2, 3])23 dut.i_activation_2_4 <= fix_pt(new_x[2, 4])24 dut.i_activation_3_0 <= fix_pt(new_x[3, 0])25 dut.i_activation_3_1 <= fix_pt(new_x[3, 1])26 dut.i_activation_3_2 <= fix_pt(new_x[3, 2])27 dut.i_activation_3_3 <= fix_pt(new_x[3, 3])28 dut.i_activation_3_4 <= fix_pt(new_x[3, 4])29 dut.i_activation_4_0 <= fix_pt(new_x[4, 0])30 dut.i_activation_4_1 <= fix_pt(new_x[4, 1])31 dut.i_activation_4_2 <= fix_pt(new_x[4, 2])32 dut.i_activation_4_3 <= fix_pt(new_x[4, 3])33 dut.i_activation_4_4 <= fix_pt(new_x[4, 4])34 dut.i_weight_0_0_0 <= fix_pt(weights[0, 0, 0])35 dut.i_weight_0_0_1 <= fix_pt(weights[0, 1, 0])36 dut.i_weight_0_0_2 <= fix_pt(weights[0, 2, 0])37 dut.i_weight_0_0_3 <= fix_pt(weights[0, 3, 0])38 dut.i_weight_0_1_0 <= fix_pt(weights[1, 0, 0])39 dut.i_weight_0_1_1 <= fix_pt(weights[1, 1, 0])40 dut.i_weight_0_1_2 <= fix_pt(weights[1, 2, 0])41 dut.i_weight_0_1_3 <= fix_pt(weights[1, 3, 0])42 dut.i_weight_0_2_0 <= fix_pt(weights[2, 0, 0])43 dut.i_weight_0_2_1 <= fix_pt(weights[2, 1, 0])44 dut.i_weight_0_2_2 <= fix_pt(weights[2, 2, 0])45 dut.i_weight_0_2_3 <= fix_pt(weights[2, 3, 0])46 dut.i_weight_0_3_0 <= fix_pt(weights[3, 0, 0])47 dut.i_weight_0_3_1 <= fix_pt(weights[3, 1, 0])48 dut.i_weight_0_3_2 <= fix_pt(weights[3, 2, 0])49 dut.i_weight_0_3_3 <= fix_pt(weights[3, 3, 0])50 dut.i_weight_1_0_0 <= fix_pt(weights[0, 0, 1])51 dut.i_weight_1_0_1 <= fix_pt(weights[0, 1, 1])52 dut.i_weight_1_0_2 <= fix_pt(weights[0, 2, 1])53 dut.i_weight_1_0_3 <= fix_pt(weights[0, 3, 1])54 dut.i_weight_1_1_0 <= fix_pt(weights[1, 0, 1])55 dut.i_weight_1_1_1 <= fix_pt(weights[1, 1, 1])56 dut.i_weight_1_1_2 <= fix_pt(weights[1, 2, 1])57 dut.i_weight_1_1_3 <= fix_pt(weights[1, 3, 1])58 dut.i_weight_1_2_0 <= fix_pt(weights[2, 0, 1])59 dut.i_weight_1_2_1 <= fix_pt(weights[2, 1, 1])60 dut.i_weight_1_2_2 <= fix_pt(weights[2, 2, 1])61 dut.i_weight_1_2_3 <= fix_pt(weights[2, 3, 1])62 dut.i_weight_1_3_0 <= fix_pt(weights[3, 0, 1])63 dut.i_weight_1_3_1 <= fix_pt(weights[3, 1, 1])64 dut.i_weight_1_3_2 <= fix_pt(weights[3, 2, 1])65 dut.i_weight_1_3_3 <= fix_pt(weights[3, 3, 1])66 dut.i_weight_2_0_0 <= fix_pt(weights[0, 0, 2])67 dut.i_weight_2_0_1 <= fix_pt(weights[0, 1, 2])68 dut.i_weight_2_0_2 <= fix_pt(weights[0, 2, 2])69 dut.i_weight_2_0_3 <= fix_pt(weights[0, 3, 2])70 dut.i_weight_2_1_0 <= fix_pt(weights[1, 0, 2])71 dut.i_weight_2_1_1 <= fix_pt(weights[1, 1, 2])72 dut.i_weight_2_1_2 <= fix_pt(weights[1, 2, 2])73 dut.i_weight_2_1_3 <= fix_pt(weights[1, 3, 2])74 dut.i_weight_2_2_0 <= fix_pt(weights[2, 0, 2])75 dut.i_weight_2_2_1 <= fix_pt(weights[2, 1, 2])76 dut.i_weight_2_2_2 <= fix_pt(weights[2, 2, 2])77 dut.i_weight_2_2_3 <= fix_pt(weights[2, 3, 2])78 dut.i_weight_2_3_0 <= fix_pt(weights[3, 0, 2])79 dut.i_weight_2_3_1 <= fix_pt(weights[3, 1, 2])80 dut.i_weight_2_3_2 <= fix_pt(weights[3, 2, 2])81 dut.i_weight_2_3_3 <= fix_pt(weights[3, 3, 2])82 dut.i_weight_3_0_0 <= fix_pt(weights[0, 0, 3])83 dut.i_weight_3_0_1 <= fix_pt(weights[0, 1, 3])84 dut.i_weight_3_0_2 <= fix_pt(weights[0, 2, 3])85 dut.i_weight_3_0_3 <= fix_pt(weights[0, 3, 3])86 dut.i_weight_3_1_0 <= fix_pt(weights[1, 0, 3])87 dut.i_weight_3_1_1 <= fix_pt(weights[1, 1, 3])88 dut.i_weight_3_1_2 <= fix_pt(weights[1, 2, 3])89 dut.i_weight_3_1_3 <= fix_pt(weights[1, 3, 3])90 dut.i_weight_3_2_0 <= fix_pt(weights[2, 0, 3])91 dut.i_weight_3_2_1 <= fix_pt(weights[2, 1, 3])92 dut.i_weight_3_2_2 <= fix_pt(weights[2, 2, 3])93 dut.i_weight_3_2_3 <= fix_pt(weights[2, 3, 3])94 dut.i_weight_3_3_0 <= fix_pt(weights[3, 0, 3])95 dut.i_weight_3_3_1 <= fix_pt(weights[3, 1, 3])96 dut.i_weight_3_3_2 <= fix_pt(weights[3, 2, 3])97 dut.i_weight_3_3_3 <= fix_pt(weights[3, 3, 3])98 dut.i_weight_4_0_0 <= fix_pt(weights[0, 0, 4])99 dut.i_weight_4_0_1 <= fix_pt(weights[0, 1, 4])100 dut.i_weight_4_0_2 <= fix_pt(weights[0, 2, 4])101 dut.i_weight_4_0_3 <= fix_pt(weights[0, 3, 4])102 dut.i_weight_4_1_0 <= fix_pt(weights[1, 0, 4])103 dut.i_weight_4_1_1 <= fix_pt(weights[1, 1, 4])104 dut.i_weight_4_1_2 <= fix_pt(weights[1, 2, 4])105 dut.i_weight_4_1_3 <= fix_pt(weights[1, 3, 4])106 dut.i_weight_4_2_0 <= fix_pt(weights[2, 0, 4])107 dut.i_weight_4_2_1 <= fix_pt(weights[2, 1, 4])108 dut.i_weight_4_2_2 <= fix_pt(weights[2, 2, 4])109 dut.i_weight_4_2_3 <= fix_pt(weights[2, 3, 4])110 dut.i_weight_4_3_0 <= fix_pt(weights[3, 0, 4])111 dut.i_weight_4_3_1 <= fix_pt(weights[3, 1, 4])112 dut.i_weight_4_3_2 <= fix_pt(weights[3, 2, 4])113 dut.i_weight_4_3_3 <= fix_pt(weights[3, 3, 4])114 dut.i_weight_5_0_0 <= fix_pt(weights[0, 0, 5])115 dut.i_weight_5_0_1 <= fix_pt(weights[0, 1, 5])116 dut.i_weight_5_0_2 <= fix_pt(weights[0, 2, 5])117 dut.i_weight_5_0_3 <= fix_pt(weights[0, 3, 5])118 dut.i_weight_5_1_0 <= fix_pt(weights[1, 0, 5])119 dut.i_weight_5_1_1 <= fix_pt(weights[1, 1, 5])120 dut.i_weight_5_1_2 <= fix_pt(weights[1, 2, 5])121 dut.i_weight_5_1_3 <= fix_pt(weights[1, 3, 5])122 dut.i_weight_5_2_0 <= fix_pt(weights[2, 0, 5])123 dut.i_weight_5_2_1 <= fix_pt(weights[2, 1, 5])124 dut.i_weight_5_2_2 <= fix_pt(weights[2, 2, 5])125 dut.i_weight_5_2_3 <= fix_pt(weights[2, 3, 5])126 dut.i_weight_5_3_0 <= fix_pt(weights[3, 0, 5])127 dut.i_weight_5_3_1 <= fix_pt(weights[3, 1, 5])128 dut.i_weight_5_3_2 <= fix_pt(weights[3, 2, 5])129 dut.i_weight_5_3_3 <= fix_pt(weights[3, 3, 5])130 dut.i_weight_6_0_0 <= fix_pt(weights[0, 0, 6])131 dut.i_weight_6_0_1 <= fix_pt(weights[0, 1, 6])132 dut.i_weight_6_0_2 <= fix_pt(weights[0, 2, 6])133 dut.i_weight_6_0_3 <= fix_pt(weights[0, 3, 6])134 dut.i_weight_6_1_0 <= fix_pt(weights[1, 0, 6])135 dut.i_weight_6_1_1 <= fix_pt(weights[1, 1, 6])136 dut.i_weight_6_1_2 <= fix_pt(weights[1, 2, 6])137 dut.i_weight_6_1_3 <= fix_pt(weights[1, 3, 6])138 dut.i_weight_6_2_0 <= fix_pt(weights[2, 0, 6])139 dut.i_weight_6_2_1 <= fix_pt(weights[2, 1, 6])140 dut.i_weight_6_2_2 <= fix_pt(weights[2, 2, 6])141 dut.i_weight_6_2_3 <= fix_pt(weights[2, 3, 6])142 dut.i_weight_6_3_0 <= fix_pt(weights[3, 0, 6])143 dut.i_weight_6_3_1 <= fix_pt(weights[3, 1, 6])144 dut.i_weight_6_3_2 <= fix_pt(weights[3, 2, 6])145 dut.i_weight_6_3_3 <= fix_pt(weights[3, 3, 6])146 dut.i_weight_7_0_0 <= fix_pt(weights[0, 0, 7])147 dut.i_weight_7_0_1 <= fix_pt(weights[0, 1, 7])148 dut.i_weight_7_0_2 <= fix_pt(weights[0, 2, 7])149 dut.i_weight_7_0_3 <= fix_pt(weights[0, 3, 7])150 dut.i_weight_7_1_0 <= fix_pt(weights[1, 0, 7])151 dut.i_weight_7_1_1 <= fix_pt(weights[1, 1, 7])152 dut.i_weight_7_1_2 <= fix_pt(weights[1, 2, 7])153 dut.i_weight_7_1_3 <= fix_pt(weights[1, 3, 7])154 dut.i_weight_7_2_0 <= fix_pt(weights[2, 0, 7])155 dut.i_weight_7_2_1 <= fix_pt(weights[2, 1, 7])156 dut.i_weight_7_2_2 <= fix_pt(weights[2, 2, 7])157 dut.i_weight_7_2_3 <= fix_pt(weights[2, 3, 7])158 dut.i_weight_7_3_0 <= fix_pt(weights[3, 0, 7])159 dut.i_weight_7_3_1 <= fix_pt(weights[3, 1, 7])160 dut.i_weight_7_3_2 <= fix_pt(weights[3, 2, 7])161 dut.i_weight_7_3_3 <= fix_pt(weights[3, 3, 7])162 dut.i_weight_8_0_0 <= fix_pt(weights[0, 0, 8])163 dut.i_weight_8_0_1 <= fix_pt(weights[0, 1, 8])164 dut.i_weight_8_0_2 <= fix_pt(weights[0, 2, 8])165 dut.i_weight_8_0_3 <= fix_pt(weights[0, 3, 8])166 dut.i_weight_8_1_0 <= fix_pt(weights[1, 0, 8])167 dut.i_weight_8_1_1 <= fix_pt(weights[1, 1, 8])168 dut.i_weight_8_1_2 <= fix_pt(weights[1, 2, 8])169 dut.i_weight_8_1_3 <= fix_pt(weights[1, 3, 8])170 dut.i_weight_8_2_0 <= fix_pt(weights[2, 0, 8])171 dut.i_weight_8_2_1 <= fix_pt(weights[2, 1, 8])172 dut.i_weight_8_2_2 <= fix_pt(weights[2, 2, 8])173 dut.i_weight_8_2_3 <= fix_pt(weights[2, 3, 8])174 dut.i_weight_8_3_0 <= fix_pt(weights[3, 0, 8])175 dut.i_weight_8_3_1 <= fix_pt(weights[3, 1, 8])176 dut.i_weight_8_3_2 <= fix_pt(weights[3, 2, 8])177 dut.i_weight_8_3_3 <= fix_pt(weights[3, 3, 8])178 dut.i_weight_9_0_0 <= fix_pt(weights[0, 0, 9])179 dut.i_weight_9_0_1 <= fix_pt(weights[0, 1, 9])180 dut.i_weight_9_0_2 <= fix_pt(weights[0, 2, 9])181 dut.i_weight_9_0_3 <= fix_pt(weights[0, 3, 9])182 dut.i_weight_9_1_0 <= fix_pt(weights[1, 0, 9])183 dut.i_weight_9_1_1 <= fix_pt(weights[1, 1, 9])184 dut.i_weight_9_1_2 <= fix_pt(weights[1, 2, 9])185 dut.i_weight_9_1_3 <= fix_pt(weights[1, 3, 9])186 dut.i_weight_9_2_0 <= fix_pt(weights[2, 0, 9])187 dut.i_weight_9_2_1 <= fix_pt(weights[2, 1, 9])188 dut.i_weight_9_2_2 <= fix_pt(weights[2, 2, 9])189 dut.i_weight_9_2_3 <= fix_pt(weights[2, 3, 9])190 dut.i_weight_9_3_0 <= fix_pt(weights[3, 0, 9])191 dut.i_weight_9_3_1 <= fix_pt(weights[3, 1, 9])192 dut.i_weight_9_3_2 <= fix_pt(weights[3, 2, 9])193 dut.i_weight_9_3_3 <= fix_pt(weights[3, 3, 9])194 dut.i_weight_10_0_0 <= fix_pt(weights[0, 0, 10])195 dut.i_weight_10_0_1 <= fix_pt(weights[0, 1, 10])196 dut.i_weight_10_0_2 <= fix_pt(weights[0, 2, 10])197 dut.i_weight_10_0_3 <= fix_pt(weights[0, 3, 10])198 dut.i_weight_10_1_0 <= fix_pt(weights[1, 0, 10])199 dut.i_weight_10_1_1 <= fix_pt(weights[1, 1, 10])200 dut.i_weight_10_1_2 <= fix_pt(weights[1, 2, 10])201 dut.i_weight_10_1_3 <= fix_pt(weights[1, 3, 10])202 dut.i_weight_10_2_0 <= fix_pt(weights[2, 0, 10])203 dut.i_weight_10_2_1 <= fix_pt(weights[2, 1, 10])204 dut.i_weight_10_2_2 <= fix_pt(weights[2, 2, 10])205 dut.i_weight_10_2_3 <= fix_pt(weights[2, 3, 10])206 dut.i_weight_10_3_0 <= fix_pt(weights[3, 0, 10])207 dut.i_weight_10_3_1 <= fix_pt(weights[3, 1, 10])208 dut.i_weight_10_3_2 <= fix_pt(weights[3, 2, 10])209 dut.i_weight_10_3_3 <= fix_pt(weights[3, 3, 10])210 dut.i_weight_11_0_0 <= fix_pt(weights[0, 0, 11])211 dut.i_weight_11_0_1 <= fix_pt(weights[0, 1, 11])212 dut.i_weight_11_0_2 <= fix_pt(weights[0, 2, 11])213 dut.i_weight_11_0_3 <= fix_pt(weights[0, 3, 11])214 dut.i_weight_11_1_0 <= fix_pt(weights[1, 0, 11])215 dut.i_weight_11_1_1 <= fix_pt(weights[1, 1, 11])216 dut.i_weight_11_1_2 <= fix_pt(weights[1, 2, 11])217 dut.i_weight_11_1_3 <= fix_pt(weights[1, 3, 11])218 dut.i_weight_11_2_0 <= fix_pt(weights[2, 0, 11])219 dut.i_weight_11_2_1 <= fix_pt(weights[2, 1, 11])220 dut.i_weight_11_2_2 <= fix_pt(weights[2, 2, 11])221 dut.i_weight_11_2_3 <= fix_pt(weights[2, 3, 11])222 dut.i_weight_11_3_0 <= fix_pt(weights[3, 0, 11])223 dut.i_weight_11_3_1 <= fix_pt(weights[3, 1, 11])224 dut.i_weight_11_3_2 <= fix_pt(weights[3, 2, 11])225 dut.i_weight_11_3_3 <= fix_pt(weights[3, 3, 11])226 dut.i_weight_12_0_0 <= fix_pt(weights[0, 0, 12])227 dut.i_weight_12_0_1 <= fix_pt(weights[0, 1, 12])228 dut.i_weight_12_0_2 <= fix_pt(weights[0, 2, 12])229 dut.i_weight_12_0_3 <= fix_pt(weights[0, 3, 12])230 dut.i_weight_12_1_0 <= fix_pt(weights[1, 0, 12])231 dut.i_weight_12_1_1 <= fix_pt(weights[1, 1, 12])232 dut.i_weight_12_1_2 <= fix_pt(weights[1, 2, 12])233 dut.i_weight_12_1_3 <= fix_pt(weights[1, 3, 12])234 dut.i_weight_12_2_0 <= fix_pt(weights[2, 0, 12])235 dut.i_weight_12_2_1 <= fix_pt(weights[2, 1, 12])236 dut.i_weight_12_2_2 <= fix_pt(weights[2, 2, 12])237 dut.i_weight_12_2_3 <= fix_pt(weights[2, 3, 12])238 dut.i_weight_12_3_0 <= fix_pt(weights[3, 0, 12])239 dut.i_weight_12_3_1 <= fix_pt(weights[3, 1, 12])240 dut.i_weight_12_3_2 <= fix_pt(weights[3, 2, 12])241 dut.i_weight_12_3_3 <= fix_pt(weights[3, 3, 12])242 dut.i_weight_13_0_0 <= fix_pt(weights[0, 0, 13])243 dut.i_weight_13_0_1 <= fix_pt(weights[0, 1, 13])244 dut.i_weight_13_0_2 <= fix_pt(weights[0, 2, 13])245 dut.i_weight_13_0_3 <= fix_pt(weights[0, 3, 13])246 dut.i_weight_13_1_0 <= fix_pt(weights[1, 0, 13])247 dut.i_weight_13_1_1 <= fix_pt(weights[1, 1, 13])248 dut.i_weight_13_1_2 <= fix_pt(weights[1, 2, 13])249 dut.i_weight_13_1_3 <= fix_pt(weights[1, 3, 13])250 dut.i_weight_13_2_0 <= fix_pt(weights[2, 0, 13])251 dut.i_weight_13_2_1 <= fix_pt(weights[2, 1, 13])252 dut.i_weight_13_2_2 <= fix_pt(weights[2, 2, 13])253 dut.i_weight_13_2_3 <= fix_pt(weights[2, 3, 13])254 dut.i_weight_13_3_0 <= fix_pt(weights[3, 0, 13])255 dut.i_weight_13_3_1 <= fix_pt(weights[3, 1, 13])256 dut.i_weight_13_3_2 <= fix_pt(weights[3, 2, 13])257 dut.i_weight_13_3_3 <= fix_pt(weights[3, 3, 13])258 dut.i_weight_14_0_0 <= fix_pt(weights[0, 0, 14])259 dut.i_weight_14_0_1 <= fix_pt(weights[0, 1, 14])260 dut.i_weight_14_0_2 <= fix_pt(weights[0, 2, 14])261 dut.i_weight_14_0_3 <= fix_pt(weights[0, 3, 14])262 dut.i_weight_14_1_0 <= fix_pt(weights[1, 0, 14])263 dut.i_weight_14_1_1 <= fix_pt(weights[1, 1, 14])264 dut.i_weight_14_1_2 <= fix_pt(weights[1, 2, 14])265 dut.i_weight_14_1_3 <= fix_pt(weights[1, 3, 14])266 dut.i_weight_14_2_0 <= fix_pt(weights[2, 0, 14])267 dut.i_weight_14_2_1 <= fix_pt(weights[2, 1, 14])268 dut.i_weight_14_2_2 <= fix_pt(weights[2, 2, 14])269 dut.i_weight_14_2_3 <= fix_pt(weights[2, 3, 14])270 dut.i_weight_14_3_0 <= fix_pt(weights[3, 0, 14])271 dut.i_weight_14_3_1 <= fix_pt(weights[3, 1, 14])272 dut.i_weight_14_3_2 <= fix_pt(weights[3, 2, 14])273 dut.i_weight_14_3_3 <= fix_pt(weights[3, 3, 14])274 dut.i_weight_15_0_0 <= fix_pt(weights[0, 0, 15])275 dut.i_weight_15_0_1 <= fix_pt(weights[0, 1, 15])276 dut.i_weight_15_0_2 <= fix_pt(weights[0, 2, 15])277 dut.i_weight_15_0_3 <= fix_pt(weights[0, 3, 15])278 dut.i_weight_15_1_0 <= fix_pt(weights[1, 0, 15])279 dut.i_weight_15_1_1 <= fix_pt(weights[1, 1, 15])280 dut.i_weight_15_1_2 <= fix_pt(weights[1, 2, 15])281 dut.i_weight_15_1_3 <= fix_pt(weights[1, 3, 15])282 dut.i_weight_15_2_0 <= fix_pt(weights[2, 0, 15])283 dut.i_weight_15_2_1 <= fix_pt(weights[2, 1, 15])284 dut.i_weight_15_2_2 <= fix_pt(weights[2, 2, 15])285 dut.i_weight_15_2_3 <= fix_pt(weights[2, 3, 15])286 dut.i_weight_15_3_0 <= fix_pt(weights[3, 0, 15])287 dut.i_weight_15_3_1 <= fix_pt(weights[3, 1, 15])288 dut.i_weight_15_3_2 <= fix_pt(weights[3, 2, 15])289 dut.i_weight_15_3_3 <= fix_pt(weights[3, 3, 15])290 dut.i_weight_16_0_0 <= fix_pt(weights[0, 0, 16])291 dut.i_weight_16_0_1 <= fix_pt(weights[0, 1, 16])292 dut.i_weight_16_0_2 <= fix_pt(weights[0, 2, 16])293 dut.i_weight_16_0_3 <= fix_pt(weights[0, 3, 16])294 dut.i_weight_16_1_0 <= fix_pt(weights[1, 0, 16])295 dut.i_weight_16_1_1 <= fix_pt(weights[1, 1, 16])296 dut.i_weight_16_1_2 <= fix_pt(weights[1, 2, 16])297 dut.i_weight_16_1_3 <= fix_pt(weights[1, 3, 16])298 dut.i_weight_16_2_0 <= fix_pt(weights[2, 0, 16])299 dut.i_weight_16_2_1 <= fix_pt(weights[2, 1, 16])300 dut.i_weight_16_2_2 <= fix_pt(weights[2, 2, 16])301 dut.i_weight_16_2_3 <= fix_pt(weights[2, 3, 16])302 dut.i_weight_16_3_0 <= fix_pt(weights[3, 0, 16])303 dut.i_weight_16_3_1 <= fix_pt(weights[3, 1, 16])304 dut.i_weight_16_3_2 <= fix_pt(weights[3, 2, 16])305 dut.i_weight_16_3_3 <= fix_pt(weights[3, 3, 16])306 dut.i_weight_17_0_0 <= fix_pt(weights[0, 0, 17])307 dut.i_weight_17_0_1 <= fix_pt(weights[0, 1, 17])308 dut.i_weight_17_0_2 <= fix_pt(weights[0, 2, 17])309 dut.i_weight_17_0_3 <= fix_pt(weights[0, 3, 17])310 dut.i_weight_17_1_0 <= fix_pt(weights[1, 0, 17])311 dut.i_weight_17_1_1 <= fix_pt(weights[1, 1, 17])312 dut.i_weight_17_1_2 <= fix_pt(weights[1, 2, 17])313 dut.i_weight_17_1_3 <= fix_pt(weights[1, 3, 17])314 dut.i_weight_17_2_0 <= fix_pt(weights[2, 0, 17])315 dut.i_weight_17_2_1 <= fix_pt(weights[2, 1, 17])316 dut.i_weight_17_2_2 <= fix_pt(weights[2, 2, 17])317 dut.i_weight_17_2_3 <= fix_pt(weights[2, 3, 17])318 dut.i_weight_17_3_0 <= fix_pt(weights[3, 0, 17])319 dut.i_weight_17_3_1 <= fix_pt(weights[3, 1, 17])320 dut.i_weight_17_3_2 <= fix_pt(weights[3, 2, 17])321 dut.i_weight_17_3_3 <= fix_pt(weights[3, 3, 17])322 dut.i_weight_18_0_0 <= fix_pt(weights[0, 0, 18])323 dut.i_weight_18_0_1 <= fix_pt(weights[0, 1, 18])324 dut.i_weight_18_0_2 <= fix_pt(weights[0, 2, 18])325 dut.i_weight_18_0_3 <= fix_pt(weights[0, 3, 18])326 dut.i_weight_18_1_0 <= fix_pt(weights[1, 0, 18])327 dut.i_weight_18_1_1 <= fix_pt(weights[1, 1, 18])328 dut.i_weight_18_1_2 <= fix_pt(weights[1, 2, 18])329 dut.i_weight_18_1_3 <= fix_pt(weights[1, 3, 18])330 dut.i_weight_18_2_0 <= fix_pt(weights[2, 0, 18])331 dut.i_weight_18_2_1 <= fix_pt(weights[2, 1, 18])332 dut.i_weight_18_2_2 <= fix_pt(weights[2, 2, 18])333 dut.i_weight_18_2_3 <= fix_pt(weights[2, 3, 18])334 dut.i_weight_18_3_0 <= fix_pt(weights[3, 0, 18])335 dut.i_weight_18_3_1 <= fix_pt(weights[3, 1, 18])336 dut.i_weight_18_3_2 <= fix_pt(weights[3, 2, 18])337 dut.i_weight_18_3_3 <= fix_pt(weights[3, 3, 18])338 dut.i_weight_19_0_0 <= fix_pt(weights[0, 0, 19])339 dut.i_weight_19_0_1 <= fix_pt(weights[0, 1, 19])340 dut.i_weight_19_0_2 <= fix_pt(weights[0, 2, 19])341 dut.i_weight_19_0_3 <= fix_pt(weights[0, 3, 19])342 dut.i_weight_19_1_0 <= fix_pt(weights[1, 0, 19])343 dut.i_weight_19_1_1 <= fix_pt(weights[1, 1, 19])344 dut.i_weight_19_1_2 <= fix_pt(weights[1, 2, 19])345 dut.i_weight_19_1_3 <= fix_pt(weights[1, 3, 19])346 dut.i_weight_19_2_0 <= fix_pt(weights[2, 0, 19])347 dut.i_weight_19_2_1 <= fix_pt(weights[2, 1, 19])348 dut.i_weight_19_2_2 <= fix_pt(weights[2, 2, 19])349 dut.i_weight_19_2_3 <= fix_pt(weights[2, 3, 19])350 dut.i_weight_19_3_0 <= fix_pt(weights[3, 0, 19])351 dut.i_weight_19_3_1 <= fix_pt(weights[3, 1, 19])352 dut.i_weight_19_3_2 <= fix_pt(weights[3, 2, 19])353 dut.i_weight_19_3_3 <= fix_pt(weights[3, 3, 19])354 time.sleep(10)355 # print("count is:",count)356 # print("count2 is:",count2)357 print("iter", iter)358 print("ii", ii)359 layer2[count, count2, 0] = fix2float(dut.o_output_0)360 layer2[count, count2, 1] = fix2float(dut.o_output_1)361 layer2[count, count2, 2] = fix2float(dut.o_output_2)362 layer2[count, count2, 3] = fix2float(dut.o_output_3)363 layer2[count, count2, 4] = fix2float(dut.o_output_4)364 layer2[count, count2, 5] = fix2float(dut.o_output_5)365 layer2[count, count2, 6] = fix2float(dut.o_output_6)366 layer2[count, count2, 7] = fix2float(dut.o_output_7)367 layer2[count, count2, 8] = fix2float(dut.o_output_8)368 layer2[count, count2, 9] = fix2float(dut.o_output_9)369 layer2[count, count2, 10] = fix2float(dut.o_output_10)370 layer2[count, count2, 11] = fix2float(dut.o_output_11)371 layer2[count, count2, 12] = fix2float(dut.o_output_12)372 layer2[count, count2, 13] = fix2float(dut.o_output_13)373 layer2[count, count2, 14] = fix2float(dut.o_output_14)374 layer2[count, count2, 15] = fix2float(dut.o_output_15)375 layer2[count, count2, 16] = fix2float(dut.o_output_16)376 layer2[count, count2, 17] = fix2float(dut.o_output_17)377 layer2[count, count2, 18] = fix2float(dut.o_output_18)...
__init__.py
Source:__init__.py
1import sys2from lib2to3 import refactor3# The following fixers are "safe": they convert Python 2 code to more4# modern Python 2 code. They should be uncontroversial to apply to most5# projects that are happy to drop support for Py2.5 and below. Applying6# them first will reduce the size of the patch set for the real porting.7lib2to3_fix_names_stage1 = set([8 'lib2to3.fixes.fix_apply',9 'lib2to3.fixes.fix_except',10 'lib2to3.fixes.fix_exec',11 'lib2to3.fixes.fix_exitfunc',12 'lib2to3.fixes.fix_funcattrs',13 'lib2to3.fixes.fix_has_key',14 'lib2to3.fixes.fix_idioms',15 # 'lib2to3.fixes.fix_import', # makes any implicit relative imports explicit. (Use with ``from __future__ import absolute_import)16 'lib2to3.fixes.fix_intern',17 'lib2to3.fixes.fix_isinstance',18 'lib2to3.fixes.fix_methodattrs',19 'lib2to3.fixes.fix_ne',20 # 'lib2to3.fixes.fix_next', # would replace ``next`` method names21 # with ``__next__``.22 'lib2to3.fixes.fix_numliterals', # turns 1L into 1, 0755 into 0o75523 'lib2to3.fixes.fix_paren',24 # 'lib2to3.fixes.fix_print', # see the libfuturize fixer that also25 # adds ``from __future__ import print_function``26 # 'lib2to3.fixes.fix_raise', # uses incompatible with_traceback() method on exceptions27 'lib2to3.fixes.fix_reduce', # reduce is available in functools on Py2.6/Py2.728 'lib2to3.fixes.fix_renames', # sys.maxint -> sys.maxsize29 # 'lib2to3.fixes.fix_set_literal', # this is unnecessary and breaks Py2.6 support30 'lib2to3.fixes.fix_repr',31 'lib2to3.fixes.fix_standarderror',32 'lib2to3.fixes.fix_sys_exc',33 'lib2to3.fixes.fix_throw',34 'lib2to3.fixes.fix_tuple_params',35 'lib2to3.fixes.fix_types',36 'lib2to3.fixes.fix_ws_comma', # can perhaps decrease readability: see issue #5837 'lib2to3.fixes.fix_xreadlines',38])39# The following fixers add a dependency on the ``future`` package on order to40# support Python 2:41lib2to3_fix_names_stage2 = set([42 # 'lib2to3.fixes.fix_buffer', # perhaps not safe. Test this.43 # 'lib2to3.fixes.fix_callable', # not needed in Py3.2+44 'lib2to3.fixes.fix_dict', # TODO: add support for utils.viewitems() etc. and move to stage245 # 'lib2to3.fixes.fix_execfile', # some problems: see issue #37.46 # We use a custom fixer instead (see below)47 # 'lib2to3.fixes.fix_future', # we don't want to remove __future__ imports48 'lib2to3.fixes.fix_getcwdu',49 # 'lib2to3.fixes.fix_imports', # called by libfuturize.fixes.fix_future_standard_library50 # 'lib2to3.fixes.fix_imports2', # we don't handle this yet (dbm)51 # 'lib2to3.fixes.fix_input', # Called conditionally by libfuturize.fixes.fix_input52 'lib2to3.fixes.fix_itertools',53 'lib2to3.fixes.fix_itertools_imports',54 'lib2to3.fixes.fix_filter',55 'lib2to3.fixes.fix_long',56 'lib2to3.fixes.fix_map',57 # 'lib2to3.fixes.fix_metaclass', # causes SyntaxError in Py2! Use the one from ``six`` instead58 'lib2to3.fixes.fix_next',59 'lib2to3.fixes.fix_nonzero', # TODO: cause this to import ``object`` and/or add a decorator for mapping __bool__ to __nonzero__60 'lib2to3.fixes.fix_operator', # we will need support for this by e.g. extending the Py2 operator module to provide those functions in Py361 'lib2to3.fixes.fix_raw_input',62 # 'lib2to3.fixes.fix_unicode', # strips off the u'' prefix, which removes a potentially helpful source of information for disambiguating unicode/byte strings63 # 'lib2to3.fixes.fix_urllib', # included in libfuturize.fix_future_standard_library_urllib64 # 'lib2to3.fixes.fix_xrange', # custom one because of a bug with Py3.3's lib2to365 'lib2to3.fixes.fix_zip',66])67libfuturize_fix_names_stage1 = set([68 'libfuturize.fixes.fix_absolute_import',69 'libfuturize.fixes.fix_next_call', # obj.next() -> next(obj). Unlike70 # lib2to3.fixes.fix_next, doesn't change71 # the ``next`` method to ``__next__``.72 'libfuturize.fixes.fix_print_with_import',73 'libfuturize.fixes.fix_raise',74 # 'libfuturize.fixes.fix_order___future__imports', # TODO: consolidate to a single line to simplify testing75])76libfuturize_fix_names_stage2 = set([77 'libfuturize.fixes.fix_basestring',78 # 'libfuturize.fixes.fix_add__future__imports_except_unicode_literals', # just in case79 'libfuturize.fixes.fix_cmp',80 'libfuturize.fixes.fix_division_safe',81 'libfuturize.fixes.fix_execfile',82 'libfuturize.fixes.fix_future_builtins',83 'libfuturize.fixes.fix_future_standard_library',84 'libfuturize.fixes.fix_future_standard_library_urllib',85 'libfuturize.fixes.fix_input',86 'libfuturize.fixes.fix_metaclass',87 'libpasteurize.fixes.fix_newstyle',88 'libfuturize.fixes.fix_object',89 # 'libfuturize.fixes.fix_order___future__imports', # TODO: consolidate to a single line to simplify testing90 'libfuturize.fixes.fix_unicode_keep_u',91 # 'libfuturize.fixes.fix_unicode_literals_import',92 'libfuturize.fixes.fix_xrange_with_import', # custom one because of a bug with Py3.3's lib2to3...
isacfix.gypi
Source:isacfix.gypi
1# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.2#3# Use of this source code is governed by a BSD-style license4# that can be found in the LICENSE file in the root of the source5# tree. An additional intellectual property rights grant can be found6# in the file PATENTS. All contributing project authors may7# be found in the AUTHORS file in the root of the source tree.8{9 'includes': [10 '../../../../build/common.gypi',11 ],12 'targets': [13 {14 'target_name': 'isac_fix',15 'type': 'static_library',16 'dependencies': [17 '<(webrtc_root)/common_audio/common_audio.gyp:common_audio',18 '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',19 'isac_common',20 ],21 'include_dirs': [22 'fix/include',23 '<(webrtc_root)'24 ],25 'direct_dependent_settings': {26 'include_dirs': [27 'fix/include',28 '<(webrtc_root)',29 ],30 },31 'sources': [32 'fix/include/audio_decoder_isacfix.h',33 'fix/include/audio_encoder_isacfix.h',34 'fix/include/isacfix.h',35 'fix/source/arith_routines.c',36 'fix/source/arith_routines_hist.c',37 'fix/source/arith_routines_logist.c',38 'fix/source/audio_decoder_isacfix.cc',39 'fix/source/audio_encoder_isacfix.cc',40 'fix/source/bandwidth_estimator.c',41 'fix/source/decode.c',42 'fix/source/decode_bwe.c',43 'fix/source/decode_plc.c',44 'fix/source/encode.c',45 'fix/source/entropy_coding.c',46 'fix/source/fft.c',47 'fix/source/filterbank_tables.c',48 'fix/source/filterbanks.c',49 'fix/source/filters.c',50 'fix/source/initialize.c',51 'fix/source/isac_fix_type.h',52 'fix/source/isacfix.c',53 'fix/source/lattice.c',54 'fix/source/lattice_c.c',55 'fix/source/lpc_masking_model.c',56 'fix/source/lpc_tables.c',57 'fix/source/pitch_estimator.c',58 'fix/source/pitch_estimator_c.c',59 'fix/source/pitch_filter.c',60 'fix/source/pitch_filter_c.c',61 'fix/source/pitch_gain_tables.c',62 'fix/source/pitch_lag_tables.c',63 'fix/source/spectrum_ar_model_tables.c',64 'fix/source/transform.c',65 'fix/source/transform_tables.c',66 'fix/source/arith_routins.h',67 'fix/source/bandwidth_estimator.h',68 'fix/source/codec.h',69 'fix/source/entropy_coding.h',70 'fix/source/fft.h',71 'fix/source/filterbank_tables.h',72 'fix/source/lpc_masking_model.h',73 'fix/source/lpc_tables.h',74 'fix/source/pitch_estimator.h',75 'fix/source/pitch_gain_tables.h',76 'fix/source/pitch_lag_tables.h',77 'fix/source/settings.h',78 'fix/source/spectrum_ar_model_tables.h',79 'fix/source/structs.h',80 ],81 'conditions': [82 ['target_arch=="arm" and arm_version>=7', {83 'sources': [84 'fix/source/lattice_armv7.S',85 'fix/source/pitch_filter_armv6.S',86 ],87 'sources!': [88 'fix/source/lattice_c.c',89 'fix/source/pitch_filter_c.c',90 ],91 }],92 ['build_with_neon==1', {93 'dependencies': ['isac_neon', ],94 }],95 ['target_arch=="mipsel" and mips_arch_variant!="r6"', {96 'sources': [97 'fix/source/entropy_coding_mips.c',98 'fix/source/filters_mips.c',99 'fix/source/lattice_mips.c',100 'fix/source/pitch_estimator_mips.c',101 'fix/source/transform_mips.c',102 ],103 'sources!': [104 'fix/source/lattice_c.c',105 'fix/source/pitch_estimator_c.c',106 ],107 'conditions': [108 ['mips_dsp_rev>0', {109 'sources': [110 'fix/source/filterbanks_mips.c',111 ],112 }],113 ['mips_dsp_rev>1', {114 'sources': [115 'fix/source/lpc_masking_model_mips.c',116 'fix/source/pitch_filter_mips.c',117 ],118 'sources!': [119 'fix/source/pitch_filter_c.c',120 ],121 }],122 ],123 }],124 ],125 },126 ],127 'conditions': [128 ['build_with_neon==1', {129 'targets': [130 {131 'target_name': 'isac_neon',132 'type': 'static_library',133 'includes': ['../../../../build/arm_neon.gypi',],134 'dependencies': [135 '<(webrtc_root)/common_audio/common_audio.gyp:common_audio',136 ],137 'sources': [138 'fix/source/entropy_coding_neon.c',139 'fix/source/filterbanks_neon.c',140 'fix/source/filters_neon.c',141 'fix/source/lattice_neon.c',142 'fix/source/transform_neon.c',143 ],144 },145 ],146 }],147 ],...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!