def apply(self): if self.pending: arvf = RVF() arvf.command = "ADDRESS" arvf.uid = self.uid arvf.payload = self.address self.client_interface.request(arvf) self.response_cv.wait() wrvf = RVF() if self.capture and not self.update: wrvf.command = "READ" elif self.capture and self.update: wrvf.command = "WRITE_READ" elif self.update and not self.capture: wrvf.command = "WRITE" else: raise SchedulerError("Invalid command state!") wrvf.uid = self.uid self.local_access_mutex.acquire() wrvf.payload = self.rvf.payload self.local_access_mutex.release() self.client_interface.request(wrvf) self.local_access_mutex.acquire() self.request_count += 1 self.pending = False self.local_access_mutex.release() self.logger.debug( "PortalRegister.apply(uid={:d}, command={:s}, payload={:s})\n". format(wrvf.uid, wrvf.command, str(wrvf.payload)))
def resp_handler(self, rvf: RVF): self.logger.debug("TAP.resp_handler(uid={:d}, command={:s}, payload={:s})\n".format(rvf.uid, rvf.command, str(rvf.payload))) uid = rvf.uid resp = RVF() self.response_mutex.acquire() resp.payload = rvf.payload self.response_mutex.release() if rvf.command == "SIR": resp.uid = self.depth().uid resp.command = "CAPSCAN" self.host_interface.response(resp) elif rvf.command == "SIRNC": resp.uid = self.depth().uid resp.command = "SCAN" self.host_interface.response(resp) elif rvf.command == "SDR": resp.uid = self.depth().breadth().uid resp.command = "CAPSCAN" self.host_interface.response(resp) elif rvf.command == "SDRNC": resp.uid = self.depth().breadth().uid resp.command = "SCAN" self.host_interface.response(resp) else: raise SchedulerError("Invalid command received.") self.request_count -= 1 if self.request_count == 0: pass # Notify all requests have been satisfied SchedulerFactory.get_scheduler().clear_pending()
def apply(self): self.capture = False self.pending_count = 0 seg = self.depth() while seg is not None: seg.apply() seg = seg.breadth() if self.pending_count > 1: raise SchedulerError("Multiple competing paths detected.") if self.pending: self.local_access_mutex.acquire() uid = self.rvf.uid command = self.rvf.command payload = self.rvf.payload self.pending = False self.local_access_mutex.release() self.logger.debug("self.rvf.command = {:s}.\n".format(command)) if command == "SIR": self.logger.debug("Calling scan_ir().") tdo = self.jtag_controller.scan_ir(len(payload), str(payload)) # payload must be an intbv type resp = RVF() resp.command = "SIR" resp.uid = uid self.logger.debug("SIR tdo={:s}".format(tdo)) resp.payload = intbv(int(tdo, 16), _nrbits=len(payload)) self.host_interface.response(resp) elif command == "SIRNC": # fmt = "{:0" + "{:d}".format((len(self.rvf.payload) + 1) // 4) + "X}" # print("fmt = {:s}\n".format(fmt)) # tdi = fmt.format(int(self.rvf.payload)) # tdi = "{0:0{1}X}".format(int(payload), (len(payload) + 1) // 4) tdi = str(payload) self.logger.debug("tdi = {:s}\n".format(tdi)) self.jtag_controller.scan_ir(len(payload), tdi) # payload must be an intbv type resp = RVF() resp.command = "SIRNC" resp.uid = self.rvf.uid resp.payload = intbv(0) self.host_interface.response(resp) elif command == "SDR": tdo = self.jtag_controller.scan_dr(len(payload), str(payload)) # payload must be an intbv type resp = RVF() resp.command = "SDR" resp.uid = uid self.logger.debug("SDR tdo={:s}".format(tdo)) resp.payload = intbv(int(tdo, 16), _nrbits=len(payload)) self.host_interface.response(resp) elif command == "SDRNC": self.jtag_controller.scan_dr(len(payload), str(payload)) # payload must be an intbv type resp = RVF() resp.command = "SDRNC" resp.uid = uid resp.payload = intbv(0) self.host_interface.response(resp) else: raise SchedulerError("Invalid command detected. ({:s})".format(command))
def resp_handler(self, rvf: RVF): self.logger.debug( "ScanMux.resp_handler(uid={:d}, command={:s}, payload={:s})\n". format(rvf.uid, rvf.command, str(rvf.payload))) uid = rvf.uid resp = RVF() self.response_mutex.acquire() resp.payload = rvf.payload resp.command = rvf.command self.response_mutex.release() found = False seg = self.depth() while seg is not None: if seg == self.selected_seg: resp.uid = seg.uid seg.client_interface.response(resp) found = True break seg = seg.breadth() if not found: raise SchedulerError("Unable to locate selected_uid assembly.") self.request_count -= 1 if self.request_count == 0: pass # Notify all requests have been satisfied SchedulerFactory.get_scheduler().clear_pending()
def resp_handler(self, rvf: RVF): self.logger.debug( "JTAGNetwork.resp_handler(uid={:d}, command={:s}, payload={:s})\n". format(rvf.uid, rvf.command, str(rvf.payload))) self.response_mutex.acquire() self.response = rvf.payload self.response_mutex.release() i = 0 start = 0 end = 0 seg = self.depth() while seg is not None: end = len(self.segments[i]) + end resp = RVF() resp.uid = seg.uid resp.payload = intbv(self.response[start:end]) resp.command = rvf.command seg.client_interface.response(rvf) start = end i += 1 seg = seg.breadth() self.request_count -= 1 if self.request_count == 0: self.response_cv.notify( ) # Notify all requests have been satisfied SchedulerFactory.get_scheduler().clear_pending()
def apply(self): self.capture = False if not self.cached: self.__init_segments() self.cached = True seg = self.depth() while seg is not None: seg.apply() seg = seg.breadth() if self.pending: if self.data_mode is None: raise SchedulerError("Pending conflict with data_mode!") # Concatenate vectors together into a single vector to scan value = concat([v for v in self.segments]) wrvf = RVF() if self.capture and self.data_mode: wrvf.command = "SDR" elif self.capture and not self.data_mode: wrvf.command = "SIR" elif self.data_mode: wrvf.command = "SDRNC" elif not self.data_mode: wrvf.command = "SIRNC" else: raise SchedulerError("Invalid data_mode detected.") wrvf.uid = self.uid wrvf.payload = value self.client_interface.request(wrvf) self.request_count += 1 self.pending = False self.data_mode = None self.logger.debug( "JTAGNetwork.apply(uid={:d}, command={:s}, payload={:s})\n". format(wrvf.uid, wrvf.command, str(wrvf.payload)))
def apply(self): self.capture = False if not self.cached: self.__init_segments() self.cached = True seg = self.depth() while seg is not None: seg.apply() seg = seg.breadth() if self.pending: # Concatenate vectors together into a single vector to scan value = concat([v for v in self.segments]) wrvf = RVF() if self.capture: wrvf.command = "CAPSCAN" else: wrvf.command = "SCAN" wrvf.uid = self.uid wrvf.payload = value self.client_interface.request(wrvf) self.request_count += 1 self.pending = False self.logger.debug( "IJTAGNetwork.apply(uid={:d}, command={:s}, payload={:s})\n". format(wrvf.uid, wrvf.command, str(wrvf.payload)))
def __send_response(self, uid, command, payload): resp = RVF() resp.payload = payload resp.command = command resp.uid = uid found = False seg = self.depth() while seg is not None: if uid == seg.uid: seg.client_interface.reponse(resp) found = True break seg = seg.breadth() if not found: raise SchedulerError("Unable to locate uid assembly.")
def apply(self): if self.pending: self.local_access_mutex.acquire() if self.capture: wrvf = RVF() wrvf.command = "CAPSCAN" else: wrvf = RVF() wrvf.command = "SCAN" wrvf.uid = self.uid wrvf.payload = self.__value self.client_interface.request(wrvf) self.request_count += 1 self.pending = False self.local_access_mutex.release() self.logger.debug( "ScanRegister.apply(uid={:d}, command={:s}, payload={:s})\n". format(wrvf.uid, wrvf.command, str(wrvf.payload)))
def resp_handler(self, rvf: RVF): self.logger.debug( "PortalRegister.resp_handler(uid={:d}, command={:s}, payload={:s})\n" .format(rvf.uid, rvf.command, str(rvf.payload))) resp = RVF() self.local_access_mutex.acquire() resp.uid = self.current_uid self.local_access_mutex.release() resp.payload = rvf.payload if rvf.command == "WRITE" or rvf.command == "READ" or rvf.command == "WRITE_READ": resp.command = rvf.command elif rvf.command == "ADDRESS": self.response_cv.notify() else: raise SchedulerError("Invalid command received.") self.host_interface.response(resp) self.request_count -= 1 if self.request_count == 0: pass # Notify all requests have been satisfied from p2654model.scheduler.Scheduler import SchedulerFactory SchedulerFactory.get_scheduler().clear_pending()
def apply(self): if self.keyreg is None: raise SchedulerError("keyreg must be defined before use.") # self.capture = False self.pending_count = 0 seg = self.depth() while seg is not None: seg.apply() seg = seg.breadth() if self.pending_count > 1: raise SchedulerError("Multiple competing paths detected.") try: self.selected_seg = self.description.get_ir_dr( self.keyreg.get_value()) except SchedulerError: self.logger.debug( "*******************************************************\n") self.keyreg.write(self.description.get_default_code()) self.selected_seg = self.description.get_ir_dr( self.description.get_default_code()) if self.selected_seg is None: raise SchedulerError("No path has been selected.") if self.pending: self.logger.debug("selected_seg.name = {:s}.".format( self.selected_seg.name)) if self.capture: wrvf = RVF() wrvf.command = "CAPSCAN" else: wrvf = RVF() wrvf.command = "SCAN" wrvf.uid = self.uid wrvf.payload = self.value self.client_interface.request(wrvf) self.request_count += 1 self.pending = False self.capture = False self.logger.debug( "ScanMux.apply(uid={:d}, command={:s}, payload={:s})\n".format( wrvf.uid, wrvf.command, str(wrvf.payload)))
def apply(self): self.capture = False self.pending_count = 0 seg = self.depth() while seg is not None: seg.apply() seg = seg.breadth() if self.pending_count > 1: raise SchedulerError("Multiple competing paths detected.") if self.pending: wrvf = RVF() self.local_access_mutex.acquire() wrvf.uid = self.uid wrvf.payload = self.value if self.capture: wrvf.command = self.command else: wrvf.command = self.command self.client_interface.request(wrvf) self.request_count += 1 self.pending = False self.local_access_mutex.release()