How to use _get_status method in avocado

Best Python code snippet using avocado_python

tomasulo.py

Source:tomasulo.py Github

copy

Full Screen

...55 self.ALC = 156 self.index = 057 def _get_unit_name(self):58 return self.name59 def _get_status(self):60 return bool(self.busy)61 def _get_op(self):62 return self.op63 def _get_Vj(self):64 return self.Vj65 def _get_Vk(self):66 return self.Vk67 def _get_Qj(self):68 return self.Qj69 def _get_Qk(self):70 return self.Qk71 def _get_addr(self):72 return int(self.Addr)73 def _get_ALC(self):74 return int(self.ALC)75 def _get_index(self):76 return int(self.index)77 def _set_status(self,flag):78 self.busy = flag79 def _set_op(self,op):80 self.op = op81 def _set_Vj(self,reg):82 self.Vj = reg83 def _set_Vk(self,reg):84 self.Vk = reg85 def _set_Qj(self,fun_unit):86 self.Qj = fun_unit87 def _set_Qk(self,fun_unit):88 self.Qk = fun_unit89 def _set_addr(self,addr):90 self.Addr = addr91 def _set_ALC(self,clock):92 self.ALC = clock93 def _ALC_DEC(self):94 self.ALC -= 195 def _set_index(self,index):96 self.index = index97 def _reset(self):98 # self.time = 099 # self.name = " "100 self.busy = False101 self.op = " "102 self.Vj = " "103 self.Vk = " "104 self.Qj = "None"105 self.Qk = "None"106 self.Addr = 0107 self.ALC = 1 # additional local controler108 self.index = 0109 def _set(self,inst):110 pass111 def _print(self):112 print("ALC:",self.ALC," RS ",self.name,": ",self.busy,"op:",self.op," Vj:",self.Vj," Vk:",self.Vk," Qj:",self.Qj," Qk:",self.Qk)113class register_result_status:114 def __init__(self):115 self.F0 = "Invalid"116 self.F1 = "Invalid"117 self.F2 = "Invalid"118 self.F3 = "Invalid"119 self.F4 = "Invalid"120 self.F5 = "Invalid"121 self.F6 = "Invalid"122 self.F7 = "Invalid"123 self.F8 = "Invalid"124 self.F9 = "Invalid"125 self.F10 = "Invalid"126 self.F11 = "Invalid"127 self.F12 = "Invalid"128 self.F13 = "Invalid"129 self.F14 = "Invalid"130 self.F15 = "Invalid"131 def _get_all_registers(self):132 result = []133 if (self.F0 == "Invalid"):134 result.append(" ")135 else:136 result.append((self.F0))137 if (self.F1 == "Invalid"):138 result.append(" ")139 else:140 result.append((self.F1))141 if (self.F2 == "Invalid"):142 result.append(" ")143 else:144 result.append((self.F2))145 if (self.F3 == "Invalid"):146 result.append(" ")147 else:148 result.append((self.F3))149 if (self.F4 == "Invalid"):150 result.append(" ")151 else:152 result.append((self.F4))153 if (self.F5 == "Invalid"):154 result.append(" ")155 else:156 result.append((self.F5))157 if (self.F6 == "Invalid"):158 result.append(" ")159 else:160 result.append((self.F6))161 if (self.F7 == "Invalid"):162 result.append(" ")163 else:164 result.append((self.F7))165 if (self.F8 == "Invalid"):166 result.append(" ")167 else:168 result.append((self.F8))169 if (self.F9 == "Invalid"):170 result.append(" ")171 else:172 result.append((self.F9))173 if (self.F10 == "Invalid"):174 result.append(" ")175 else:176 result.append((self.F10))177 if (self.F11 == "Invalid"):178 result.append(" ")179 else:180 result.append((self.F11))181 if (self.F12 == "Invalid"):182 result.append(" ")183 else:184 result.append((self.F12))185 if (self.F13 == "Invalid"):186 result.append(" ")187 else:188 result.append((self.F13))189 if (self.F14 == "Invalid"):190 result.append(" ")191 else:192 result.append((self.F14))193 if (self.F14 == "Invalid"):194 result.append(" ")195 else:196 result.append((self.F14))197 return result198 199 def _get_function_unit(self,source_reg):200 if(source_reg == "F0"):201 return self.F0202 elif(source_reg == "F1"):203 return self.F1204 elif(source_reg == "F2"):205 return self.F2206 elif(source_reg == "F3"):207 return self.F3208 elif(source_reg == "F4"):209 return self.F4210 elif(source_reg == "F5"):211 return self.F5212 elif(source_reg == "F6"):213 return self.F6214 elif(source_reg == "F7"):215 return self.F7216 elif(source_reg == "F8"):217 return self.F8218 elif(source_reg == "F9"):219 return self.F9220 elif(source_reg == "F10"):221 return self.F10222 elif(source_reg == "F11"):223 return self.F11224 elif(source_reg == "F12"):225 return self.F12226 elif(source_reg == "F13"):227 return self.F13228 elif(source_reg == "F14"):229 return self.F14230 elif(source_reg == "F15"):231 return self.F15232 else:233 print("")234 235 236 def _set_function_unit(self,reg,function_unit):237 if(reg == "F0"):238 self.F0 = function_unit239 elif(reg == "F1"):240 self.F1 = function_unit241 elif(reg == "F2"):242 self.F2 = function_unit243 elif(reg == "F3"):244 self.F3 = function_unit245 elif(reg == "F4"):246 self.F4 = function_unit247 elif(reg == "F5"):248 self.F5 = function_unit249 elif(reg == "F6"):250 self.F6 = function_unit251 elif(reg == "F7"):252 self.F7 = function_unit253 elif(reg == "F8"):254 self.F8 = function_unit255 elif(reg == "F9"):256 self.F9 = function_unit257 elif(reg == "F10"):258 self.F10 = function_unit259 elif(reg == "F11"):260 self.F11 = function_unit261 elif(reg == "F12"):262 self.F12 = function_unit263 elif(reg == "F13"):264 self.F13 = function_unit265 elif(reg == "F14"):266 self.F14 = function_unit267 elif(reg == "F15"):268 self.F15 = function_unit269 else:270 print("error:the register is not defined!")271 def _reset_function_unit(self,fun_unit):272 if(self.F0 == fun_unit):273 self.F0 = "Invalid"274 if(self.F1 == fun_unit):275 self.F1 = "Invalid"276 if(self.F2 == fun_unit):277 self.F2 = "Invalid"278 if(self.F3 == fun_unit):279 self.F3 = "Invalid"280 if(self.F4 == fun_unit):281 self.F4 = "Invalid"282 if(self.F5 == fun_unit):283 self.F5 = "Invalid"284 if(self.F6 == fun_unit):285 self.F6 = "Invalid"286 if(self.F7 == fun_unit):287 self.F7 = "Invalid"288 if(self.F8 == fun_unit):289 self.F8 = "Invalid"290 if(self.F9 == fun_unit):291 self.F9 = "Invalid"292 if(self.F10 == fun_unit):293 self.F10 = "Invalid"294 if(self.F11 == fun_unit):295 self.F11 = "Invalid"296 if(self.F12 == fun_unit):297 self.F12 = "Invalid"298 if(self.F13 == fun_unit):299 self.F13 = "Invalid"300 if(self.F14 == fun_unit):301 self.F14 = "Invalid"302 if(self.F15 == fun_unit):303 self.F15 = "Invalid"304 def _print(self):305 if(self.F0 != "Invalid"):306 print("F0:",self.F0)307 if (self.F1 != "Invalid"):308 print("F1:", self.F1)309 if (self.F2 != "Invalid"):310 print("F2:", self.F2)311 if (self.F3 != "Invalid"):312 print("F3:", self.F3)313 if (self.F4 != "Invalid"):314 print("F4:", self.F4)315 if (self.F5 != "Invalid"):316 print("F5:", self.F5)317 if (self.F6 != "Invalid"):318 print("F6:", self.F6)319 if (self.F7 != "Invalid"):320 print("F7:", self.F7)321 if (self.F8 != "Invalid"):322 print("F8:", self.F8)323 if (self.F9 != "Invalid"):324 print("F9:", self.F9)325 if (self.F10 != "Invalid"):326 print("F10:", self.F10)327 if (self.F11 != "Invalid"):328 print("F11:", self.F11)329 if (self.F12 != "Invalid"):330 print("F12:", self.F12)331 if (self.F13 != "Invalid"):332 print("F13:", self.F13)333 if (self.F14 != "Invalid"):334 print("F14:", self.F14)335 if (self.F15 != "Invalid"):336 print("F15:", self.F15)337class tomasulo:338 def __init__(self):339 self.clock = 0340 self.show_ptr = 0341 self.queue_ptr = 0342 self.all_inst_queue = []343 self.finish_tag = False344 self.RS_load1 = reservation_station("Load1")345 self.RS_load2 = reservation_station("Load2")346 self.RS_load3 = reservation_station("Load3")347 self.RS_Add1 = reservation_station("Add1")348 self.RS_Add2 = reservation_station("Add2")349 self.RS_Add3 = reservation_station("Add3")350 self.RS_Mult1 = reservation_station("Mult1")351 self.RS_Mult2 = reservation_station("Mult2")352 self.RS_Store1 = reservation_station("Store1")353 self.RS_Store2 = reservation_station("Store2")354 self.RS_Store3 = reservation_station("Store3")355 self.result_register_status = register_result_status()356 self.all_exec_state = []357 def _run(self):358 while(self.finish_tag == False):359 self._issue()360 self._exex()361 self._write()362 self._set_finish_tag()363 # self.all_exec_state.append()364 self._print()365 self._snap_shot()366 if(self.clock >= 60):367 break368 def _issue(self):369 self.clock += 1370 if(self.queue_ptr >= len(self.all_inst_queue)):371 return372 if(len(self.all_inst_queue) == 0):373 print("error,no instruction initialized in the queue.")374 return 375 temp_inst = self.all_inst_queue[self.queue_ptr]376 issue_tag,rs = self._structure_hazard_check(temp_inst)377 if(issue_tag == False):378 print("structure hazard detected")379 return380 elif(issue_tag == True):381 if(rs == None):382 print("this clock is for scalar:",temp_inst._get_op())383 self.all_inst_queue[self.queue_ptr]._set_status("Issue",self.clock)384 self.all_inst_queue[self.queue_ptr]._set_status("Execute", self.clock)385 self.all_inst_queue[self.queue_ptr]._set_status("WB", self.clock)386 self.queue_ptr += 1387 return388 else:389 rs._reset()390 self.all_inst_queue[self.queue_ptr]._set_status("Issue",self.clock)391 rs._set_index(self.queue_ptr)392 self._set_reservation_station(rs,temp_inst)393 self.queue_ptr += 1394 395 def _set_reservation_station(self,rs,inst):396 rs._set_status(True)397 rs._set_op(inst._get_op())398 if(inst._get_op() == "L.D"):399 rs._set_addr(inst._get_imm())400 self.result_register_status._set_function_unit(inst._get_rd(),rs._get_unit_name())401 rs._set_ALC(100)402 elif(inst._get_op() == "S.D"):403 # rs._set_ALC(100)404 rs._set_addr(inst._get_imm())405 if(self.result_register_status._get_function_unit(inst._get_rs2()) == "Invalid"):406 rs._set_Vk(inst._get_rs2())407 else:408 rs._set_Qk(self.result_register_status._get_function_unit(inst._get_rs2()))409 elif(inst._get_op() == "MUL.D"):410 rs._set_ALC(10)411 self.result_register_status._set_function_unit(inst._get_rd(),rs._get_unit_name())412 if(self.result_register_status._get_function_unit(inst._get_rs1()) == "Invalid"):413 rs._set_Vj(inst._get_rs1())414 else:415 rs._set_Qj(self.result_register_status._get_function_unit(inst._get_rs1()))416 417 if(self.result_register_status._get_function_unit(inst._get_rs2()) == "Invalid"):418 rs._set_Vk(inst._get_rs2())419 else:420 rs._set_Qk(self.result_register_status._get_function_unit(inst._get_rs2()))421 elif (inst._get_op() == "DIV.D"):422 rs._set_ALC(40)423 self.result_register_status._set_function_unit(inst._get_rd(), rs._get_unit_name())424 if (self.result_register_status._get_function_unit(inst._get_rs1()) == "Invalid"):425 rs._set_Vj(inst._get_rs1())426 else:427 rs._set_Qj(self.result_register_status._get_function_unit(inst._get_rs1()))428 if (self.result_register_status._get_function_unit(inst._get_rs2()) == "Invalid"):429 rs._set_Vk(inst._get_rs2())430 else:431 rs._set_Qk(self.result_register_status._get_function_unit(inst._get_rs2()))432 elif (inst._get_op() == "ADD.D" or inst._get_op() == "SUB.D"):433 rs._set_ALC(2)434 self.result_register_status._set_function_unit(inst._get_rd(), rs._get_unit_name())435 if (self.result_register_status._get_function_unit(inst._get_rs1()) == "Invalid"):436 rs._set_Vj(inst._get_rs1())437 else:438 rs._set_Qj(self.result_register_status._get_function_unit(inst._get_rs1()))439 if (self.result_register_status._get_function_unit(inst._get_rs2()) == "Invalid"):440 rs._set_Vk(inst._get_rs2())441 else:442 rs._set_Qk(self.result_register_status._get_function_unit(inst._get_rs2()))443 else:444 print("this clock the reservation stations are not changed!")445 446 def _structure_hazard_check(self,temp_inst):447 if(temp_inst._get_op() == "L.D"):448 if(self.RS_load1._get_status() == True and self.RS_load2._get_status() == True \449 and self.RS_load3._get_status() == True):450 return False,None451 else:452 if(self.RS_load1._get_status() == False):453 return True,self.RS_load1454 elif(self.RS_load2._get_status() == False):455 return True,self.RS_load2456 else:457 return True,self.RS_load3458 elif(temp_inst._get_op() == "MUL.D" or temp_inst._get_op() == "DIV.D"):459 if(self.RS_Mult1._get_status() == True and self.RS_Mult2._get_status() == True):460 return False,None461 else:462 if(self.RS_Mult1._get_status() == False):463 return True,self.RS_Mult1464 else:465 return True,self.RS_Mult2466 elif(temp_inst._get_op() == "S.D"):467 if(self.RS_Store1._get_status() == True and self.RS_Store2._get_status() == True \468 and self.RS_Store3._get_status() == True):469 return False,None470 else:471 if(self.RS_Store1._get_status() == False):472 return True,self.RS_Store1473 elif(self.RS_Store2._get_status() == False):474 return True,self.RS_Store2475 else:476 return True,self.RS_Store3477 elif(temp_inst._get_op() == "SUB.D" or temp_inst._get_op() == "ADD.D"):478 if(self.RS_Add1._get_status() == True and self.RS_Add2._get_status() == True \479 and self.RS_Add3._get_status() == True):480 return False,None481 else:482 if(self.RS_Add1._get_status() == False):483 return True,self.RS_Add1484 elif(self.RS_Add2._get_status() == False):485 return True,self.RS_Add2486 else:487 return True,self.RS_Add3488 elif(temp_inst._get_op() == "DADDUI" or temp_inst._get_op() == "BNE"):489 return True,None490 else:491 print("error,this instruction is not defined!") 492 493 def _exex(self):494 if(self.RS_Add1._get_status() == True):495 if(self.RS_Add1._get_Qj() == "None" and self.RS_Add1._get_Qk() == "None"):496 self.RS_Add1._ALC_DEC()497 if(self.RS_Add1._get_ALC() == 0):498 index = self.RS_Add1._get_index()499 self.all_inst_queue[index]._set_status("Execute",self.clock)500 if(self.RS_Add2._get_status() == True):501 if(self.RS_Add2._get_Qj() == "None" and self.RS_Add2._get_Qk() == "None"):502 self.RS_Add2._ALC_DEC()503 if(self.RS_Add2._get_ALC() == 0):504 index = self.RS_Add2._get_index()505 self.all_inst_queue[index]._set_status("Execute",self.clock)506 if(self.RS_Add3._get_status() == True):507 if(self.RS_Add3._get_Qj() == "None" and self.RS_Add3._get_Qk() == "None"):508 self.RS_Add3._ALC_DEC()509 if(self.RS_Add3._get_ALC() == 0):510 index = self.RS_Add3._get_index()511 self.all_inst_queue[index]._set_status("Execute",self.clock)512 if(self.RS_Mult1._get_status() == True):513 if(self.RS_Mult1._get_Qj() == "None" and self.RS_Mult1._get_Qk() == "None"):514 self.RS_Mult1._ALC_DEC()515 if(self.RS_Mult1._get_ALC() == 0):516 index = self.RS_Mult1._get_index()517 self.all_inst_queue[index]._set_status("Execute",self.clock)518 if(self.RS_Mult2._get_status() == True):519 if(self.RS_Mult2._get_Qj() == "None" and self.RS_Mult2._get_Qk() == "None"):520 self.RS_Mult2._ALC_DEC()521 if(self.RS_Mult2._get_ALC() == 0):522 index = self.RS_Mult2._get_index()523 self.all_inst_queue[index]._set_status("Execute",self.clock)524 if(self.RS_load1._get_status() == True):525 if (self.RS_load1._get_ALC() == 100):526 self.RS_load1._set_ALC(2)527 else:528 self.RS_load1._ALC_DEC()529 if(self.RS_load1._get_ALC() == 0):530 index = self.RS_load1._get_index()531 self.all_inst_queue[index]._set_status("Execute",self.clock)532 if(self.RS_load2._get_status() == True):533 if (self.RS_load2._get_ALC() == 100):534 self.RS_load2._set_ALC(2)535 else:536 self.RS_load2._ALC_DEC()537 if(self.RS_load2._get_ALC() == 0):538 index = self.RS_load2._get_index()539 self.all_inst_queue[index]._set_status("Execute",self.clock)540 if(self.RS_load3._get_status() == True):541 if (self.RS_load3._get_ALC() == 100):542 self.RS_loadd3._set_ALC(2)543 else:544 self.RS_load3._ALC_DEC()545 if(self.RS_load3._get_ALC() == 0):546 index = self.RS_load3._get_index()547 self.all_inst_queue[index]._set_status("Execute",self.clock)548 if(self.RS_Store1._get_status() == True):549 if(self.RS_Store1._get_Qk() == "None"):550 if(self.RS_Store1._get_ALC() == 100):551 self.RS_Store1._set_ALC(2)552 else:553 self.RS_Store1._ALC_DEC()554 if(self.RS_Store1._get_ALC() == 0):555 index = self.RS_Store1._get_index()556 self.all_inst_queue[index]._set_status("Execute",self.clock)557 if(self.RS_Store2._get_status() == True):558 if(self.RS_Store2._get_Qk() == "None"):559 if(self.RS_Store2._get_ALC() == 100):560 self.RS_Store2._set_ALC(2)561 else:562 self.RS_Store2._ALC_DEC()563 if(self.RS_Store2._get_ALC() == 0):564 index = self.RS_Store2._get_index()565 self.all_inst_queue[index]._set_status("Execute",self.clock)566 if (self.RS_Store3._get_status() == True):567 if (self.RS_Store3._get_Qk() == "None"):568 if (self.RS_Store3._get_ALC() == 100):569 self.RS_Store3._set_ALC(2)570 else:571 self.RS_Store3._ALC_DEC()572 if (self.RS_Store3._get_ALC() == 0):573 index = self.RS_Store3._get_index()574 self.all_inst_queue[index]._set_status("Execute", self.clock)575 def _write(self):576 if(self.RS_load1._get_status() == True):577 if(self.RS_load1._get_ALC() == 0):578 self.RS_load1._set_ALC(1000)579 if(self.RS_load1._get_ALC() == 999):580 index = self.RS_load1._get_index()581 self.all_inst_queue[index]._set_status("WB",self.clock)582 self.result_register_status._reset_function_unit("Load1")583 self._RAW_and_WAW("Load1",self.all_inst_queue[index]._get_imm())584 self.RS_load1._reset()585 if(self.RS_load2._get_status() == True):586 if(self.RS_load2._get_ALC() == 0):587 self.RS_load2._set_ALC(1000)588 if(self.RS_load2._get_ALC() == 999):589 index = self.RS_load2._get_index()590 self.all_inst_queue[index]._set_status("WB",self.clock)591 self.result_register_status._reset_function_unit("Load2")592 self._RAW_and_WAW("Load2",self.all_inst_queue[index]._get_imm())593 self.RS_load2._reset()594 if(self.RS_load3._get_status() == True):595 if(self.RS_load3._get_ALC() == 0):596 self.RS_load3._set_ALC(1000)597 if(self.RS_load3._get_ALC() == 999):598 index = self.RS_load3._get_index()599 self.all_inst_queue[index]._set_status("WB",self.clock)600 self.result_register_status._reset_function_unit("Load3")601 self._RAW_and_WAW("Load3",self.all_inst_queue[index]._get_imm())602 self.RS_load3._reset()603 if(self.RS_Store1._get_status() == True):604 if(self.RS_Store1._get_Qk() == "None"):605 if(self.RS_Store1._get_ALC() == 0):606 self.RS_Store1._set_ALC(1000)607 if(self.RS_Store1._get_ALC() == 999):608 index = self.RS_Store1._get_index()609 self.all_inst_queue[index]._set_status("WB",self.clock)610 # self.result_register_status._reset_function_unit("Store1")611 # self._RAW_and_WAW("Store1",self.all_inst_queue[index]._get_imm())612 self.RS_Store1._reset()613 if(self.RS_Store2._get_status() == True):614 if(self.RS_Store2._get_Qk() == "None"):615 if (self.RS_Store2._get_ALC() == 0):616 self.RS_Store2._set_ALC(1000)617 if (self.RS_Store2._get_ALC() == 999):618 index = self.RS_Store2._get_index()619 self.all_inst_queue[index]._set_status("WB",self.clock)620 # self.result_register_status._reset_function_unit("Store2")621 # self._RAW_and_WAW("Store2",self.all_inst_queue[index]._get_imm())622 self.RS_Store2._reset()623 if(self.RS_Store3._get_status() == True):624 if(self.RS_Store3._get_Qk() == "None"):625 if (self.RS_Store3._get_ALC() == 0):626 self.RS_Store3._set_ALC(1000)627 if (self.RS_Store3._get_ALC() == 999):628 index = self.RS_Store3._get_index()629 self.all_inst_queue[index]._set_status("WB",self.clock)630 # self.result_register_status._reset_function_unit("Store3")631 # self._RAW_and_WAW("Store3",self.all_inst_queue[index]._get_imm())632 self.RS_Store3._reset()633 if(self.RS_Mult1._get_status() == True):634 if(self.RS_Mult1._get_ALC() == 0):635 self.RS_Mult1._set_ALC(1000)636 if(self.RS_Mult1._get_ALC() == 999):637 index = self.RS_Mult1._get_index()638 self.all_inst_queue[index]._set_status("WB",self.clock)639 self.result_register_status._reset_function_unit("Mult1")640 self._RAW_and_WAW("Mult1","the mul value")641 self.RS_Mult1._reset()642 if(self.RS_Mult2._get_status() == True):643 if(self.RS_Mult2._get_ALC() == 0):644 self.RS_Mult2._set_ALC(1000)645 if(self.RS_Mult2._get_ALC() == 999):646 index = self.RS_Mult2._get_index()647 self.all_inst_queue[index]._set_status("WB",self.clock)648 self.result_register_status._reset_function_unit("Mult2")649 self._RAW_and_WAW("Mult2","mul value")650 self.RS_Mult2._reset()651 if(self.RS_Add1._get_status() == True):652 if(self.RS_Add1._get_ALC() == 0):653 self.RS_Add1._set_ALC(1000)654 if(self.RS_Add1._get_ALC() == 999):655 index = self.RS_Add1._get_index()656 self.all_inst_queue[index]._set_status("WB",self.clock)657 self.result_register_status._reset_function_unit("Add1")658 self._RAW_and_WAW("Add1","add value")659 self.RS_Add1._reset()660 if(self.RS_Add2._get_status() == True):661 if(self.RS_Add2._get_ALC() == 0):662 self.RS_Add2._set_ALC(1000)663 if(self.RS_Add2._get_ALC() == 999):664 index = self.RS_Add2._get_index()665 self.all_inst_queue[index]._set_status("WB",self.clock)666 self.result_register_status._reset_function_unit("Add2")667 self._RAW_and_WAW("Add2","add value")668 self.RS_Add2._reset()669 if(self.RS_Add3._get_status() == True):670 if(self.RS_Add3._get_ALC() == 0):671 self.RS_Add3._set_ALC(1000)672 if(self.RS_Add3._get_ALC() == 999):673 index = self.RS_Add3._get_index()674 self.all_inst_queue[index]._set_status("WB",self.clock)675 self.result_register_status._reset_function_unit("Add3")676 self._RAW_and_WAW("Add3","add value")677 self.RS_Add3._reset()678 679 def _RAW_and_WAW(self,fun_unit_name,value):680 if(self.RS_Add1._get_Qj() == fun_unit_name):681 self.RS_Add1._set_Qj("None")682 self.RS_Add1._set_Vj(value)683 if(self.RS_Add1._get_Qk() == fun_unit_name):684 self.RS_Add1._set_Qk("None")685 self.RS_Add1._set_Vk(value)686 if(self.RS_Add2._get_Qj() == fun_unit_name):687 self.RS_Add2._set_Qj("None")688 self.RS_Add2._set_Vj(value)689 if(self.RS_Add2._get_Qk() == fun_unit_name):690 self.RS_Add2._set_Qk("None")691 self.RS_Add2._set_Vk(value)692 if(self.RS_Add3._get_Qj() == fun_unit_name):693 self.RS_Add3._set_Qj("None")694 self.RS_Add3._set_Vj(value)695 if(self.RS_Add3._get_Qk() == fun_unit_name):696 self.RS_Add3._set_Qk("None")697 self.RS_Add3._set_Vk(value)698 if(self.RS_Mult1._get_Qj() == fun_unit_name):699 self.RS_Mult1._set_Qj("None")700 self.RS_Mult1._set_Vj(value)701 if(self.RS_Mult1._get_Qk() == fun_unit_name):702 self.RS_Mult1._set_Qk("None")703 self.RS_Mult1._set_Vk(value)704 if(self.RS_Mult2._get_Qj() == fun_unit_name):705 self.RS_Mult2._set_Qj("None")706 self.RS_Mult2._set_Vj(value)707 if(self.RS_Mult2._get_Qk() == fun_unit_name):708 self.RS_Mult2._set_Qk("None")709 self.RS_Mult2._set_Vk(value)710 if(self.RS_Store1._get_Qk() == fun_unit_name):711 self.RS_Store1._set_Qk("None")712 self.RS_Store1._set_Vk(value)713 if(self.RS_Store2._get_Qk() == fun_unit_name):714 self.RS_Store2._set_Qk("None")715 self.RS_Store2._set_Vk(value) 716 def _set_finish_tag(self):717 for i in range(len(self.all_inst_queue)):718 if (self.all_inst_queue[i]._get_inst_status() != "WB"):719 self.finish_tag = False720 return721 self.finish_tag = True722 def _print(self):723 print("---------------------------------------------------")724 print("current clock:",self.clock)725 for i in range(len(self.all_inst_queue)):726 self.all_inst_queue[i]._print()727 print("------------reserved stations---------")728 self.RS_Add1._print()729 self.RS_Add2._print()730 self.RS_Add3._print()731 self.RS_load1._print()732 self.RS_load2._print()733 self.RS_load3._print()734 self.RS_Mult1._print()735 self.RS_Mult2._print()736 self.RS_Store1._print()737 self.RS_Store2._print()738 self.RS_Store3._print()739 print("--------------register state------------")740 self.result_register_status._print()741 def _run_step(self):742 self._run()743 # showr = shower(self.all_exec_state)744 # showr.update_tree_view(0)745 def _snap_shot(self):746 inst_state = []747 for i in range(len(self.all_inst_queue)):748 state = []749 state.append(self.all_inst_queue[i]._get_op())750 state.append(self.all_inst_queue[i]._get_issue_clock())751 state.append(self.all_inst_queue[i]._get_exe_clock())752 state.append(self.all_inst_queue[i]._get_wb_clock())753 inst_state.append(state)754 register_state = self.result_register_status._get_all_registers()755 RS_state = []756 state = []757 state.append(self.RS_Add1._get_ALC())758 state.append("RS_Add1")759 state.append(self.RS_Add1._get_status())760 state.append(self.RS_Add1._get_op())761 state.append(self.RS_Add1._get_Vj())762 state.append(self.RS_Add1._get_Vk())763 state.append(self.RS_Add1._get_Qj())764 state.append(self.RS_Add1._get_Qk())765 RS_state.append(state)766 state = []767 state.append(self.RS_Add2._get_ALC())768 state.append("RS_Add2")769 state.append(self.RS_Add2._get_status())770 state.append(self.RS_Add2._get_op())771 state.append(self.RS_Add2._get_Vj())772 state.append(self.RS_Add2._get_Vk())773 state.append(self.RS_Add2._get_Qj())774 state.append(self.RS_Add2._get_Qk())775 RS_state.append(state)776 state = []777 state.append(self.RS_Add3._get_ALC())778 state.append("RS_Add3")779 state.append(self.RS_Add3._get_status())780 state.append(self.RS_Add3._get_op())781 state.append(self.RS_Add3._get_Vj())782 state.append(self.RS_Add3._get_Vk())783 state.append(self.RS_Add3._get_Qj())784 state.append(self.RS_Add3._get_Qk())785 RS_state.append(state)786 state = []787 state.append(self.RS_load1._get_ALC())788 state.append("RS_Load1")789 state.append(self.RS_load1._get_status())790 state.append(self.RS_load1._get_op())791 state.append(self.RS_load1._get_Vj())792 state.append(self.RS_load1._get_Vk())793 state.append(self.RS_load1._get_Qj())794 state.append(self.RS_load1._get_Qk())795 RS_state.append(state)796 state = []797 state.append(self.RS_load2._get_ALC())798 state.append("RS_Load2")799 state.append(self.RS_load2._get_status())800 state.append(self.RS_load2._get_op())801 state.append(self.RS_load2._get_Vj())802 state.append(self.RS_load2._get_Vk())803 state.append(self.RS_load2._get_Qj())804 state.append(self.RS_load2._get_Qk())805 RS_state.append(state)806 state = []807 state.append(self.RS_load3._get_ALC())808 state.append("RS_Load3")809 state.append(self.RS_load3._get_status())810 state.append(self.RS_load3._get_op())811 state.append(self.RS_load3._get_Vj())812 state.append(self.RS_load3._get_Vk())813 state.append(self.RS_load3._get_Qj())814 state.append(self.RS_load3._get_Qk())815 RS_state.append(state)816 state = []817 state.append(self.RS_Mult1._get_ALC())818 state.append("RS_Mult1")819 state.append(self.RS_Mult1._get_status())820 state.append(self.RS_Mult1._get_op())821 state.append(self.RS_Mult1._get_Vj())822 state.append(self.RS_Mult1._get_Vk())823 state.append(self.RS_Mult1._get_Qj())824 state.append(self.RS_Mult1._get_Qk())825 RS_state.append(state)826 state = []827 state.append(self.RS_Mult2._get_ALC())828 state.append("RS_Mult2")829 state.append(self.RS_Mult2._get_status())830 state.append(self.RS_Mult2._get_op())831 state.append(self.RS_Mult2._get_Vj())832 state.append(self.RS_Mult2._get_Vk())833 state.append(self.RS_Mult2._get_Qj())834 state.append(self.RS_Mult2._get_Qk())835 RS_state.append(state)836 state = []837 state.append(self.RS_Store1._get_ALC())838 state.append("RS_Store1")839 state.append(self.RS_Store1._get_status())840 state.append(self.RS_Store1._get_op())841 state.append(self.RS_Store1._get_Vj())842 state.append(self.RS_Store1._get_Vk())843 state.append(self.RS_Store1._get_Qj())844 state.append(self.RS_Store1._get_Qk())845 RS_state.append(state)846 state = []847 state.append(self.RS_Store2._get_ALC())848 state.append("RS_Store2")849 state.append(self.RS_Store2._get_status())850 state.append(self.RS_Store2._get_op())851 state.append(self.RS_Store2._get_Vj())852 state.append(self.RS_Store2._get_Vk())853 state.append(self.RS_Store2._get_Qj())854 state.append(self.RS_Store2._get_Qk())855 RS_state.append(state)856 state = []857 state.append(self.RS_Store3._get_ALC())858 state.append("RS_Store3")859 state.append(self.RS_Store3._get_status())860 state.append(self.RS_Store3._get_op())861 state.append(self.RS_Store3._get_Vj())862 state.append(self.RS_Store3._get_Vk())863 state.append(self.RS_Store3._get_Qj())864 state.append(self.RS_Store3._get_Qk())865 RS_state.append(state)866 temp = []867 temp.append(inst_state)868 temp.append(RS_state)869 temp.append(register_state)870 self.all_exec_state.append(temp)871 def _read_insts(self,filename):872 inst_list = []873 fileobj = open(filename,"r")...

