当前位置: 首页>>代码示例>>Python>>正文


Python CWCoreAPI.getInstance方法代码示例

本文整理汇总了Python中chipwhisperer.common.api.CWCoreAPI.CWCoreAPI.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Python CWCoreAPI.getInstance方法的具体用法?Python CWCoreAPI.getInstance怎么用?Python CWCoreAPI.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chipwhisperer.common.api.CWCoreAPI.CWCoreAPI的用法示例。


在下文中一共展示了CWCoreAPI.getInstance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: resetDevice

# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
 def resetDevice(self):
     # Reset the target by reading its signature
     target = self.findParam('target').getValue()
     if target == 'xmega (PDI)':
         CWCoreAPI.getInstance().getScope().scopetype.dev.getCwliteXMEGA().readSignature()
     else:
         CWCoreAPI.getInstance().getScope().scopetype.dev.getCwliteAVR().readSignature()
开发者ID:phonchi,项目名称:chipwhisperer,代码行数:9,代码来源:ResetCW1173Read.py

示例2: trigger

# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
 def trigger(self, _=None):
     print "AUXIO: Trigger pin %d" % self.pin
     self.checkMode()
     CWCoreAPI.getInstance().getScope().advancedSettings.cwEXTRA.setGPIOState(state=(not self.standby), IONumber=self.pin)
     self.nonblockingSleep(self.triglength)
     CWCoreAPI.getInstance().getScope().advancedSettings.cwEXTRA.setGPIOState(state=self.standby, IONumber=self.pin)
     self.nonblockingSleep(self.postdelay)
开发者ID:phonchi,项目名称:chipwhisperer,代码行数:9,代码来源:GPIOToggle.py

示例3: processTraces

# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
    def processTraces(self, _=None):
        tstart = self.findParam('tracerng').getValue()[0]
        tend = self.findParam('tracerng').getValue()[1]
        pstart = self.findParam('pointrng').getValue()[0]
        pend = self.findParam('pointrng').getValue()[1]

        trace = CWCoreAPI.getInstance().getNewTrace(self.findParam('tracefmt').getValue())
        trace.config.setAttr("notes", "Recorded from \"%s\" output: Traces (%s,%s). Points (%s,%s)" % (self.findParam('Input').getValueKey(), tstart, tend, pstart, pend))
        for tnum in range(tstart, tend+1):
            trace.addTrace(self.getTraceSource().getTrace(tnum)[pstart:pend+1], self.getTraceSource().getTextin(tnum), self.getTraceSource().getTextout(tnum), self.getTraceSource().getKnownKey(tnum))
        trace.closeAll()
        CWCoreAPI.getInstance().project().traceManager().appendSegment(trace, enabled=False)
开发者ID:phonchi,项目名称:chipwhisperer,代码行数:14,代码来源:tracerecorder.py

示例4: checkMode

# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
    def checkMode(self):
        cwa = CWCoreAPI.getInstance().getScope().advancedSettings.cwEXTRA

        if self.pin != self.lastPin:
            # Turn off last used pin
            if self.lastPin:
                cwa.setTargetIOMode(IONumber=self.lastPin, setting=0)

            # Setup new pin
            cwa.setTargetIOMode(IONumber=self.pin, setting=cwa.IOROUTE_GPIOE)

            # Don't do this again
            self.lastPin = self.pin
开发者ID:phonchi,项目名称:chipwhisperer,代码行数:15,代码来源:GPIOToggle.py

示例5: __init__

# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
    def __init__(self, parent):
        AutoScript.__init__(self)
        self._autoscript_init = False
        self.parent = parent
        self.poi = POI(self)
        self.poiDock = CWMainGUI.getInstance().addDock(self.poi, "Partition Comparison POI Table", area=Qt.TopDockWidgetArea)
        self.poiDock.hide()
        self.defineName()
        self._traces = None

        self.api = CWCoreAPI.getInstance()
        self.graph = GraphWidget()
        self.bselection = QToolBar()
        self.graph.addWidget(self.bselection)
        self.graphDock = CWMainGUI.getInstance().addDock(self.graph, "Partition Comparison Graph", area=Qt.TopDockWidgetArea)
        self.graphDock.hide()
开发者ID:phonchi,项目名称:chipwhisperer,代码行数:18,代码来源:PartitionDisplay.py

示例6: addTraces

# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
    def addTraces(self, tracedata, tracerange, progressBar=None, pointRange=None):
        keyround=self.keyround
        modeltype=self.modeltype
        brange=self.brange

        foundkey = []

        self.all_diffs = range(0,16)

        tdiff = self.findParam('reportinterval').getValue()

        numtraces = tracerange[1] - tracerange[0]

        if progressBar:
            progressBar.setMinimum(0)
            progressBar.setMaximum(len(brange) * 256 * (numtraces/tdiff + 1))

        #r = Parallel(n_jobs=4)(delayed(traceOneSubkey)(bnum, pointRange, traces_all, numtraces, plaintexts, ciphertexts, keyround, modeltype, progressBar, self.model, pbcnt) for bnum in brange)
        #self.all_diffs, pb = zip(*r)
        cpa = [None]*(max(brange)+1)
        for bnum in brange:
            cpa[bnum] = CPAProgressiveOneSubkey()
            # cpa[bnum] = MinDistOneSubkey()
            # cpa[bnum] = TemplateOneSubkey()

        brangeMap = [None]*(max(brange)+1)
        i = 1
        for bnum in brange:
            brangeMap[bnum] = i
            i += 1

        skipPGE = self.findParam('checkpge').getValue()
        bf = self.findParam('itmode').getValue() == 'bf'

        #bf specifies a 'breadth-first' search. bf means we search across each
        #subkey by only the amount of traces specified. Depth-First means we
        #search each subkey completely, then move onto the next.
        if bf:
            brange_df = [0]
            brange_bf = brange
        else:
            brange_bf = [0]
            brange_df = brange


        #H = np.load('channelinfo-masked.npy')
        #H = np.load('csi-masked-newkey.npy')
        #H = np.load('channelinfo.npy')
        #mio = sio.loadmat('equalizer.mat')
        #H = mio['equaltotal']
        # H = np.load('equalization.npy')
        # self.project() ?
        project = CWCoreAPI.getInstance().project()
        section = project.getDataConfig("Template Data", "Equalization Matrix")
       # section = project.getDataConfig("Template Data", "AOF Matrix")
        fname = project.convertDataFilepathAbs(section[0]["filename"])
        H = np.load(fname)

        #for j in range(0, 16):
            #4 = 500-800
            #test = H.copy()
            #for i in range(0, 5):
            #    threshold = max(abs(test[j]))
            #    test[j, abs(test[j,:]) >= threshold ] = 0

            #print "%f %d"%(threshold, (abs(H[j,:]) > threshold).sum())

            #H[j, abs(H[j,:]) < threshold] = 0

        for bnum_df in brange_df:

            #CPAMemoryOneSubkey
            #CPASimpleOneSubkey
            #(self.all_diffs[bnum], pbcnt) = sCPAMemoryOneSubkey(bnum, pointRange, traces_all, numtraces, plaintexts, ciphertexts, keyround, modeltype, progressBar, self.model, pbcnt)

            tstart = 0
            tend = tdiff

            while tstart < numtraces:
                pbcnt = 0
                if tend > numtraces:
                    tend = numtraces

                if tstart > numtraces:
                    tstart = numtraces

                data = []
                textins = []
                textouts = []
                knownkeys = []
                for i in range(tstart, tend):

                    # Handle Offset
                    tnum = i + tracerange[0]

                    d = tracedata.getTrace(tnum)

                    if d is None:
                        continue

#.........这里部分代码省略.........
开发者ID:phonchi,项目名称:chipwhisperer,代码行数:103,代码来源:experimentalchannelinfo.py

示例7: savePOI

# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
 def savePOI(self):
     poiDict = {"poi":self.poiArray, "partitiontype":self.parent.partObject.partMethod.__class__.__name__}
     CWCoreAPI.getInstance().project().addDataConfig(poiDict, "Template Data", "Points of Interest")
开发者ID:phonchi,项目名称:chipwhisperer,代码行数:5,代码来源:PartitionDisplay.py

示例8: captureInit

# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
    def captureInit(self):
        self.checkMode()
        CWCoreAPI.getInstance().getScope().advancedSettings.cwEXTRA.setGPIOState(state=self.standby, IONumber=self.pin)

        if self.triglocation == 0:
            self.trigger()
开发者ID:phonchi,项目名称:chipwhisperer,代码行数:8,代码来源:GPIOToggle.py


注:本文中的chipwhisperer.common.api.CWCoreAPI.CWCoreAPI.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。