Beispiel #1
0
    def __init__(self,
                 name="UdpEngineServer",
                 description="UdpEngineServer",
                 **kwargs):
        super().__init__(name=name, description=description, **kwargs)
        ##############################
        # Variables
        ##############################

        self.add(
            pr.RemoteVariable(
                name="ServerRemotePort",
                description="ServerRemotePort (big-Endian configuration)",
                offset=0x00,
                bitSize=16,
                bitOffset=0x00,
                base=pr.UInt,
                mode="RO",
                hidden=True,
            ))

        self.add(
            pr.LinkVariable(
                name="ServerRemotePortValue",
                description="ServerRemotePort (human readable)",
                mode='RO',
                linkedGet=udp.getPortValue,
                dependencies=[self.variables["ServerRemotePort"]],
            ))

        self.add(
            pr.RemoteVariable(
                name="ServerRemoteIp",
                description="ServerRemoteIp (big-Endian configuration)",
                offset=0x04,
                bitSize=32,
                bitOffset=0x00,
                base=pr.UInt,
                mode="RO",
                hidden=True,
            ))

        self.add(
            pr.LinkVariable(
                name="ServerRemoteIpValue",
                description="ServerRemoteIp (human readable)",
                mode='RO',
                linkedGet=udp.getIpValue,
                dependencies=[self.variables["ServerRemoteIp"]],
            ))
Beispiel #2
0
    def addRemoteVariables(self, number, stride, pack=False, **kwargs):
        hidden = pack or kwargs.pop('hidden', False)
        self.addNodes(pr.RemoteVariable,
                      number,
                      stride,
                      hidden=hidden,
                      **kwargs)

        # If pack specified, create a linked variable to combine everything
        if pack:
            varList = getattr(self, kwargs['name']).values()

            def linkedSet(dev, var, val, write):
                if val == '': return
                values = reversed(val.split('_'))
                for variable, value in zip(varList, values):
                    variable.setDisp(value, write=write)

            def linkedGet(dev, var, read):
                values = [v.getDisp(read=read) for v in varList]
                return '_'.join(reversed(values))

            name = kwargs.pop('name')
            kwargs.pop('value', None)

            lv = pr.LinkVariable(name=name,
                                 value='',
                                 dependencies=varList,
                                 linkedGet=linkedGet,
                                 linkedSet=linkedSet,
                                 **kwargs)
            self.add(lv)
Beispiel #3
0
 def addPair(
     name,
     offset,
     bitSize,
     units,
     bitOffset,
     description,
     function,
     pollInterval=0,
 ):
     self.add(
         pr.RemoteVariable(
             name=(name + "Raw"),
             offset=offset,
             bitSize=bitSize,
             bitOffset=bitOffset,
             base=pr.UInt,
             mode='RO',
             description=description,
             pollInterval=pollInterval,
             hidden=True,
         ))
     self.add(
         pr.LinkVariable(
             name=name,
             mode='RO',
             units=units,
             linkedGet=function,
             dependencies=[self.variables[name + "Raw"]],
         ))
Beispiel #4
0
        def _decorator(func):
            if 'name' not in kwargs:
                kwargs['name'] = func.__name__

            self.add(pr.LinkVariable(linkedGet=func, **kwargs))

            return func
        def addBoolPair(tap):
            self.add(
                pr.RemoteVariable(
                    name=f'RawTap[{tap}]',
                    description=f'Tap[{tap}] Fixed Point Coefficient',
                    offset=4 * tap,
                    bitSize=dataWordBitSize,
                    base=pr.Int,
                    mode='RW',
                    hidden=True,
                ))

            var = self.variables[f'RawTap[{tap}]']

            self.add(
                pr.LinkVariable(
                    name=f'Tap[{tap}]',
                    description=f'Tap[{tap}] Floating Point Coefficient',
                    mode='RW',
                    linkedGet=lambda: var.value() / 2**dataWordBitSize,
                    linkedSet=lambda value, write: var.set(
                        int(value * 2**dataWordBitSize)),
                    dependencies=[var],
                    disp='{:1.3f}',
                ))
Beispiel #6
0
    def __init__(self,
                 name="Dac",
                 description="Container for AD5662 SPI modules",
                 **kwargs):

        super().__init__(name=name, description=description, **kwargs)

        self.add(
            pr.RemoteVariable(
                name='RawValue',
                description='16-bit DAC Value',
                offset=0x0,
                bitSize=16,
                mode='WO',
                units='1.024V/2^16',
            ))

        self.add(
            pr.LinkVariable(
                name='FloatValue',
                mode='RW',
                units='V',
                disp='{:1.3f}',
                linkedGet=self.getVoltage,
                linkedSet=self.setVoltage,
                dependencies=[self.variables['RawValue']],
            ))
        def addPixReg(name, description, bitSize, bitOffset, device, index):

            downToBitOrdering = pr.UIntReversed
            upToBitOrdering = pr.UInt

            remap = divmod((bitOffset - 1), 32)

            rawName = (f'pix{index}_' + name)

            self.add(
                pr.RemoteVariable(
                    name=rawName,
                    description=description,
                    base=upToBitOrdering,
                    offset=(remap[0] << 2),
                    mode='RW',
                    bitSize=bitSize,
                    bitOffset=remap[1],
                    hidden=True,
                    # value     = 0, # PROBES: Default value= all OFF (0)
                ))

            rawVar = self.variables[rawName]

            device.add(
                pr.LinkVariable(
                    name=name,
                    description=description,
                    mode='RW',
                    linkedGet=lambda: rawVar.value(),
                    linkedSet=lambda value, write: rawVar.set(value),
                    dependencies=[rawVar],
                    disp='0x{:x}',
                ))
Beispiel #8
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        def getOpticalPwr(var):
            raw = var.dependencies[0].value() # Units of 0.1 uW
            if raw == 0:
                pwr = 0.0001 # Prevent log10(zero) case
            else:
                pwr = float(raw)*0.0001 # units of mW

            # Return value in units of dBm
            return 10.0*math.log10(pwr)

        for i in range(12):
            self.add(pr.RemoteVariable(
                name        = f'InputOpticalPowerMonitorRaw[{11-i}]',
                offset      = ((206+i) << 2),
                bitSize     = 8,
                bitOffset   = 0,
                mode        = 'RO',
                hidden      = True,
            ))

            self.add(pr.LinkVariable(
                name         = f'InputOpticalPowerMonitor[{11-i}]',
                mode         = 'RO',
                disp         = '{:1.1f}',
                units        = 'dBm',
                linkedGet    = getOpticalPwr,
                dependencies = [self.InputOpticalPowerMonitorRaw[11-i]],
            ))
Beispiel #9
0
 def addPair(
     name,
     offset,
     bitSize,
     units,
     bitOffset,
     description,
     function,
     pollInterval=0,
 ):
     self.add(
         pr.RemoteVariable(
             name=("Raw" + name),
             offset=offset,
             bitSize=bitSize,
             bitOffset=bitOffset,
             mode='RO',
             description=description,
             pollInterval=pollInterval,
             hidden=True,
         ))
     self.add(
         pr.LinkVariable(
             name=name,
             mode='RO',
             units=units,
             linkedGet=function,
             typeStr="Float32",
             dependencies=[self.variables["Raw" + name]],
         ))
    def __init__(self,
                 name="LutMem",
                 description="Container for LUT Memory",
                 ADDR_WIDTH_G=11,
                 **kwargs):

        super().__init__(name=name, description=description, **kwargs)

        self.addRemoteVariables(
            name='MEM',
            offset=0x0,
            number=2**ADDR_WIDTH_G,
            bitSize=20,
            bitOffset=0,
            stride=4,
            mode="RW",
            base=pr.Int,
            hidden=True,
        )

        self.add(
            pr.LinkVariable(
                name='MemArray',
                hidden=True,
                description="LUT mem array",
                dependencies=[
                    self.node(f'MEM[{i}]') for i in range(2**ADDR_WIDTH_G)
                ],
                linkedGet=lambda dev, var, read: dev.getArray(dev, var, read),
                linkedSet=lambda dev, var, value: dev.setArray(
                    dev, var, value),
                typeStr="List[Int20]",
            ))
Beispiel #11
0
    def __init__(self,
                 name='MyAxiVersion',
                 description='AXI-Lite Version Module',
                 numUserConstants=0,
                 **kwargs):

        super().__init__(name=name, description=description, **kwargs)

        self.add(
            pr.RemoteVariable(
                name="MacAddress",
                description="MacAddress (big-Endian configuration)",
                offset=0x400,
                bitSize=48,
                mode="RO",
                hidden=True,
            ))

        self.add(
            pr.LinkVariable(
                name="MAC_ADDRESS",
                description="MacAddress (human readable)",
                mode='RO',
                linkedGet=udp.getMacValue,
                dependencies=[self.variables["MacAddress"]],
            ))

        self.add(
            pr.RemoteVariable(
                name="Efuse",
                offset=0x408,
                bitSize=32,
                mode="RO",
                hidden=True,
            ))
Beispiel #12
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        ##############################
        # Variables
        ##############################

        self.add(
            pr.RemoteVariable(
                name="ClientRemotePortRaw",
                description="ClientRemotePort (big-Endian configuration)",
                offset=0x00,
                bitSize=16,
                mode="RW",
                hidden=True,
            ))

        self.add(
            pr.LinkVariable(
                name="ClientRemotePort",
                description=
                "ClientRemotePort (human readable & little-Endian configuration)",
                mode='RW',
                linkedGet=udp.getPortValue,
                linkedSet=udp.setPortValue,
                dependencies=[self.variables["ClientRemotePortRaw"]],
            ))

        self.add(
            pr.RemoteVariable(
                name="ClientRemoteIpRaw",
                description="ClientRemoteIp (big-Endian configuration)",
                offset=0x04,
                bitSize=32,
                mode="RW",
                hidden=True,
            ))

        self.add(
            pr.LinkVariable(
                name="ClientRemoteIp",
                description="ClientRemoteIp (human readable string)",
                mode='RW',
                linkedGet=udp.getIpValue,
                linkedSet=udp.setIpValue,
                dependencies=[self.variables["ClientRemoteIpRaw"]],
            ))