Full Screen

Full Screen

exceptions.py

Source:exceptions.py Github

copy

Full Screen

...8 return self._message9 def _set_message(self, message):10 self._message = message11 message = property(_get_message, _set_message)12 def _get_status(self):13 return self._status14 def _set_status(self, status):15 self._status = status16 status = property(_get_status, _set_status)17 @staticmethod18 def construct_error_message(data, message, operation):19 return {'data': data, 'message': message, 'operation': operation}20class SQlInvalidRequestError(IntegrityError):21 def __init__(self, data, message, operation, status):22 self.message = self.construct_error_message(data, message, operation)23 self.status = status24 def _get_message(self):25 return self._message26 def _set_message(self, message):27 self._message = message28 message = property(_get_message, _set_message)29 def _get_status(self):30 return self._status31 def _set_status(self, status):32 self._status = status33 status = property(_get_status, _set_status)34 @staticmethod35 def construct_error_message(data, message, operation):36 return {'data': data, 'message': message, 'operation': operation}37class SQLIntegrityError(IntegrityError):38 def __init__(self, data, message, operation, status):39 self.message = self.construct_error_message(data, message, operation)40 self.status = status41 def _get_message(self):42 return self._message43 def _set_message(self, message):44 self._message = message45 message = property(_get_message, _set_message)46 def _get_status(self):47 return self._status48 def _set_status(self, status):49 self._status = status50 status = property(_get_status, _set_status)51 @staticmethod52 def construct_error_message(data, message, operation):53 return {'data': data, 'message': message, 'operation': operation}54class SQLDetachedInstanceError(DetachedInstanceError):55 def __init__(self, data, message, operation, status):56 self.message = self.construct_error_message(data, message, operation)57 self.status = status58 def _get_message(self):59 return self._message60 def _set_message(self, message):61 self._message = message62 message = property(_get_message, _set_message)63 def _get_status(self):64 return self._status65 def _set_status(self, status):66 self._status = status67 status = property(_get_status, _set_status)68 @staticmethod69 def construct_error_message(data, message, operation):70 return {'data': data, 'message': message, 'operation': operation}71class CustomException(Exception):72 def __init__(self, data, message, operation, status=400):73 self.message = self.construct_error_message(data, message, operation)74 self.status = status75 def _get_message(self):76 return self._message77 def _set_message(self, message):78 self._message = message79 message = property(_get_message, _set_message)80 def _get_status(self):81 return self._status82 def _set_status(self, status):83 self._status = status84 status = property(_get_status, _set_status)85 @staticmethod86 def construct_error_message(data, message, operation):87 return {'data': data, 'message': message, 'operation': operation}88class ResourceNotFound(CustomException):89 status = 40490class RequestNotAllowed(CustomException):...

Full Screen

Full Screen

client.py

Source:client.py Github

copy

Full Screen

...10 )11else:12 import requests13ENDPOINT_URL = 'https://scoreboard.ctf.saarland/attack.json'14def _get_status():15 return requests.get(ENDPOINT_URL).json()16def get_teams():17 return _get_status()['teams']18def get_ips():19 return list(map(lambda x: x['ip'], _get_status()['teams']))20def is_online(ip):21 return ip in get_ips()22def assert_online(ip):23 assert is_online(ip)24def get_services():25 return list(_get_status()['flag_ids'].keys())26def get_flag_ids(service, ip):...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful