本文整理汇总了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)