Beispiel #13
0
    def __init__(self, name='PrbsMultiTx', swTx=None, fwRx=None):
        pr.Device.__init__(self, name=name)

        self._prbsSizeDep = [v.txSize for v in swTx]
        self._prbsEnDep = [v.txEnable for v in swTx]
        self._prbsErrorDep = [v.MissedPacketCnt for v in fwRx]
        self._prbsRateDep = [v.PacketRate for v in fwRx]
        self._prbsBwDep = [v.BitRate for v in fwRx]

        self.add(
            pr.LinkVariable(name='PrbsSize',
                            disp='{:#x}',
                            dependencies=self._prbsSizeDep,
                            linkedSet=self._setPrbsSize,
                            linkedGet=self._getPrbsSize))
        self.add(
            pr.LinkVariable(name='PrbsEn',
                            disp=[True, False],
                            dependencies=self._prbsEnDep,
                            linkedSet=self._setPrbsEn,
                            linkedGet=self._getPrbsEn))
        self.add(
            pr.LinkVariable(name='PrbsErrors',
                            dependencies=self._prbsErrorDep,
                            linkedGet=self._getPrbsErrors,
                            mode='RO',
                            disp='{}'))
        self.add(
            pr.LinkVariable(name='PrbsRate',
                            dependencies=self._prbsRateDep,
                            linkedGet=self._getPrbsRate,
                            units='Frames/s',
                            mode='RO',
                            disp='{:0.2e}'))
        self.add(
            pr.LinkVariable(name='PrbsBw',
                            dependencies=self._prbsBwDep,
                            linkedGet=self._getPrbsBw,
                            units='Bytes/s',
                            mode='RO',
                            disp='{:0.2e}'))
Beispiel #14
0
    def __init__(self, tx, rx):
        pr.Device.__init__(self, name='PrbsSummary')

        self._prbsSizeDep = [v.PacketLength for k, v in tx.items()]
        self._prbsEnDep = [v.TxEn for k, v in tx.items()]
        self._prbsCheckDep = [v.checkPayload for k, v in rx.items()]
        self._prbsCountDep = [v.rxCount for k, v in rx.items()]
        self._prbsErrorDep = [v.rxErrors for k, v in rx.items()]
        self._prbsRateDep = [v.rxRate for k, v in rx.items()]
        self._prbsBwDep = [v.rxBw for k, v in rx.items()]

        self.add(
            pr.LinkVariable(name='PrbsSize',
                            disp='{:#x}',
                            dependencies=self._prbsSizeDep,
                            linkedSet=self._setPrbsSize,
                            linkedGet=self._getPrbsSize))
        self.add(
            pr.LinkVariable(name='PrbsEn',
                            disp=[True, False],
                            dependencies=self._prbsEnDep,
                            linkedSet=self._setPrbsEn,
                            linkedGet=self._getPrbsEn))
        self.add(
            pr.LinkVariable(name='PrbsCheck',
                            dependencies=self._prbsCheckDep,
                            linkedGet=self._getPrbsCheck,
                            linkedSet=self._setPrbsCheck,
                            disp=[True, False]))
        self.add(
            pr.LinkVariable(name='PrbsCount',
                            dependencies=self._prbsCountDep,
                            linkedGet=self._getPrbsCount,
                            mode='RO',
                            disp='{}'))
        self.add(
            pr.LinkVariable(name='PrbsErrors',
                            dependencies=self._prbsErrorDep,
                            linkedGet=self._getPrbsErrors,
                            mode='RO',
                            disp='{}'))
        self.add(
            pr.LinkVariable(name='PrbsRate',
                            dependencies=self._prbsRateDep,
                            linkedGet=self._getPrbsRate,
                            units='Frames/s',
                            mode='RO',
                            disp='{:0.2e}'))
        self.add(
            pr.LinkVariable(name='PrbsBw',
                            dependencies=self._prbsBwDep,
                            linkedGet=self._getPrbsBw,
                            units='Bytes/s',
                            mode='RO',
                            disp='{:0.2e}'))
Beispiel #15
0
    def __init__(self, name='PrbsMultiRx', fwTx=None, swRx=None):
        pr.Device.__init__(self, name=name)

        self._prbsSizeDep = [v.PacketLength for v in fwTx]
        self._prbsEnDep = [v.TxEn for v in fwTx]
        self._prbsCheckDep = [v.checkPayload for v in swRx]
        self._prbsCountDep = [v.rxCount for v in swRx]
        self._prbsErrorDep = [v.rxErrors for v in swRx]
        self._prbsRateDep = [v.rxRate for v in swRx]
        self._prbsBwDep = [v.rxBw for v in swRx]

        self.add(
            pr.LinkVariable(name='PrbsSize',
                            disp='{:#x}',
                            dependencies=self._prbsSizeDep,
                            linkedSet=self._setPrbsSize,
                            linkedGet=self._getPrbsSize))
        self.add(
            pr.LinkVariable(name='PrbsEn',
                            disp=[True, False],
                            dependencies=self._prbsEnDep,
                            linkedSet=self._setPrbsEn,
                            linkedGet=self._getPrbsEn))
        self.add(
            pr.LinkVariable(name='PrbsCheck',
                            dependencies=self._prbsCheckDep,
                            linkedGet=self._getPrbsCheck,
                            linkedSet=self._setPrbsCheck,
                            disp=[True, False]))
        self.add(
            pr.LinkVariable(name='PrbsCount',
                            dependencies=self._prbsCountDep,
                            linkedGet=self._getPrbsCount,
                            mode='RO',
                            disp='{}'))
        self.add(
            pr.LinkVariable(name='PrbsErrors',
                            dependencies=self._prbsErrorDep,
                            linkedGet=self._getPrbsErrors,
                            mode='RO',
                            disp='{}'))
        self.add(
            pr.LinkVariable(name='PrbsRate',
                            dependencies=self._prbsRateDep,
                            linkedGet=self._getPrbsRate,
                            units='Frames/s',
                            mode='RO',
                            disp='{:0.2e}'))
        self.add(
            pr.LinkVariable(name='PrbsBw',
                            dependencies=self._prbsBwDep,
                            linkedGet=self._getPrbsBw,
                            units='Bytes/s',
                            mode='RO',
                            disp='{:0.2e}'))
Beispiel #16
0
        def addPair(name, offset, mode, conv, units):
            self.add(pr.RemoteVariable(
                name = name+'Raw',
                hidden = False,
                mode = mode,
                offset = offset,
                base = pr.UInt))

            raw = self.nodes[name+'Raw']

            self.add(pr.LinkVariable(
                name = name,
                mode = mode,
                units = units,
                variable = raw,
                linkedGet = conv(raw),
                disp = '{:1.3f}'))
Beispiel #17
0
        def addPair(name, description, offset):
            """Add a Raw ADC register variable and corresponding converted value Variable"""
            self.add(
                pr.RemoteVariable(name=name + "Raw",
                                  offset=offset,
                                  bitSize=12,
                                  bitOffset=0,
                                  units="3.3V/4095",
                                  base=pr.UInt,
                                  disp='{:#x}',
                                  mode='RW',
                                  description=description))

            self.add(
                pr.LinkVariable(name=name,
                                linkedGet=dac.convtFloat,
                                dependencies=[self.variables[name + "Raw"]]))
Beispiel #18
0
    def __init__(self, **kwargs):

        super().__init__(**kwargs)
        self._localValue = 0

        self.add(
            pr.RemoteVariable(
                name="TestRemote",
                offset=0x1c,
                bitSize=32,
                bitOffset=0x00,
                base=pr.UInt,
                mode="RW",
            ))

        self.add(
            pr.RemoteVariable(
                name="TestRemoteNoVerify",
                offset=0x08,
                verify=False,
                bitSize=32,
                bitOffset=0x00,
                base=pr.UInt,
                mode="RW",
            ))

        self.add(
            pr.LocalVariable(
                name="TestLocal",
                mode="RW",
                value=0,
                localGet=self._localGet,
                localSet=self._localSet,
            ))

        self.add(
            pr.LinkVariable(
                name="TestLink",
                mode="RW",
                linkedSet=self._linkedSet,
                linkedGet=self._linkedGet,
            ))
Beispiel #19
0
        def addBoolPair(name, description, rdOffset, wrOffset, bitOffset):
            self.add(
                pr.RemoteVariable(
                    name=(name + "Read"),
                    description=description,
                    offset=rdOffset,
                    bitSize=1,
                    bitOffset=bitOffset,
                    base=pr.Bool,
                    mode='RO',
                    hidden=True,
                ))
            self.add(
                pr.RemoteVariable(
                    name=(name + "Write"),
                    description=description,
                    offset=wrOffset,
                    bitSize=1,
                    bitOffset=bitOffset,
                    base=pr.Bool,
                    mode='WO',
                    hidden=True,
                ))

            rdVar = self.variables[name + "Read"]
            wrVar = self.variables[name + "Write"]

            self.add(
                pr.LinkVariable(
                    name=name,
                    description=description,
                    mode='RW',
                    linkedGet=lambda: rdVar.value(),
                    linkedSet=lambda value, write: wrVar.set(value),
                    dependencies=[rdVar],
                    enum={
                        False: 'False',
                        True: 'True',
                    },
                ))
