本文整理匯總了Python中chipwhisperer.common.utils.parameter.Parameter.getParameter方法的典型用法代碼示例。如果您正苦於以下問題:Python Parameter.getParameter方法的具體用法?Python Parameter.getParameter怎麽用?Python Parameter.getParameter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類chipwhisperer.common.utils.parameter.Parameter
的用法示例。
在下文中一共展示了Parameter.getParameter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getParameter
# 需要導入模塊: from chipwhisperer.common.utils.parameter import Parameter [as 別名]
# 或者: from chipwhisperer.common.utils.parameter.Parameter import getParameter [as 別名]
def getParameter(self, path):
"""Return the value of a registered parameter"""
return Parameter.getParameter(path)
示例2: addResponse
# 需要導入模塊: from chipwhisperer.common.utils.parameter import Parameter [as 別名]
# 或者: from chipwhisperer.common.utils.parameter.Parameter import getParameter [as 別名]
def addResponse(self, resp):
""" Add a response from the system to glitch table + logs """
normeval = self.findParam("normalresp").getValue()
succeval = self.findParam("successresp").getValue()
if len(normeval) > 0:
# Check if Normal
normresult = eval(normeval, {"s": resp}, {})
else:
normresult = False
# Check if Successful
if len(succeval) > 0:
# Check if Normal
succresult = eval(succeval, {"s": resp}, {})
else:
succresult = False
# Check ?
if not isinstance(normresult, bool):
raise ValueError(
"Result of 'normal' eval() not a bool, got %s (result: %s)" % (type(normresult), normresult)
)
if not isinstance(succresult, bool):
raise ValueError(
"Result of 'success' eval() not a bool, got %s (result: %s)" % (type(succresult), succresult)
)
if normresult and succresult:
logging.warning("Both normresult and succresult True!")
starttime = datetime.now()
respstr = str(bytearray(resp.encode("utf-8")))
# respstr = ' '.join(["%02x" % t for t in bytearray(resp)])
settingsList = []
for i in range(0, len(self.tuneParamList)):
try:
settingsList.append(Parameter.getParameter(self.tuneParamList[i].paramScript))
except:
raise StopIteration(
'Choose a valid Parameter Path for Tuning Parameter "%s" . Got: %s'
% (self.tuneParamList[i].name(), self.tuneParamList[i].paramScript)
)
newdata = {
"input": "",
"output": respstr,
"normal": normresult,
"success": succresult,
"settings": settingsList,
"date": starttime,
}
self.tableList.append(newdata)
self.appendToTable(newdata)
self.updateStatus()
if self._campaignRunning and self.findParam(["Recordings", "saveresults"]).getValue():
if self._autosavef is None:
# File previously not open
try:
self._autosavef = open(self._autosavefname, "w")
except Exception as e:
self.findParam(["Recordings", "saveresults"]).setValue(False)
raise Warning(
"Could not save recordings to file: %s. Reason: %s. Disabling it in order to continue."
% (self._autosavefname, str(e))
)
self.findParam(["Recordings", "savefilename"]).setValue(self._autosavefname, ignoreReadonly=True)
# Add notes
pickle.dump({"notes": self.findParam(["Recordings", "savenotes"]).getValue()}, self._autosavef)
# Add headers
cmds = [
self.tuneParamList[i].findParam("parampath").getValue() for i in range(0, len(self.tuneParamList))
]
pickle.dump({"commands": cmds}, self._autosavef)
# Add data
pickle.dump({"data": newdata}, self._autosavef)