Beispiel #20
0
    def __init__(self,
                 description="RX Status of PGP 4 link",
                 numVc=4,
                 statusCountBits=16,
                 errorCountBits=8,
                 **kwargs):
        super().__init__(description=description, **kwargs)

        devOffset = 0x400

        def addStatusCountVar(**ecvkwargs):
            self.add(
                pr.RemoteVariable(bitSize=statusCountBits,
                                  mode='RO',
                                  disp='{:d}',
                                  pollInterval=1,
                                  **ecvkwargs))

        def addErrorCountVar(**ecvkwargs):
            self.add(
                pr.RemoteVariable(bitSize=errorCountBits,
                                  mode='RO',
                                  disp='{:d}',
                                  pollInterval=1,
                                  **ecvkwargs))

        for i in range(numVc):
            addStatusCountVar(
                name=f'RemPauseCnt[{i}]',
                offset=(0x400 + (4 * i) - devOffset),
            )

        for i in range(numVc):
            addErrorCountVar(
                name=f'RemOverflowCnt[{i}]',
                offset=(0x440 + (4 * i) - devOffset),
            )

        addStatusCountVar(
            name='FrameCnt',
            offset=(0x500 - devOffset),
        )

        addStatusCountVar(
            name='OpCodeEnCnt',
            offset=(0x504 - devOffset),
        )

        statusList = [
            ['PhyRxActive', True],
            ['PhyRxInit', False],
            ['GearboxAligned', True],
            ['LinkReady', True],
            ['RemRxLinkReady', True],
            ['FrameError', False],
            ['LinkDown', False],
            ['LinkError', False],
            ['EbOverflow', False],
            ['CellError', False],
            ['CellSofError', False],
            ['CellSeqError', False],
            ['CellVersionError', False],
            ['CellCrcModeError', False],
            ['CellCrcError', False],
            ['CellEofeError', False],
        ]

        for i in range(len(statusList)):
            addErrorCountVar(
                name=(statusList[i][0] + 'Cnt'),
                offset=(0x600 + (4 * i) - devOffset),
            )

        for i in range(len(statusList)):
            if statusList[i][1]:
                self.add(
                    pr.RemoteVariable(
                        name=statusList[i][0],
                        offset=(0x710 - devOffset),
                        bitOffset=i,
                        bitSize=1,
                        base=pr.Bool,
                        mode='RO',
                        pollInterval=1,
                    ))

        self.add(
            pr.RemoteVariable(
                name='RemLinkData',
                offset=(0x720 - devOffset),
                bitSize=48,
                mode='RO',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='RemOpCodeData',
                offset=(0x730 - devOffset),
                bitSize=48,
                mode='RO',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='RemRxPause',
                offset=(0x740 - devOffset),
                bitSize=numVc,
                mode='RO',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name="RxClockFreqRaw",
                offset=(0x750 - devOffset),
                bitSize=32,
                mode='RO',
                hidden=True,
                pollInterval=1,
            ))

        self.add(
            pr.LinkVariable(
                name="RxClockFrequency",
                units="MHz",
                mode='RO',
                dependencies=[self.RxClockFreqRaw],
                linkedGet=lambda: self.RxClockFreqRaw.value() * 1.0e-6,
                disp='{:0.3f}',
            ))
Beispiel #21
0
    def __init__(self,
                 name='AxiVersion',
                 description='AXI-Lite Version Module',
                 numUserConstants=0,
                 **kwargs):

        super().__init__(name=name, description=description, **kwargs)

        ##############################
        # Variables
        ##############################

        self.add(
            pr.RemoteVariable(
                name='FpgaVersion',
                description='FPGA Firmware Version Number',
                offset=0x00,
                bitSize=32,
                bitOffset=0x00,
                base=pr.UInt,
                mode='RO',
                disp='{:#08x}',
            ))

        self.add(
            pr.RemoteVariable(name='ScratchPad',
                              description='Register to test reads and writes',
                              offset=0x04,
                              bitSize=32,
                              bitOffset=0x00,
                              base=pr.UInt,
                              mode='RW',
                              disp='{:#08x}'))

        self.add(
            pr.RemoteVariable(name='UpTimeCnt',
                              description='Number of seconds since last reset',
                              hidden=True,
                              offset=0x08,
                              bitSize=32,
                              bitOffset=0x00,
                              base=pr.UInt,
                              mode='RO',
                              disp='{:d}',
                              units='seconds',
                              pollInterval=1))

        self.add(
            pr.LinkVariable(
                name='UpTime',
                mode='RO',
                dependencies=[self.UpTimeCnt],
                linkedGet=lambda: str(
                    datetime.timedelta(seconds=self.UpTimeCnt.value()))))

        self.add(
            pr.RemoteVariable(
                name='FpgaReloadHalt',
                description='Used to halt automatic reloads via AxiVersion',
                offset=0x100,
                bitSize=1,
                bitOffset=0x00,
                base=pr.UInt,
                mode='RW',
            ))

        self.add(
            pr.RemoteCommand(
                name='FpgaReload',
                description='Optional Reload the FPGA from the attached PROM',
                offset=0x104,
                bitSize=1,
                bitOffset=0x00,
                base=pr.UInt,
                function=lambda cmd: cmd.post(1)))

        self.add(
            pr.RemoteVariable(
                name='FpgaReloadAddress',
                description='Reload start address',
                offset=0x108,
                bitSize=32,
                bitOffset=0x00,
                base=pr.UInt,
                mode='RW',
            ))

        @self.command(hidden=True)
        def FpgaReloadAtAddress(arg):
            self.FpgaReloadAddress.set(arg)
            self.FpgaReload()

        self.add(
            pr.RemoteVariable(
                name='UserReset',
                description='Optional User Reset',
                offset=0x10C,
                bitSize=1,
                bitOffset=0x00,
                base=pr.UInt,
                mode='RW',
            ))

        self.add(
            pr.RemoteVariable(
                name='FdSerial',
                description='Board ID value read from DS2411 chip',
                offset=0x300,
                bitSize=64,
                bitOffset=0x00,
                base=pr.UInt,
                mode='RO',
            ))

        self.addRemoteVariables(
            name='UserConstants',
            description='Optional user input values',
            offset=0x400,
            bitSize=32,
            bitOffset=0x00,
            base=pr.UInt,
            mode='RO',
            number=numUserConstants,
            stride=4,
            hidden=True,
        )

        self.add(
            pr.RemoteVariable(
                name='DeviceId',
                description='Device Identification  (configued by generic)',
                offset=0x500,
                bitSize=32,
                bitOffset=0x00,
                base=pr.UInt,
                mode='RO',
            ))

        self.add(
            pr.RemoteVariable(
                name='GitHash',
                description='GIT SHA-1 Hash',
                offset=0x600,
                bitSize=160,
                bitOffset=0x00,
                base=pr.UInt,
                mode='RO',
                hidden=True,
            ))

        self.add(
            pr.LinkVariable(name='GitHashShort',
                            dependencies=[self.GitHash],
                            disp='{:07x}',
                            linkedGet=lambda: self.GitHash.value() >> 132))

        self.add(
            pr.RemoteVariable(
                name='DeviceDna',
                description='Xilinx Device DNA value burned into FPGA',
                offset=0x700,
                bitSize=128,
                bitOffset=0x00,
                base=pr.UInt,
                mode='RO',
            ))

        self.add(
            pr.RemoteVariable(
                name='BuildStamp',
                description='Firmware Build String',
                offset=0x800,
                bitSize=8 * 256,
                bitOffset=0x00,
                base=pr.String,
                mode='RO',
                hidden=True,
            ))

        def parseBuildStamp(var, value, disp):
            p = parse.parse(
                "{ImageName}: {BuildEnv}, {BuildServer}, Built {BuildDate} by {Builder}",
                value.strip())
            if p is not None:
                for k, v in p.named.items():
                    self.node(k).set(v)

        self.add(pr.LocalVariable(name='ImageName', mode='RO', value=''))

        self.add(pr.LocalVariable(name='BuildEnv', mode='RO', value=''))

        self.add(pr.LocalVariable(name='BuildServer', mode='RO', value=''))

        self.add(pr.LocalVariable(name='BuildDate', mode='RO', value=''))

        self.add(pr.LocalVariable(name='Builder', mode='RO', value=''))

        self.BuildStamp.addListener(parseBuildStamp)
Beispiel #22
0
    def __init__(   self, 
            name        = "XpmApp", 
            description = "XPM Module", 
            **kwargs):
        super().__init__(name=name, description=description, **kwargs)

        ##############################
        # Variables
        ##############################

        self.add(pr.RemoteVariable(    
            name         = "paddr",
            description  = "Timing link address",
            offset       =  0x00,
            bitSize      =  32,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))

        self.add(pr.RemoteVariable(    
            name         = "partition",
            description  = "partition index",
            offset       =  0x04,
            bitSize      =  4,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))

        self.add(pr.RemoteVariable(    
            name         = "link",
            description  = "link index",
            offset       =  0x04,
            bitSize      =  6,
            bitOffset    =  0x04,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))

        self.add(pr.RemoteVariable(    
            name         = "linkDebug",
            description  = "debug link index",
            offset       =  0x05,
            bitSize      =  4,
            bitOffset    =  0x02,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))

        self.add(pr.RemoteVariable(    
            name         = "amc",
            description  = "amc index",
            offset       =  0x06,
            bitSize      =  1,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))

        self.add(pr.RemoteVariable(    
            name         = "inhibit",
            description  = "inhibit index",
            offset       =  0x06,
            bitSize      =  2,
            bitOffset    =  0x04,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))

        self.add(pr.RemoteVariable(    
            name         = "tagStream",
            description  = "Enable tag stream fifo input",
            offset       =  0x07,
            bitSize      =  1,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))

        self.add(pr.RemoteVariable(    
            name         = "usRxEnable",
            description  = "Upstream receive enable",
            offset       =  0x07,
            bitSize      =  1,
            bitOffset    =  0x1,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))

        self.add(pr.RemoteVariable(    
            name         = "cuRxEnable",
            description  = "Copper receive enable",
            offset       =  0x07,
            bitSize      =  1,
            bitOffset    =  0x02,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))

        self.add(pr.RemoteVariable(    
            name         = "fullMask",
            description  = "Readout group full mask",
            offset       =  0x08,
            bitSize      =  8,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
        ))

        if False:
            self.add(pr.RemoteVariable(    
                name         = "rxTimeout",
                description  = "Receive timeout",
                offset       =  0x09,
                bitSize      =  9,
                bitOffset    =  0x01,
                base         = pr.UInt,
                mode         = "RW",
            ))

        self.add(pr.RemoteVariable(    
            name         = "txPllReset",
            description  = "Transmit PLL reset",
            offset       =  0x0a,
            bitSize      =  1,
            bitOffset    =  0x02,
            base         = pr.UInt,
            mode         = "RW",
        ))

        self.add(pr.RemoteVariable(    
            name         = "rxPllReset",
            description  = "Receive PLL reset",
            offset       =  0x0a,
            bitSize      =  1,
            bitOffset    =  0x03,
            base         = pr.UInt,
            mode         = "RW",
        ))

        if False:
            self.add(pr.RemoteVariable(    
                name         = "trigSrc",
                description  = "L1 trigger source id",
                offset       =  0x0b,
                bitSize      =  4,
                bitOffset    =  0x00,
                base         = pr.UInt,
                mode         = "RW",
            ))

        self.add(pr.RemoteVariable(    
            name         = "loopback",
            description  = "Loopback enable",
            offset       =  0x0b,
            bitSize      =  1,
            bitOffset    =  0x04,
            base         = pr.UInt,
            mode         = "RW",
        ))

        self.add(pr.RemoteVariable(    
            name         = "txReset",
            description  = "Tx reset",
            offset       =  0x0b,
            bitSize      =  1,
            bitOffset    =  0x05,
            base         = pr.UInt,
            mode         = "RW",
        ))

        self.add(pr.RemoteVariable(    
            name         = "rxReset",
            description  = "Rx reset",
            offset       =  0x0b,
            bitSize      =  1,
            bitOffset    =  0x06,
            base         = pr.UInt,
            mode         = "RW",
        ))

        self.add(pr.RemoteVariable(    
            name         = "fullEn",
            description  = "Deadtime enable",
            offset       =  0x0b,
            bitSize      =  1,
            bitOffset    =  0x07,
            base         = pr.UInt,
            mode         = "RW",
        ))

        self.add(pr.RemoteVariable(    
            name         = "dsLinkStatus",
            description  = "link status summary",
            offset       =  0x0c,
            bitSize      =  32,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RO",
        ))

        def _rxErrCnt(var,read):
            return var.dependencies[0].get(read)&0xffff

        self.add(pr.LinkVariable(    
            name         = "rxErrCnt",
            description  = "Receive error counts",
            linkedGet    = _rxErrCnt,
            dependencies = [self.dsLinkStatus]
        ))

        def _txResetDone(var,read):
            return (var.dependencies[0].get(read)>>16)&1

        self.add(pr.LinkVariable(    
            name         = "txResetDone",
            description  = "Tx reset done",
            linkedGet    = _txResetDone,
            dependencies = [self.dsLinkStatus]
        ))

        def _txReady(var,read):
            return (var.dependencies[0].get(read)>>17)&1

        self.add(pr.LinkVariable(    
            name         = "txReady",
            description  = "Tx ready",
            linkedGet    = _txReady,
            dependencies = [self.dsLinkStatus]
        ))

        def _rxResetDone(var,read):
            return (var.dependencies[0].get(read)>>18)&1

        self.add(pr.LinkVariable(    
            name         = "rxResetDone",
            description  = "Rx reset done",
            linkedGet    = _rxResetDone,
            dependencies = [self.dsLinkStatus]
        ))

        def _rxReady(var,read):
            return (var.dependencies[0].get(read)>>19)&1

        self.add(pr.LinkVariable(    
            name         = "rxReady",
            description  = "Rx ready",
            linkedGet    = _rxReady,
            dependencies = [self.dsLinkStatus]
        ))

        def _rxIsXpm(var,read):
            return (var.dependencies[0].get(read)>>20)&1

        self.add(pr.LinkVariable(    
            name         = "rxIsXpm",
            description  = "Remote link partner is XPM",
            linkedGet    = _rxIsXpm,
            dependencies = [self.dsLinkStatus]
        ))

        self.add(pr.RemoteVariable(    
            name         = "dsLinkRxCnt",
            description  = "Rx message count",
            offset       =  0x10,
            bitSize      =  32,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RO",
        ))

        self.add(Si5317(    
            name         = "amcPLL",
            offset       =  0x14,
        ))

        self.add(pr.RemoteVariable(    
            name         = "l0Reset",
            description  = "L0 trigger reset",
            offset       =  0x18,
            bitSize      =  1,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
        ))

        self.add(pr.RemoteVariable(    
            name         = "l0En",
            description  = "L0 trigger enable",
            offset       =  0x1a,
            bitSize      =  1,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
        ))

        self.add(pr.RemoteVariable(    
            name         = "l0Master",
            description  = "L0 trigger master",
            offset       =  0x1b,
            bitSize      =  1,
            bitOffset    =  0x06,
            base         = pr.UInt,
            mode         = "RW",
        ))

        self.add(pr.RemoteVariable(    
            name         = "l0CntEn",
            description  = "L0 counter enable",
            offset       =  0x1b,
            bitSize      =  1,
            bitOffset    =  0x07,
            base         = pr.UInt,
            mode         = "RW",
        ))

        self.add(pr.RemoteVariable(    
            name         = "l0RateSel",
            description  = "L0 rate select",
            offset       =  0x1c,
            bitSize      =  16,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
        ))

        self.add(pr.RemoteVariable(    
            name         = "l0DestSel",
            description  = "L0 destination select",
            offset       =  0x1e,
            bitSize      =  16,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
        ))

        self.add(pr.RemoteVariable(
            name         = "l0Stats",
            description  = "L0 Statistics",
            offset       =  0x20,
            bitSize      =  320,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RO",
        ))

        self.add(pr.RemoteVariable(    
            name         = "numL1Acc",
            description  = "L1 accept count",
            offset       =  0x48,
            bitSize      =  64,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RO",
        ))

        if False:
            self.add(pr.RemoteVariable(    
                name         = "l1Clr",
                description  = "L1 trigger clear mask",
                offset       =  0x50,
                bitSize      =  16,
                bitOffset    =  0x00,
                base         = pr.UInt,
                mode         = "RW",
            ))

            self.add(pr.RemoteVariable(    
                name         = "l1Ena",
                description  = "L1 trigger enable mask",
                offset       =  0x52,
                bitSize      =  16,
                bitOffset    =  0x00,
                base         = pr.UInt,
                mode         = "RW",
            ))

            self.add(pr.RemoteVariable(    
                name         = "l1Src",
                description  = "L1 trigger source",
                offset       =  0x54,
                bitSize      =  4,
                bitOffset    =  0x00,
                base         = pr.UInt,
                mode         = "RW",
            ))

            self.add(pr.RemoteVariable(    
                name         = "l1Word",
                description  = "L1 trigger word",
                offset       =  0x54,
                bitSize      =  9,
                bitOffset    =  0x04,
                base         = pr.UInt,
                mode         = "RW",
            ))

            self.add(pr.RemoteVariable(    
                name         = "l1Write",
                description  = "L1 trigger write mask",
                offset       =  0x56,
                bitSize      =  1,
                bitOffset    =  0x00,
                base         = pr.UInt,
                mode         = "RW",
            ))

            self.add(pr.RemoteVariable(    
                name         = "anaRst",
                description  = "Analysis tag reset",
                offset       =  0x58,
                bitSize      =  4,
                bitOffset    =  0x00,
                base         = pr.UInt,
                mode         = "RW",
            ))

            self.add(pr.RemoteVariable(    
                name         = "anaTag",
                description  = "Analysis tag",
                offset       =  0x5c,
                bitSize      =  32,
                bitOffset    =  0x00,
                base         = pr.UInt,
                mode         = "RW",
            ))

            self.add(pr.RemoteVariable(    
                name         = "anaPush",
                description  = "Analysis tag insert",
                offset       =  0x60,
                bitSize      =  32,
                bitOffset    =  0x00,
                base         = pr.UInt,
                mode         = "RW",
            ))

            self.add(pr.RemoteVariable(    
                name         = "anaTagWr",
                description  = "Analysis tag write counts",
                offset       =  0x64,
                bitSize      =  32,
                bitOffset    =  0x00,
                base         = pr.UInt,
                mode         = "RO",
            ))

            self.add(pr.RemoteVariable(    
                name         = "anaTagRd",
                description  = "Analysis tag read counts",
                offset       =  0x68,
                bitSize      =  32,
                bitOffset    =  0x00,
                base         = pr.UInt,
                mode         = "RO",
            ))
            
        self.add(pr.RemoteVariable(    
            name         = "pipelineDepth",
            description  = "Pipeline depth",
            offset       =  0x6c,
            bitSize      =  32,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
        ))

        def pipelineGet(var,read):
            value = var.dependencies[0].get(read)
            return value>>16

        def pipelineSet(deps):
            def pipelineSetValue(var, value, write):
                val = ((value*200)&0xffff) | (value<<16)
                print('Setting pipeline reg to 0x{:x}'.format(val))
                deps[0].set(val,write)
            return pipelineSetValue

        self.add(pr.LinkVariable(
            name         = "l0Delay",
            linkedGet    = pipelineGet,
            linkedSet    = pipelineSet([self.pipelineDepth]),
            dependencies = [self.pipelineDepth]
        ))

        self.add(pr.RemoteVariable(    
            name         = "msgHdr",
            description  = "Message header",
            offset       =  0x70,
            bitSize      =  8,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False
        ))

        self.add(pr.RemoteVariable(    
            name         = "msgIns",
            description  = "Message insert",
            offset       =  0x71,
            bitSize      =  1,
            bitOffset    =  0x07,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False
        ))

        self.add(pr.RemoteVariable(    
            name         = "msgPayl",
            description  = "Message payload",
            offset       =  0x74,
            bitSize      =  32,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
        ))

        self.add(pr.RemoteVariable(    
            name         = "remId",
            description  = "Remote link ID",
            offset       =  0x78,
            bitSize      =  32,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RO",
        ))

        for i in range(4):
            self.add(XpmInhConfig(    
                name         = "inh_%d"%i,
                offset       =  0x80+4*i,
            ))

        self.add(pr.RemoteVariable(
            name         = "inhEvCnt",
            description  = "Inhibit event counts by link",
            offset       =  0x90,
            bitSize      =  1024,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RO",
        ))

        for i in range(4):
            self.add(pr.RemoteVariable(    
                name         = "monClk_%d"%i,
                description  = "Monitor clock rate",
                offset       =  0x110+4*i,
                bitSize      =  29,
                bitOffset    =  0x00,
                base         = pr.UInt,
                mode         = "RO",
            ))

        self.add(pr.RemoteVariable(    
            name         = "inhTmCnt",
            description  = "Inhibit time counts by link",
            offset       =  0x120,
            bitSize      =  1024,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RO",
        ))

        self.add(pr.RemoteVariable(    
            name         = "groupL0Reset",
            description  = "Group L0 reset",
            offset       =  0x200,
            bitSize      =  8,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))

        self.add(pr.RemoteVariable(    
            name         = "groupL0Enable",
            description  = "Group L0 enable",
            offset       =  0x204,
            bitSize      =  8,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))

        self.add(pr.RemoteVariable(    
            name         = "groupL0Disable",
            description  = "Group L0 disable",
            offset       =  0x208,
            bitSize      =  8,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))

        self.add(pr.RemoteVariable(    
            name         = "groupMsgInsert",
            description  = "Group message insert",
            offset       =  0x20c,
            bitSize      =  8,
            bitOffset    =  0x00,
            base         = pr.UInt,
            mode         = "RW",
            verify       = False,
        ))
Beispiel #23
0
    def __init__(self, simpleDisplay=True, advanceUser=False, **kwargs):
        super().__init__(size=(0x1000 << 2), **kwargs)

        self.add(
            pr.LocalVariable(
                name="CsvFilePath",
                description="Used if command's argument is empty",
                mode="RW",
                value="",
            ))

        ##############################
        # Commands
        ##############################
        @self.command(
            value='',
            description="Load the .CSV from CBPro.",
        )
        def LoadCsvFile(arg):
            # Check if non-empty argument
            if (arg != ""):
                path = arg
            else:
                # Use the variable path instead
                path = self.CsvFilePath.get()

            # Check for .csv file
            if fnmatch.fnmatch(path, '*.csv'):
                click.secho(f'{self.path}.LoadCsvFile(): {path}', fg='green')
            else:
                click.secho(f'{self.path}.LoadCsvFile(): {path} is not .csv',
                            fg='red')
                return

            # Power down during the configuration load
            self.Page0.PDN.set(True)

            # Open the .CSV file
            with open(path) as csvfile:
                reader = csv.reader(csvfile,
                                    delimiter=',',
                                    quoting=csv.QUOTE_NONE)
                # Loop through the rows in the CSV file
                for row in reader:
                    if (row[0] != 'Address'):
                        self._rawWrite(
                            offset=(int(row[0], 16) << 2),
                            data=int(row[1], 16),
                        )

            # Update local RemoteVariables and verify conflagration
            self.readBlocks(recurse=True)
            self.checkBlocks(recurse=True)

            # Execute the Page5.BW_UPDATE_PLL command
            self._rawWrite((0x500 << 2) | (0x14 << 2), 0x1)
            self._rawWrite((0x500 << 2) | (0x14 << 2), 0x0)

            # Power Up after the configuration load
            self.Page0.PDN.set(False)

            # Clear the internal error flags
            self.Page0.ClearIntErrFlag()

        ##############################
        # Devices
        ##############################
        self.add(
            silabs.Si5345Page0(offset=(0x000 << 2),
                               simpleDisplay=simpleDisplay,
                               expand=False))

        self.add(
            pr.LinkVariable(name='Locked',
                            description='Inverse of LOL',
                            mode='RO',
                            dependencies=[self.Page0.LOL],
                            linkedGet=lambda:
                            (False if self.Page0.LOL.value() else True)))
Beispiel #24
0
    def __init__(self,
                 name="SsiPrbsRx",
                 description="SsiPrbsRx",
                 rxClkPeriod=6.4e-9,
                 seedBits=32,
                 **kwargs):
        super().__init__(name=name, description=description, **kwargs)

        ##############################
        # Variables
        ##############################

        self.add(
            pr.RemoteVariable(
                name="MissedPacketCnt",
                description="Number of missed packets",
                offset=0x00,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name="LengthErrCnt",
                description="Number of packets that were the wrong length",
                offset=0x04,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name="EofeErrCnt",
                description="Number of EOFE errors",
                offset=0x08,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name="DataBusErrCnt",
                description="Number of data bus errors",
                offset=0x0C,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name="WordStrbErrCnt",
                description="Number of word errors",
                offset=0x10,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        # self.add(pr.RemoteVariable(
        # name         = "BitStrbErrCnt",
        # description  = "Number of bit errors",
        # offset       =  0x14,
        # bitSize      =  32,
        # mode         = "RO",
        # pollInterval = 1,
        # ))

        self.add(
            pr.RemoteVariable(
                name="RxFifoOverflowCnt",
                description="",
                offset=0x18,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name="RxFifoPauseCnt",
                description="",
                offset=0x1C,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name="TxFifoOverflowCnt",
                description="",
                offset=0x20,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name="TxFifoPauseCnt",
                description="",
                offset=0x24,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name="Dummy",
                description="",
                offset=0x28,
                bitSize=32,
                mode="RW",
            ))

        self.add(
            pr.RemoteVariable(
                name="Status",
                description="",
                offset=0x1C0,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name="PacketLength",
                description="",
                offset=0x1C4,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(name='WordSize',
                              offset=0xF1 << 2,
                              mode='RO',
                              disp='{:d}',
                              hidden=False))

        self.add(
            pr.RemoteVariable(
                name="PacketRateRaw",
                description="",
                offset=0x1C8,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        self.add(
            pr.LinkVariable(name='PacketRate',
                            dependencies=[self.PacketRateRaw],
                            units='Frames/sec',
                            disp='{:0.1f}',
                            linkedGet=lambda: 1.0 /
                            ((self.PacketRateRaw.value() + 1) * rxClkPeriod)))

        self.add(
            pr.LinkVariable(name='WordRate',
                            dependencies=[self.PacketRate, self.PacketLength],
                            units='Words/sec',
                            disp='{:0.1f}',
                            linkedGet=lambda: self.PacketRate.value() * self.
                            PacketLength.value()))

        self.add(
            pr.LinkVariable(name='BitRate',
                            dependencies=[self.WordRate, self.WordSize],
                            units='MBits/sec',
                            disp='{:0.1f}',
                            linkedGet=lambda: self.WordRate.value() * self.
                            WordSize.value() * 1e-6))

        # self.add(pr.RemoteVariable(
        # name         = "BitErrCnt",
        # description  = "",
        # offset       =  0x1CC,
        # bitSize      =  32,
        # mode         = "RO",
        # pollInterval = 1,
        # ))

        self.add(
            pr.RemoteVariable(
                name="WordErrCnt",
                description="",
                offset=0x1D0,
                bitSize=32,
                mode="RO",
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name="RolloverEnable",
                description="",
                offset=0x3C0,
                bitSize=32,
                mode="RW",
            ))

        self.add(
            pr.RemoteVariable(
                name="BypassErrorChecking",
                description="Used to bypass the error checking",
                offset=0x3F8,
                bitSize=1,
                mode="RW",
            ))

        self.add(
            pr.RemoteCommand(name="CountReset",
                             description="Status counter reset",
                             offset=0x3FC,
                             bitSize=1,
                             function=pr.BaseCommand.touchOne))
Beispiel #25
0
    def __init__(
            self,
            name="AxiSysMonUltraScale",
            description="AXI-Lite System Managment for Xilinx Ultra Scale (Refer to PG185)",
            XIL_DEVICE_G="ULTRASCALE",
            **kwargs):
        super().__init__(name=name, description=description, **kwargs)

        def addPair(
            name,
            offset,
            bitSize,
            units,
            bitOffset,
            description,
            function,
            pollInterval=0,
        ):
            self.add(
                pr.RemoteVariable(
                    name=("Raw" + name),
                    offset=offset,
                    bitSize=bitSize,
                    bitOffset=bitOffset,
                    mode='RO',
                    description=description,
                    pollInterval=pollInterval,
                    hidden=True,
                ))
            self.add(
                pr.LinkVariable(
                    name=name,
                    mode='RO',
                    units=units,
                    linkedGet=function,
                    typeStr="Float32",
                    dependencies=[self.variables["Raw" + name]],
                ))

        if XIL_DEVICE_G == "ULTRASCALE":
            self.convTemp = self.convTempSYSMONE1
            self.convSetTemp = self.convSetTempSYSMONE1
        elif XIL_DEVICE_G == "ULTRASCALE_PLUS":
            self.convTemp = self.convTempSYSMONE4
            self.convSetTemp = self.convSetTempSYSMONE4
        else:
            raise Exception(
                'AxiSysMonUltraScale: Device {} not supported'.format(
                    XIL_DEVICE_G))

        ##############################
        # Variables
        ##############################

        self.add(
            pr.RemoteVariable(
                name="SR",
                description="Status Register",
                offset=0x04,
                bitSize=32,
                bitOffset=0x00,
                mode="RO",
                hidden=True,
            ))

        self.add(
            pr.RemoteVariable(
                name="AOSR",
                description="Alarm Output Status Register",
                offset=0x08,
                bitSize=32,
                bitOffset=0x00,
                mode="RO",
                hidden=True,
            ))

        self.add(
            pr.RemoteVariable(
                name="CONVSTR",
                description="CONVST Register",
                offset=0x0C,
                bitSize=32,
                bitOffset=0x00,
                mode="WO",
                hidden=True,
            ))

        self.add(
            pr.RemoteVariable(
                name="SYSMONRR",
                description="SYSMON Hard Macro Reset Register",
                offset=0x10,
                bitSize=32,
                bitOffset=0x00,
                mode="WO",
                hidden=True,
            ))

        self.add(
            pr.RemoteVariable(
                name="GIER",
                description="Global Interrupt Enable Register",
                offset=0x5C,
                bitSize=32,
                bitOffset=0x00,
                mode="RW",
                hidden=True,
            ))

        self.add(
            pr.RemoteVariable(
                name="IPISR",
                description="IP Interrupt Status Register",
                offset=0x60,
                bitSize=32,
                bitOffset=0x00,
                mode="RO",
                hidden=True,
            ))

        self.add(
            pr.RemoteVariable(
                name="IPIER",
                description="IP Interrupt Enable Register",
                offset=0x68,
                bitSize=32,
                bitOffset=0x00,
                mode="RW",
                hidden=True,
            ))

        ###############################################

        addPair(
            name='Temperature',
            offset=0x400,
            bitSize=12,
            bitOffset=4,
            units="degC",
            function=self.convTemp,
            pollInterval=5,
            description="Temperature's ADC value",
        )

        addPair(
            name='VccInt',
            offset=0x404,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="VCCINT's ADC value",
        )

        addPair(
            name='VccAux',
            offset=0x408,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="VCCAUX's ADC value",
        )

        addPair(
            name='VpVn',
            offset=0x40C,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="VP/VN's ADC value",
        )

        addPair(
            name='Vrefp',
            offset=0x410,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="VREFP's ADC value",
        )

        addPair(
            name='Vrefn',
            offset=0x414,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="VREFN's ADC value",
        )

        addPair(
            name='VccBram',
            offset=0x418,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="VBRAM's ADC value",
        )

        addPair(
            name='SupplyOffset',
            offset=0x420,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="Supply Offset",
        )

        addPair(
            name='AdcOffset',
            offset=0x424,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="ADC Offset",
        )

        addPair(
            name='GainError',
            offset=0x428,
            bitSize=12,
            bitOffset=4,
            units="",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="Gain Offset",
        )

        addPair(
            name='VauxpVauxn',
            offset=0x440,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convAuxVoltage,
            pollInterval=5,
            description="VAUXP_VAUXN's ADC values",
        )

        addPair(
            name='MaxTemperature',
            offset=0x480,
            bitSize=12,
            bitOffset=4,
            units="degC",
            function=self.convTemp,
            pollInterval=5,
            description="maximum temperature measurement",
        )

        addPair(
            name='MaxVccInt',
            offset=0x484,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="maximum VCCINT measurement",
        )

        addPair(
            name='MaxVccAux',
            offset=0x488,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="maximum VCCAUX measurement",
        )

        addPair(
            name='MaxVccBram',
            offset=0x48C,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="maximum VBRAM measurement",
        )

        addPair(
            name='MinTemperature',
            offset=0x490,
            bitSize=12,
            bitOffset=4,
            units="degC",
            function=self.convTemp,
            pollInterval=5,
            description="minimum temperature measurement",
        )

        addPair(
            name='MinVccInt',
            offset=0x494,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="minimum VCCINT measurement",
        )

        addPair(
            name='MinVccAux',
            offset=0x498,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="minimum VCCAUX measurement",
        )

        addPair(
            name='MinVccBram',
            offset=0x49C,
            bitSize=12,
            bitOffset=4,
            units="V",
            function=self.convCoreVoltage,
            pollInterval=5,
            description="minimum VBRAM measurement",
        )

        self.add(
            pr.RemoteVariable(
                name="I2cAddress",
                description="I2C Address",
                offset=0x4E0,
                bitSize=32,
                bitOffset=0x00,
                mode="RO",
                hidden=True,
            ))

        self.add(
            pr.RemoteVariable(
                name="FlagRegister",
                description="Flag Register",
                offset=0x4FC,
                bitSize=32,
                bitOffset=0x00,
                mode="RO",
                hidden=True,
            ))

        #        self.addRemoteVariables(
        #            name         = "Configuration",
        #            description  = "Configuration Registers",
        #            offset       =  0x500,
        #            bitSize      =  32,
        #            bitOffset    =  0x00,
        #            mode         = "RW",
        #            number       =  4,
        #            stride       =  4,
        #            hidden       =  True,
        #        )

        self.add(
            pr.RemoteVariable(
                name="SequenceReg8",
                description="Sequence Register 8",
                offset=0x518,
                bitSize=32,
                bitOffset=0x00,
                mode="RW",
                hidden=True,
            ))

        self.add(
            pr.RemoteVariable(
                name="SequenceReg9",
                description="Sequence Register 9",
                offset=0x51C,
                bitSize=32,
                bitOffset=0x00,
                mode="RW",
                hidden=True,
            ))

        self.addRemoteVariables(
            name="SequenceReg_7_0",
            description="Sequence Register [7:0]",
            offset=0x520,
            bitSize=32,
            bitOffset=0x00,
            mode="RW",
            number=8,
            stride=4,
            hidden=True,
        )

        #        self.addRemoteVariables(
        #            name         = "AlarmThresholdReg_8_0",
        #            description  = "Alarm Threshold Register [8:0]",
        #            offset       =  0x540,
        #            bitSize      =  32,
        #            bitOffset    =  0x00,
        #            mode         = "RW",
        #            number       =  9,
        #            stride       =  4,
        #            hidden       =  True,
        #       )

        self.add(
            pr.RemoteVariable(
                name="OTThresholdDisable",
                description="Set 1 to disable OT threshold",
                offset=0x504,
                bitSize=1,
                bitOffset=0x0,
                mode="RW",
            ))

        self.add(
            pr.RemoteVariable(
                name="OTAutomaticShutdown",
                description=
                "OT_AUTOMATIC_SHUTDOWN, set to 0x3 to enable (defatul 125 degC)",
                offset=0x54C,
                bitSize=4,
                bitOffset=0x0,
                mode="RW",
            ))

        self.add(
            pr.RemoteVariable(
                name="OTUpperThresholdRaw",
                description="UPPER_OT threshold",
                offset=0x54C,
                bitSize=12,
                bitOffset=0x4,
                mode="RW",
            ))

        self.add(
            pr.LinkVariable(
                name="OTUpperThreshold",
                mode='RW',
                units='degC',
                linkedGet=self.convTemp,
                linkedSet=self.convSetTemp,
                typeStr="Float32",
                dependencies=[self.variables["OTUpperThresholdRaw"]],
            ))

        self.add(
            pr.RemoteVariable(
                name="OTLowerThresholdRaw",
                description="LOWER_OT threshold",
                offset=0x55C,
                bitSize=12,
                bitOffset=0x4,
                mode="RW",
            ))

        self.add(
            pr.LinkVariable(
                name="OTLowerThreshold",
                mode='RW',
                units='degC',
                linkedGet=self.convTemp,
                linkedSet=self.convSetTemp,
                typeStr="Float32",
                dependencies=[self.variables["OTLowerThresholdRaw"]],
            ))

        self.add(
            pr.RemoteVariable(
                name="AlarmThresholdReg12",
                description="Alarm Threshold Register 12",
                offset=0x570,
                bitSize=32,
                bitOffset=0x00,
                mode="RW",
                hidden=True,
            ))

        self.addRemoteVariables(
            name="AlarmThresholdReg_25_16",
            description="Alarm Threshold Register [25:16]",
            offset=0x580,
            bitSize=32,
            bitOffset=0x00,
            mode="RW",
            number=8,
            stride=4,
            hidden=True,
        )

        self.addRemoteVariables(
            name="Vuser",
            description="VUSER[4:0] supply monitor measurement",
            offset=0x600,
            bitSize=32,
            bitOffset=0x00,
            mode="RO",
            number=4,
            stride=4,
            hidden=True,
        )

        self.addRemoteVariables(
            name="MaxVuser",
            description="Maximum VUSER[4:0] supply monitor measurement",
            offset=0x680,
            bitSize=32,
            bitOffset=0x00,
            mode="RO",
            number=4,
            stride=4,
            hidden=True,
        )

        self.addRemoteVariables(
            name="MinVuser",
            description="Minimum VUSER[4:0] supply monitor measurement",
            offset=0x6A0,
            bitSize=32,
            bitOffset=0x00,
            mode="RO",
            number=4,
            stride=4,
            hidden=True,
        )

        # Default to simple view
        self.simpleView()
Beispiel #26
0
    def __init__(   self,
            name        = "SpiCryo",
            description = "SpiCryo module",
            **kwargs):
        super().__init__(name=name, description=description, **kwargs)

        ## _rawWrite/_rawRead
        self.write_address = 0x0
        self.read_address  = 0x4

        self.relay_address = 0x2
        self.hemt_bias_address = 0x3
        self.a50K_bias_address = 0x4
        self.temperature_address = 0x5
        self.cycle_count_address = 0x6  # used for testing
        self.ps_en_address = 0x7 # PS enable (HEMT: bit 0, 50k: bit 1)
        self.ac_dc_status_address = 0x8 # AC/DC mode status (bit 0: FRN_RLY, bit 1: FRP_RLY)
        self.adc_scale = 3.3/(1024.0 * 5)
        self.temperature_scale = 1/.028 # was 100
        self.temperature_offset =.25
        self.bias_scale = 1.0
        self.max_retries = 5  #number of re-tries waiting for response
        self.retry = 0 # counts nubmer of retries
        self.busy_retry = 0  # counts number of retries due to relay busy status

        self.add(pr.RemoteVariable(
            name        = "write",
            description = "write - 32 bits",
            offset      = 0x0,
            bitSize     = 32,
            base        = pr.UInt,
            mode        = "WO",
            hidden      = True,
        ))

        self.add(pr.RemoteVariable(
            name        = "read",
            description = "read - 32 bits",
            offset      = 0x4,
            bitSize     = 32,
            base        = pr.UInt,
            mode        = "RO",
            hidden      = True,
        ))

        self.add(pr.LinkVariable(
            name         = "temperature",
            description  = "temperature",
            dependencies = [],
            linkedGet    = lambda dev, var, read: dev.read_temperature(dev, var, read),
            typeStr      = "Float64",
            mode         = "RO",
        ))

        self.add(pr.LinkVariable(
            name         = "50kBias",
            description  = "temperature",
            dependencies = [],
            linkedGet    = lambda dev, var, read: dev.read_50k_bias(dev, var, read),
            typeStr      = "Float64",
            mode         = "RO",
        ))



        self.add(pr.LinkVariable(
            name         = "hemtBias",
            description  = "hemtBias",
            dependencies = [],
            linkedGet    = lambda dev, var, read: dev.read_hemt_bias(dev, var, read),
            typeStr      = "Float64",
            mode         = "RO",
        ))
Beispiel #27
0
    def __init__(self,
                 description="TX Status of PGP 4 link",
                 numVc=4,
                 statusCountBits=16,
                 errorCountBits=8,
                 **kwargs):
        super().__init__(description=description, **kwargs)

        devOffset = 0x800

        def addStatusCountVar(**ecvkwargs):
            self.add(
                pr.RemoteVariable(bitSize=statusCountBits,
                                  mode='RO',
                                  disp='{:d}',
                                  pollInterval=1,
                                  **ecvkwargs))

        def addErrorCountVar(**ecvkwargs):
            self.add(
                pr.RemoteVariable(bitSize=errorCountBits,
                                  mode='RO',
                                  disp='{:d}',
                                  pollInterval=1,
                                  **ecvkwargs))

        for i in range(numVc):
            addStatusCountVar(
                name=f'LocPauseCnt[{i}]',
                offset=(0x800 + (4 * i) - devOffset),
            )

        for i in range(numVc):
            addErrorCountVar(
                name=f'LocOverflowCnt[{i}]',
                offset=(0x840 + (4 * i) - devOffset),
            )

        addStatusCountVar(
            name='FrameCnt',
            offset=(0x900 - devOffset),
        )

        addStatusCountVar(
            name='OpCodeEnCnt',
            offset=(0x904 - devOffset),
        )

        statusList = [
            ['phyTxActive', True],
            ['LinkReady', True],
            ['FrameError', False],
        ]

        for i in range(len(statusList)):
            addErrorCountVar(
                name=(statusList[i][0] + 'Cnt'),
                offset=(0xA00 + (4 * i) - devOffset),
            )

        for i in range(len(statusList)):
            if statusList[i][1]:
                self.add(
                    pr.RemoteVariable(
                        name=statusList[i][0],
                        offset=(0xB10 - devOffset),
                        bitOffset=i,
                        bitSize=1,
                        base=pr.Bool,
                        mode='RO',
                        pollInterval=1,
                    ))

        self.add(
            pr.RemoteVariable(
                name='LocLinkData',
                offset=(0xB20 - devOffset),
                bitSize=48,
                mode='RO',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='LocOpCodeData',
                offset=(0xB30 - devOffset),
                bitSize=48,
                mode='RO',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='LocTxPause',
                offset=(0xB40 - devOffset),
                bitSize=numVc,
                mode='RO',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name="TxClockFreqRaw",
                offset=(0xB50 - devOffset),
                bitSize=32,
                mode='RO',
                hidden=True,
                pollInterval=1,
            ))

        self.add(
            pr.LinkVariable(
                name="TxClockFrequency",
                units="MHz",
                mode='RO',
                dependencies=[self.TxClockFreqRaw],
                linkedGet=lambda: self.TxClockFreqRaw.value() * 1.0e-6,
                disp='{:0.3f}',
            ))
Beispiel #28
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        ################
        # Lower Page 00h
        ################

        self.addRemoteVariables(
            name='DevMon',
            description='Diagnostic Monitor Data',
            offset=(22 << 2),
            bitSize=8,
            mode='RO',
            number=6,
            stride=4,
            hidden=True,
        )

        self.add(
            pr.LinkVariable(
                name='Temperature',
                description='Internally measured module temperature',
                mode='RO',
                units='degC',
                linkedGet=transceivers.getTemp,
                disp='{:1.3f}',
                dependencies=[self.DevMon[0], self.DevMon[1]],
            ))

        self.add(
            pr.LinkVariable(
                name='Vcc',
                description='Internally measured supply voltage in transceiver',
                mode='RO',
                units='V',
                linkedGet=transceivers.getVolt,
                disp='{:1.3f}',
                dependencies=[self.DevMon[4], self.DevMon[5]],
            ))

        self.addRemoteVariables(
            name='RxPwrRaw',
            description='Rx input power',
            offset=(34 << 2),
            bitSize=8,
            mode='RO',
            number=8,
            stride=4,
            hidden=True,
        )

        for i in range(4):
            self.add(
                pr.LinkVariable(
                    name=f'RxPower[{i}]',
                    description='Measured RX input power',
                    mode='RO',
                    units='dBm',
                    linkedGet=transceivers.getOpticalPwr,
                    disp='{:1.3f}',
                    dependencies=[
                        self.RxPwrRaw[2 * i + 0], self.RxPwrRaw[2 * i + 1]
                    ],
                ))

        self.addRemoteVariables(
            name='TxBiasRaw',
            description='Tx bias current',
            offset=(42 << 2),
            bitSize=8,
            mode='RO',
            number=8,
            stride=4,
            hidden=True,
        )

        for i in range(4):
            self.add(
                pr.LinkVariable(
                    name=f'TxBias[{i}]',
                    description='Internally measured TX Bias Current',
                    mode='RO',
                    units='mA',
                    linkedGet=transceivers.getTxBias,
                    disp='{:1.3f}',
                    dependencies=[
                        self.TxBiasRaw[2 * i + 0], self.TxBiasRaw[2 * i + 1]
                    ],
                ))

        self.addRemoteVariables(
            name='TxPwrRaw',
            description='Tx output power',
            offset=(50 << 2),
            bitSize=8,
            mode='RO',
            number=8,
            stride=4,
            hidden=True,
        )

        for i in range(4):
            self.add(
                pr.LinkVariable(
                    name=f'TxPower[{i}]',
                    description='Measured TX output power',
                    mode='RO',
                    units='dBm',
                    linkedGet=transceivers.getOpticalPwr,
                    disp='{:1.3f}',
                    dependencies=[
                        self.TxPwrRaw[2 * i + 0], self.TxPwrRaw[2 * i + 1]
                    ],
                ))

        ################
        # Upper Page 00h
        ################

        self.add(
            pr.RemoteVariable(
                name='Identifier',
                description='Type of serial transceiver',
                offset=(128 << 2),
                bitSize=8,
                mode='RO',
                enum=transceivers.IdentifierDict,
            ))

        self.add(
            pr.RemoteVariable(
                name='Connector',
                description='Code for connector type',
                offset=(130 << 2),
                bitSize=8,
                mode='RO',
                enum=transceivers.ConnectorDict,
            ))

        self.addRemoteVariables(
            name='VendorNameRaw',
            description='SFP vendor name (ASCII)',
            offset=(148 << 2),
            bitSize=8,
            mode='RO',
            base=pr.String,
            number=16,
            stride=4,
            hidden=True,
        )

        self.add(
            pr.LinkVariable(
                name='VendorName',
                description='SFP vendor name (ASCII)',
                mode='RO',
                linkedGet=transceivers.parseStrArrayByte,
                dependencies=[self.VendorNameRaw[x] for x in range(16)],
            ))

        self.addRemoteVariables(
            name='VendorPnRaw',
            description='Part number provided by SFP vendor (ASCII)',
            offset=(168 << 2),
            bitSize=8,
            mode='RO',
            base=pr.String,
            number=16,
            stride=4,
            hidden=True,
        )

        self.add(
            pr.LinkVariable(
                name='VendorPn',
                description='Part number provided by SFP vendor (ASCII)',
                mode='RO',
                linkedGet=transceivers.parseStrArrayByte,
                dependencies=[self.VendorPnRaw[x] for x in range(16)],
            ))

        self.addRemoteVariables(
            name='VendorRevRaw',
            description=
            'Revision level for part number provided by vendor (ASCII)',
            offset=(184 << 2),
            bitSize=8,
            mode='RO',
            base=pr.String,
            number=2,
            stride=4,
            hidden=True,
        )

        self.add(
            pr.LinkVariable(
                name='VendorRev',
                description=
                'Revision level for part number provided by vendor (ASCII)',
                mode='RO',
                linkedGet=transceivers.parseStrArrayByte,
                dependencies=[self.VendorRevRaw[x] for x in range(2)],
            ))

        self.addRemoteVariables(
            name='VendorSnRaw',
            description='Serial number provided by vendor (ASCII)',
            offset=(196 << 2),
            bitSize=8,
            mode='RO',
            base=pr.String,
            number=16,
            stride=4,
            hidden=True,
        )

        self.add(
            pr.LinkVariable(
                name='VendorSn',
                description='Serial number provided by vendor (ASCII)',
                mode='RO',
                linkedGet=transceivers.parseStrArrayByte,
                dependencies=[self.VendorSnRaw[x] for x in range(16)],
            ))

        self.addRemoteVariables(
            name='DateCode',
            description='Vendor\'s manufacturing date code (ASCII)',
            offset=(212 << 2),
            bitSize=8,
            mode='RO',
            number=6,
            stride=4,
            base=pr.String,
            hidden=True,
        )

        self.add(
            pr.LinkVariable(
                name='ManufactureDate',
                description='Vendor\'s manufacturing date code (ASCII)',
                mode='RO',
                linkedGet=transceivers.getDate,
                dependencies=[self.DateCode[x] for x in [0, 1, 4, 5, 2, 3]],
            ))
Beispiel #29
0
    def __init__(self,
                 name='AltirocTrig',
                 description='Container for Altiroc ASIC\'s Trigger registers',
                 **kwargs):

        super().__init__(name=name, description=description, **kwargs)

        self.add(
            pr.RemoteVariable(
                name='CalPulseTrigDropCnt',
                description=
                'Increments every time a trigger is dropped due to previous readout cycle not being completed (renable still active)',
                offset=0x00,
                bitSize=32,
                mode='RO',
                disp='{:d}',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='BncExtTrigDropCnt',
                description=
                'Increments every time a trigger is dropped due to previous readout cycle not being completed (renable still active)',
                offset=0x04,
                bitSize=32,
                mode='RO',
                disp='{:d}',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='LocalMasterTrigDropCnt',
                description=
                'Increments every time a trigger is dropped due to previous readout cycle not being completed (renable still active)',
                offset=0x08,
                bitSize=32,
                mode='RO',
                disp='{:d}',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='RemoteSlaveTrigDropCnt',
                description=
                'Increments every time a trigger is dropped due to previous readout cycle not being completed (renable still active)',
                offset=0x0C,
                bitSize=32,
                mode='RO',
                disp='{:d}',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='CalPulseTrigCnt',
                description=
                'Increments every time a trigger is received for readout (renable not active)',
                offset=0x10,
                bitSize=32,
                mode='RO',
                disp='{:d}',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='BncExtTrigCnt',
                description=
                'Increments every time a trigger is received for readout (renable not active)',
                offset=0x14,
                bitSize=32,
                mode='RO',
                disp='{:d}',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='LocalMasterTrigCnt',
                description=
                'Increments every time a trigger is received for readout (renable not active)',
                offset=0x18,
                bitSize=32,
                mode='RO',
                disp='{:d}',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='RemoteSlaveTrigCnt',
                description=
                'Increments every time a trigger is received for readout (renable not active)',
                offset=0x1C,
                bitSize=32,
                mode='RO',
                disp='{:d}',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='TriggerCnt',
                description=
                'Increments every time a trigger is received for readout from any source',
                offset=0x20,
                bitSize=32,
                mode='RO',
                disp='{:d}',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='TriggerDropCnt',
                description='Increments every time a trigger is dropped',
                offset=0x24,
                bitSize=32,
                mode='RO',
                disp='{:d}',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='TimeCounter',
                description=
                'Increments every 160 MHz clock cycle and reset to zero when PLL is not locked',
                offset=0x28,
                bitSize=64,
                mode='RO',
                units='1/160MHz',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='TrigTypeSel',
                description=
                'Selects whether this FPGA is a trigger master or slave',
                offset=0x40,
                bitSize=1,
                mode='RW',
                enum={
                    0x0: 'Slave',
                    0x1: 'Master',
                },
            ))

        self.add(
            pr.RemoteVariable(
                name='CalStrobeAlign',
                description='Cal Pulse 40 MHz strobe alignment correction',
                units='1/160MHz',
                offset=0x44,
                bitSize=2,
                bitOffset=0,
                mode='RW',
            ))

        self.add(
            pr.RemoteVariable(
                name='TrigStrobeAlign',
                description=
                'Trigger window 25 ns (40 MHz strobe) alignment correction',
                units='1/160MHz',
                offset=0x44,
                bitSize=2,
                bitOffset=8,
                mode='RW',
            ))

        self.add(
            pr.RemoteVariable(
                name='EnCalPulseTrig',
                description='Mask for enabling cal pulse triggers',
                offset=0x48,
                bitSize=1,
                bitOffset=0,
                mode='RW',
            ))

        self.add(
            pr.RemoteVariable(
                name='EnBncExtTrig',
                description='Mask for enabling BNC external triggers',
                offset=0x48,
                bitSize=1,
                bitOffset=1,
                mode='RW',
            ))

        self.add(
            pr.RemoteVariable(
                name='EnPcieLocalTrig',
                description='Mask for enabling PCIE Local triggers (TOA_BUSYB)',
                offset=0x48,
                bitSize=1,
                bitOffset=2,
                mode='RW',
            ))

        self.add(
            pr.RemoteVariable(
                name='EnLemoRemoteTrig',
                description=
                'Mask for enabling LEMO Remote triggers (TOA_BUSYB)',
                offset=0x48,
                bitSize=1,
                bitOffset=3,
                mode='RW',
            ))

        self.add(
            pr.RemoteVariable(
                name='MasterModeSel',
                description=
                'Selects whether the master FPGA using AND or OR for TOA_BUSY triggering',
                offset=0x4C,
                bitSize=1,
                mode='RW',
                enum={
                    0x0: 'AND',
                    0x1: 'OR',
                },
            ))

        self.add(
            pr.RemoteVariable(
                name='ReadoutStartDly',
                description='Delay between trigger and asserting RENBLE',
                offset=0x50,
                bitSize=16,
                bitOffset=0,
                mode='RW',
            ))

        self.add(
            pr.LinkVariable(
                name='ReadoutStartDlyNs',
                units='ns',
                disp='{:1.2f}',
                dependencies=[self.ReadoutStartDly],
                linkedGet=common.getNsValue,
            ))

        self.add(
            pr.RemoteVariable(
                name='TrigSizeBeforePause',
                description=
                'Number of trigger event before pausing for oscilloscope dead time',
                offset=0x50,
                bitSize=16,
                bitOffset=16,
                disp='{:d}',
                mode='RW',
            ))

        self.add(
            pr.RemoteVariable(
                name='TrigSizeBeforePauseCnt',
                description=
                'Counter for the triggers events before pausing for oscilloscope dead time',
                offset=0x5C,
                bitSize=16,
                disp='{:d}',
                mode='RO',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='DeadtimeDuration',
                description=
                'Deadtime duration for oscilloscope to catch up without readout',
                offset=0x54,
                bitSize=8,
                bitOffset=0,
                mode='RW',
                disp='{:d}',
                units='seconds',
            ))

        self.add(
            pr.RemoteVariable(
                name='BusyPulseWidth',
                description='Pulse width of BNC busy',
                offset=0x54,
                bitSize=8,
                bitOffset=8,
                mode='RW',
                disp='{:d}',
                units='1/160MHz',
            ))

        self.add(
            pr.LinkVariable(
                name='BusyPulseWidthNs',
                units='ns',
                disp='{:1.2f}',
                dependencies=[self.BusyPulseWidth],
                linkedGet=common.getNsValue,
            ))

        self.add(
            pr.RemoteVariable(
                name='DeadtimeCnt',
                description='Deadtime duration',
                offset=0x58,
                bitSize=8,
                bitOffset=8,
                mode='RO',
                disp='{:d}',
                units='seconds',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='TrigState',
                description='Trigger FSM state',
                offset=0x58,
                bitSize=2,
                bitOffset=0,
                mode='RO',
                pollInterval=1,
                enum={
                    0x0: 'IDLE_S',
                    0x1: 'READ_DLY_S',
                    0x2: 'READOUT_S',
                    0x3: 'OSCOPE_DEADTIME_S',
                },
            ))

        self.add(
            pr.RemoteVariable(
                name='BncExtTrig',
                description='current value of BNC External Trigger',
                offset=0x60,
                bitSize=1,
                bitOffset=0,
                mode='RO',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='LocalPcieToaBusy',
                description=
                'current value of local PCIe TOA busy (active HIGH)',
                offset=0x60,
                bitSize=1,
                bitOffset=1,
                mode='RO',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='LemoIn',
                description='current value LEMO input (active HIGH)',
                offset=0x60,
                bitSize=1,
                bitOffset=2,
                mode='RO',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='OrTrig',
                description='current value of OR trigger logic',
                offset=0x60,
                bitSize=1,
                bitOffset=3,
                mode='RO',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='AndTrig',
                description='current value of AND trigger logic',
                offset=0x60,
                bitSize=1,
                bitOffset=4,
                mode='RO',
                pollInterval=1,
            ))

        self.add(
            pr.RemoteVariable(
                name='EnableReadout',
                description='Enable the triggers to start the readout process',
                offset=0x80,
                bitSize=1,
                mode='RW',
            ))

        self.add(
            pr.RemoteCommand(name='CountReset',
                             description='Status counter reset',
                             offset=0xFC,
                             bitSize=1,
                             function=pr.BaseCommand.touchOne))
Beispiel #30
0
    def __init__(self,
                 name='EM22xx',
                 description='EM22xx Container',
                 **kwargs):
        super().__init__(name=name, description=description, **kwargs)

        self.add(
            pr.LinkVariable(
                name='VIN',
                mode='RO',
                units='V',
                disp='{:1.3f}',
                linkedGet=i2c.getPMbusLinearDataFormat,
                dependencies=[self.READ_VIN],
            ))

        self.add(
            pr.LinkVariable(
                name='VOUT',
                mode='RO',
                units='V',
                disp='{:1.3f}',
                linkedGet=i2c.getPMbusLinearDataFormat,
                dependencies=[self.READ_VOUT],
            ))

        self.add(
            pr.LinkVariable(
                name='IOUT',
                mode='RO',
                units='A',
                disp='{:1.3f}',
                linkedGet=i2c.getPMbusLinearDataFormat,
                dependencies=[self.READ_IOUT],
            ))

        self.add(
            pr.LinkVariable(
                name='TEMPERATURE[1]',
                mode='RO',
                units='degC',
                disp='{:1.3f}',
                linkedGet=i2c.getPMbusLinearDataFormat,
                dependencies=[self.READ_TEMPERATURE_1],
            ))

        self.add(
            pr.LinkVariable(
                name='TEMPERATURE[2]',
                mode='RO',
                units='degC',
                disp='{:1.3f}',
                linkedGet=i2c.getPMbusLinearDataFormat,
                dependencies=[self.READ_TEMPERATURE_2],
            ))

        self.add(
            pr.LinkVariable(
                name='DUTY_CYCLE',
                mode='RO',
                units='kHz',
                disp='{:1.3f}',
                linkedGet=i2c.getPMbusLinearDataFormat,
                dependencies=[self.READ_DUTY_CYCLE],
            ))

        self.add(
            pr.LinkVariable(
                name='FREQUENCY',
                mode='RO',
                units='kHz',
                disp='{:1.3f}',
                linkedGet=i2c.getPMbusLinearDataFormat,
                dependencies=[self.READ_FREQUENCY],
            ))

        self.add(
            pr.LinkVariable(
                name='POUT',
                mode='RO',
                units='W',
                disp='{:1.3f}',
                linkedGet=i2c.getPMbusLinearDataFormat,
                dependencies=[self.READ_POUT],
            ))