def __init__(self, name="AxisBramRingBuffer", description="Waveform Data Acquisition Module", numAppCh=1, **kwargs): super().__init__(name=name, description=description, **kwargs) #################### # Variables/Commands #################### self.addRemoteVariables( name="Tdest", description="AXI stream TDEST", offset=0x0, bitSize=8, bitOffset=0, base=pr.UInt, mode="RW", number=numAppCh, stride=4, ) self.add( pr.RemoteCommand( name='CmdSwTrig', description='Command for Software Trigger', offset=0xF8, bitSize=1, bitOffset=0, base=pr.UInt, function=lambda cmd: cmd.post(1), hidden=False, )) self.add( pr.RemoteVariable( name='Enable', description='Enable for triggers', offset=0xFC, bitSize=1, bitOffset=0, base=pr.UInt, mode='RW', ))
def __init__(self, **kwargs): super().__init__(**kwargs) self.add(pr.RemoteVariable( name = "AxilRdEn", offset = 0x14, bitSize = 1, bitOffset = 31, base = pr.Bool, mode = 'RW', )) self.add(pr.RemoteVariable( name = "Link", offset = 0x00, bitSize = 4, bitOffset = 0, disp = '{:d}', mode = 'RW', )) self.add(pr.RemoteVariable( name = "TxPllRst", offset = 0x04, bitSize = 1, bitOffset = 18, base = pr.Bool, mode = 'RW', )) self.add(pr.RemoteVariable( name = "RxPllRst", offset = 0x04, bitSize = 1, bitOffset = 19, base = pr.Bool, mode = 'RW', )) self.add(pr.RemoteVariable( name = "Loopback", offset = 0x04, bitSize = 1, bitOffset = 28, base = pr.Bool, mode = 'RW', )) self.add(pr.RemoteVariable( name = "TxRst", offset = 0x04, bitSize = 1, bitOffset = 29, base = pr.Bool, mode = 'RW', )) self.add(pr.RemoteVariable( name = "RxRst", offset = 0x04, bitSize = 1, bitOffset = 30, base = pr.Bool, mode = 'RW', )) self.add(pr.RemoteVariable( name = "HwEnable", offset = 0x04, bitSize = 1, bitOffset = 31, base = pr.Bool, mode = 'RW', )) self.add(pr.RemoteVariable( name = "RxErrorCnts", offset = 0x08, bitSize = 16, bitOffset = 0, disp = '{:d}', mode = 'RO', )) self.add(pr.RemoteVariable( name = "TxResetDone", offset = 0x08, bitSize = 1, bitOffset = 16, base = pr.Bool, mode = 'RO', )) self.add(pr.RemoteVariable( name = "TxReady", offset = 0x08, bitSize = 1, bitOffset = 17, base = pr.Bool, mode = 'RO', )) self.add(pr.RemoteVariable( name = "RxResetDone", offset = 0x08, bitSize = 1, bitOffset = 18, base = pr.Bool, mode = 'RO', )) self.add(pr.RemoteVariable( name = "RxReady", offset = 0x08, bitSize = 1, bitOffset = 19, base = pr.Bool, mode = 'RO', )) self.add(pr.RemoteVariable( name = "RxIsXpm", offset = 0x08, bitSize = 1, bitOffset = 20, base = pr.Bool, mode = 'RO', )) self.add(pr.RemoteVariable( name = "RxId", offset = 0x0C, bitSize = 32, bitOffset = 0, mode = 'RO', )) self.add(pr.RemoteVariable( name = "RxRcvCnts", offset = 0x10, bitSize = 32, bitOffset = 0, mode = 'RO', )) self.add(pr.RemoteCommand( name = "Config_L0Select_Reset", offset = 0x14, bitSize = 1, bitOffset = 0, function = pr.RemoteCommand.toggle )) self.add(pr.RemoteVariable( name = "Config_L0Select_Enabled", offset = 0x14, bitSize = 1, bitOffset = 16, mode = 'RW', base = pr.Bool )) self.add(pr.RemoteVariable( name = "Config_L0Select_RateSel", offset = 0x18, bitSize = 16, bitOffset = 0, mode = 'RW', enum = { 0x0000: '929 kHz', 0x0001: '71 kHz', 0x0002: '10 kHz', 0x0003: '1 kHz', 0x0004: '100 Hz', 0x0005: '10 Hz', 0x0006: '1 Hz', 0x8000: 'Undefined', } )) self.add(pr.RemoteVariable( name = "Config_L0Select_DestSel", offset = 0x18, bitSize = 16, bitOffset = 16, mode = 'RW', )) self.add(pr.RemoteVariable( name = "Status_L0Select_Enabled", offset = 0x20, bitSize = 40, bitOffset = 0, disp = '{:d}', mode = 'RO', )) self.add(pr.RemoteVariable( name = "Status_L0Select_Inhibited", offset = 0x28, bitSize = 40, bitOffset = 0, disp = '{:d}', mode = 'RO', )) self.add(pr.RemoteVariable( name = "Status_L0Select_Num", offset = 0x30, bitSize = 40, bitOffset = 0, disp = '{:d}', mode = 'RO', )) self.add(pr.RemoteVariable( name = "Status_L0Select_NumInh", offset = 0x38, bitSize = 40, bitOffset = 0, disp = '{:d}', mode = 'RO', )) self.add(pr.RemoteVariable( name = "Status_L0Select_NumAcc", offset = 0x40, bitSize = 40, bitOffset = 0, disp = '{:d}', mode = 'RO', )) self.add(pr.RemoteVariable( name = "Pipeline_Depth_Clks", offset = 0x48, bitSize = 16, bitOffset = 0, disp = '{:d}', mode = 'RW', )) self.add(pr.RemoteVariable( name = "Pipeline_Depth_Fids", offset = 0x48, bitSize = 8, bitOffset = 16, disp = '{:d}', mode = 'RW', )) self.add(pr.RemoteVariable( name = "PartitionMessage_Hdr", offset = 0x4C, bitSize = 16, bitOffset = 0, mode = 'WO', hidden = True, )) @self.command() def SendTransition(arg): self.PartitionMessage_Hdr.set(arg | (1<<15)) @self.command() def TxPllReset(): self.TxPllRst.set(0x1) self.Link.set(self.Link.get()) self.TxPllRst.set(0x0) @self.command() def RxPllReset(): self.RxPllRst.set(0x1) self.Link.set(self.Link.get()) self.RxPllRst.set(0x0) @self.command() def TxReset(): self.TxRst.set(0x1) self.Link.set(self.Link.get()) self.TxRst.set(0x0) @self.command() def RxReset(): self.RxRst.set(0x1) self.Link.set(self.Link.get()) self.RxRst.set(0x0)
def __init__( self, name = "PgpLane", description = "PgpLane", basicMode = True, useEvr = True, **kwargs): super().__init__(name=name, description=description, **kwargs) # Add GT interface self.add(Gthe3Channel( name = 'GTH', offset = 0x0000, expand = False, hidden = basicMode, )) # Add Lane Monitor self.add(Pgp2bAxi( name = 'Monitor', offset = 0x1000, expand = False, )) regOffset = 0x2000 if (useEvr): self.addRemoteVariables( name = "LutDropCnt", description = "", offset = (regOffset | 0x00), bitSize = 32, bitOffset = 0, base = pr.UInt, mode = "RO", number = 4, stride = 4, pollInterval = 1 ) self.addRemoteVariables( name = "FifoErrorCnt", description = "", offset = (regOffset | 0x10), bitSize = 32, bitOffset = 0, base = pr.UInt, mode = "RO", number = 4, stride = 4, pollInterval = 1 ) self.addRemoteVariables( name = "VcPauseCnt", description = "", offset = (regOffset | 0x20), bitSize = 32, bitOffset = 0, base = pr.UInt, mode = "RO", number = 4, stride = 4, pollInterval = 1 ) self.addRemoteVariables( name = "VcOverflowCnt", description = "", offset = (regOffset | 0x30), bitSize = 32, bitOffset = 0, base = pr.UInt, mode = "RO", number = 4, stride = 4, pollInterval = 1 ) self.add(pr.RemoteVariable( name = "RunCode", description = "Run OP-Code for triggering", offset = (regOffset | 0x40), bitSize = 8, bitOffset = 0, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "AcceptCode", description = "Accept OP-Code for triggering", offset = (regOffset | 0x44), bitSize = 8, bitOffset = 0, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "EnHdrTrig", description = "Enable Header Trigger Checking/filtering", offset = (regOffset | 0x48), bitSize = 4, bitOffset = 0, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "RunDelay", description = "Delay for the RUN trigger", offset = (regOffset | 0x4C), bitSize = 32, bitOffset = 0, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "AcceptDelay", description = "Delay for the ACCEPT trigger", offset = (regOffset | 0x50), bitSize = 32, bitOffset = 0, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteCommand( name = "AcceptCntRst", description = "Reset for the AcceptCnt", offset = (regOffset | 0x54), bitSize = 1, bitOffset = 0, base = pr.UInt, function = pr.BaseCommand.createTouch(0x1) )) self.add(pr.RemoteVariable( name = "EvrOpCodeMask", description = "Mask off the EVR OP-Code triggering", offset = (regOffset | 0x58), bitSize = 1, bitOffset = 0, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "EvrSyncSel", description = "0x0 = ASYNC start/stop, 0x1 = SYNC start/stop with respect to evrSyncWord", offset = (regOffset | 0x5C), bitSize = 1, bitOffset = 0, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "EvrSyncEn", description = "EVR SYNC Enable", offset = (regOffset | 0x60), bitSize = 1, bitOffset = 0, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "EvrSyncWord", description = "EVR SYNC Word", offset = (regOffset | 0x64), bitSize = 32, bitOffset = 0, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "EnableTrig", description = "Enable OP-Code Trigger", offset = (regOffset | 0x88), bitSize = 1, bitOffset = 0, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "EvrSyncStatus", description = "EVR SYNC Status", offset = (regOffset | 0x90), bitSize = 1, bitOffset = 0, base = pr.UInt, mode = "RO", )) self.add(pr.RemoteVariable( name = "AcceptCnt", description = "AcceptCnt", offset = (regOffset | 0x94), bitSize = 32, bitOffset = 0, base = pr.UInt, mode = "RO", )) @self.command(description="Configures the TX for 1.25 Gbps",) def CofigTx1p250Gbps(): print ( 'CofigTx1p250Gbps(): TBD' ) @self.command(description="Configures the RX for 1.25 Gbps",) def ConfigRx1p250Gbps(): print ( 'ConfigRx1p250Gbps(): TBD' ) @self.command(description="Configures the TX for 2.5 Gbps",) def CofigTx2p500Gbps(): print ( 'CofigTx2p500Gbps(): TBD' ) @self.command(description="Configures the RX for 2.5 Gbps",) def CofigRx2p500Gbps(): print ( 'CofigRx2p500Gbps(): TBD' ) @self.command(description="Configures the TX for 3.125 Gbps",) def CofigTx3p125Gbps(): print ( 'CofigTx3p125Gbps(): TBD' ) @self.command(description="Configures the RX for 3.125 Gbps",) def CofigRx3p125Gbps(): print ( 'CofigRx3p125Gbps(): TBD' ) @self.command(description="Configures the TX for 5.0 Gbps",) def CofigTx5p000Gbps(): print ( 'CofigTx5p000Gbps(): TBD' ) @self.command(description="Configures the RX for 5.0 Gbps",) def CofigRx5p000Gbps(): print ( 'CofigRx5p000Gbps(): TBD' )
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)
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))
def __init__(self, description="Configuration of PGP 4 link", writeEn=False, **kwargs): super().__init__(description=description, **kwargs) mode = 'RW' if writeEn else 'RO' self.add( pr.RemoteCommand( name='CountReset', description="Status Counter Reset Command", offset=0x000, bitOffset=0, bitSize=1, function=pr.BaseCommand.toggle, )) self.add( pr.RemoteVariable( name='WRITE_EN_G', offset=0x004, bitOffset=0, bitSize=1, base=pr.Bool, mode='RO', )) self.add( pr.RemoteVariable( name='NUM_VC_G', offset=0x004, bitOffset=8, bitSize=8, disp='{:d}', mode='RO', )) self.add( pr.RemoteVariable( name='STATUS_CNT_WIDTH_G', offset=0x004, bitOffset=16, bitSize=8, disp='{:d}', mode='RO', )) self.add( pr.RemoteVariable( name='ERROR_CNT_WIDTH_G', offset=0x004, bitOffset=24, bitSize=8, disp='{:d}', mode='RO', )) self.add( pr.RemoteVariable( name='SkipInterval', description="TX skip k-code interval", offset=0x008, mode=mode, disp='{:d}', )) self.add( pr.RemoteVariable( name="Loopback", description="GT Loopback Mode", offset=0x00C, bitOffset=0, bitSize=3, mode=mode, )) self.add( pr.RemoteVariable( name='FlowControlDisable', offset=0x00C, bitOffset=3, bitSize=1, base=pr.Bool, mode=mode, )) self.add( pr.RemoteVariable( name='TxDisable', offset=0x00C, bitOffset=4, bitSize=1, base=pr.Bool, mode=mode, )) self.add( pr.RemoteVariable( name='ResetTx', offset=0x00C, bitOffset=5, bitSize=1, base=pr.Bool, mode=mode, )) self.add( pr.RemoteVariable( name='ResetRx', offset=0x00C, bitOffset=6, bitSize=1, base=pr.Bool, mode=mode, )) self.add( pr.RemoteVariable( name='TxDiffCtrl', mode=mode, offset=0x00C, bitOffset=8, bitSize=5, )) self.add( pr.RemoteVariable( name='TxPreCursor', mode=mode, offset=0x00C, bitOffset=16, bitSize=5, )) self.add( pr.RemoteVariable( name='TxPostCursor', mode=mode, offset=0x00C, bitOffset=24, bitSize=5, ))
def __init__(self, pollInterval=1, **kwargs): super().__init__(**kwargs) statusCntBitSize = 16 self.add( pr.RemoteVariable( name='LinkUpCnt', description='Status counter for link up', offset=0x00, bitSize=statusCntBitSize, mode='RO', pollInterval=pollInterval, )) self.add( pr.RemoteVariable( name='AuroraHdrErrDet', description= 'Increments when the Aurora 2-bit header is not 10 or 01', offset=0x04, bitSize=statusCntBitSize, mode='RO', pollInterval=pollInterval, )) self.add( pr.RemoteVariable( name='GearBoxBitSlipCnt', description= 'Increments whenever there is a gearbox bit slip executed', offset=0x08, bitSize=statusCntBitSize, mode='RO', pollInterval=pollInterval, )) self.add( pr.RemoteVariable( name='LinkUp', description='link up', offset=0x0C, bitSize=1, bitOffset=0, mode='RO', pollInterval=pollInterval, )) self.add( pr.RemoteVariable( name='LockingCntCfg', description= 'Sets the number of good 2-bit headers required for locking per delay step sweep', offset=0x10, bitSize=24, mode='RW', )) self.add( pr.RemoteVariable( name='MinEyeWidth', description='Sets the min. eye width in the RX IDELAY eye scan', offset=0x14, bitSize=8, mode='RW', )) self.add( pr.RemoteVariable( name='UserRxDelayTap', description= 'Sets the RX IDELAY tap configuration (A.K.A. RxDelayTap) when EnUsrDlyCfg = 0x1', offset=0x18, bitSize=9, mode='RW', )) self.add( pr.RemoteVariable( name='SelectRate', description= 'SelectRate and RD53.SEL_SER_CLK[2:0] must be the same (default of 0x0 = 1.28Gbps)', offset=0x1C, bitSize=2, mode='RW', )) self.add( pr.RemoteVariable( name='EnUsrDlyCfg', description= 'Enables the User to override the automatic RX IDELAY tap configuration (Note: For 7-series FPGAs the 5-bit config is mapped like dlyCfg(8 downto 4) to the most significant bits)', offset=0x20, bitSize=1, mode='RW', )) self.add( pr.RemoteVariable( name='Polarity', description='RX polarity (inverted by default)', offset=0x24, bitSize=1, mode='RW', )) self.add( pr.RemoteVariable( name='RollOverEn', description='Rollover enable for status counters', offset=0xF8, bitSize=7, mode='RW', )) self.add( pr.RemoteCommand( name='CntRst', description='Status counter reset', offset=0xFC, bitSize=1, function=lambda cmd: cmd.post(1), hidden=False, ))
def __init__(self, numberLanes=1, **kwargs): super().__init__(**kwargs) self.addRemoteVariables( name='LockedCnt', offset=0 * (numberLanes << 2), bitSize=16, mode='RO', number=numberLanes, stride=4, pollInterval=1, ) self.addRemoteVariables( name='BitSlipCnt', offset=1 * (numberLanes << 2), bitSize=16, mode='RO', number=numberLanes, stride=4, pollInterval=1, ) self.addRemoteVariables( name='ErrorDetCnt', offset=2 * (numberLanes << 2), bitSize=16, mode='RO', number=numberLanes, stride=4, pollInterval=1, ) self.add( pr.RemoteVariable( name='Locked', offset=0x400, bitSize=2, mode='RO', pollInterval=1, )) self.addRemoteVariables( name='DlyConfig', offset=0x600, bitSize=9, mode='RO', number=numberLanes, stride=4, pollInterval=1, ) self.add( pr.RemoteVariable( name='DATA_WIDTH_G', offset=0x7FC, bitSize=8, bitOffset=0, mode='RO', disp='{:d}', )) self.add( pr.RemoteVariable( name='NUM_LANE_G', offset=0x7FC, bitSize=8, bitOffset=8, mode='RO', disp='{:d}', )) self.add( pr.RemoteVariable( name='EnUsrDlyCfg', description='Enable User delay config', offset=0x800, bitSize=1, mode='RW', )) self.add( pr.RemoteVariable( name='UsrDlyCfg', description='User delay config', offset=0x804, bitSize=9, mode='RW', )) self.add( pr.RemoteVariable( name='MinEyeWidth', description= 'Sets the minimum eye width required for locking (units of IDELAY step)', offset=0x808, bitSize=8, mode='RW', )) self.add( pr.RemoteVariable( name='LockingCntCfg', description='Number of error-free event before state=LOCKED_S', offset=0x80C, bitSize=24, mode='RW', )) self.add( pr.RemoteVariable( name='BypFirstBerDet', description= 'Set to 0x1 if IDELAY full scale range > 2 Unit Intervals (UI) of serial rate (example: IDELAY range 2.5ns > 1 ns (1Gb/s) )', offset=0x810, bitSize=1, mode='RW', )) self.add( pr.RemoteVariable( name='Polarity', description='1: Invert diff pair, 0: Non-inverted diff pair', offset=0x814, bitSize=numberLanes, mode='RW', )) self.add( pr.RemoteVariable( name='GearboxSlaveBitOrder', description='1: reserve, 0: normal', offset=0x818, bitSize=1, bitOffset=0, mode='RW', )) self.add( pr.RemoteVariable( name='GearboxMasterBitOrder', description='1: reserve, 0: normal', offset=0x818, bitSize=1, bitOffset=1, mode='RW', )) self.add( pr.RemoteVariable( name='RollOverEn', description='Rollover enable for status counters', offset=0xFF8, bitSize=7, mode='RW', )) self.add( pr.RemoteCommand( name='CntRst', description='Status counter reset', offset=0xFFC, bitSize=1, function=lambda cmd: cmd.post(1), hidden=False, ))
def __init__(self, description = "Lambda Power Supply I2C", VScale = 0, IScale = 0, **kwargs): super().__init__(description=description, **kwargs) self.add(pr.RemoteCommand( name = 'ADCReadStart', description = '', offset = 0x100, bitSize = 1, bitOffset = 0, base = pr.UInt, function = lambda cmd: cmd.post(1) )) self.add(pr.RemoteVariable( name = 'SerialNumber', description = 'Serial Number', offset = 0x00, bitSize = 8*20, bitOffset = 0x00, base = pr.String, mode = 'RO', )) self.add(pr.RemoteVariable( name = 'FirmWareVersion', description = 'FirmWare Version', offset = 0x14, bitSize = 8*4, bitOffset = 0x00, base = pr.String, mode = 'RO', )) self.add(pr.RemoteVariable( name = 'ProductVersion', description = 'Product Version', offset = 0x18, bitSize = 8*4, bitOffset = 0x00, base = pr.String, mode = 'RO', )) self.add(pr.RemoteVariable( name = 'OutputV', offset = 0x1C, mode = 'RO', )) self.add(pr.LinkVariable( name = 'OutputVolts', mode = 'RO', units = 'volts', variable = self.OutputV, linkedGet = lambda raw = self.OutputV: (raw.value() * VScale), disp = '{:1.3f}', )) self.add(pr.RemoteVariable( name = 'OutputI', offset = 0x20, mode = 'RO', )) self.add(pr.LinkVariable( name = 'OutputCurrent', mode = 'RO', units = 'Amps', variable = self.OutputI, linkedGet = lambda raw = self.OutputI: (raw.value() * IScale), disp = '{:1.3f}', )) self.add(pr.RemoteVariable( name = 'PlateTemp', offset = 0x24, mode = 'RO', )) self.add(pr.LinkVariable( name = 'SupplyTemp', mode = 'RO', units = 'temp(c)', variable = self.PlateTemp, linkedGet = lambda raw = self.PlateTemp: ((raw.value()-610)/2.048 + 25), disp = '{:1.3f}', )) self.add(pr.RemoteVariable( name = 'Status', offset = 0x28, mode = 'RO', )) self.add(pr.RemoteVariable( name = 'PartNumber', description = 'Part Number', offset = 0x2C, bitSize = 8*12, bitOffset = 0x00, base = pr.String, mode = 'RO', )) self.add(pr.RemoteVariable( name = 'ManufDate', description = 'Manuf Date', offset = 0x38, bitSize = 8*8, bitOffset = 0x00, base = pr.String, mode = 'RO', )) self.add(pr.RemoteVariable( name = 'ManufLoc', description = 'Manuf Loc', offset = 0x40, bitSize = 8*3, bitOffset = 0x00, base = pr.String, mode = 'RO', ))
def __init__(self, name="SsiPrbsRateGen", description="SsiPrbsRateGen", **kwargs): super().__init__(name=name, description=description, **kwargs) ############################## # Variables ############################## self.add( pr.RemoteCommand( name="StatReset", description="", offset=0x00, bitSize=1, bitOffset=0, base=pr.UInt, function=lambda cmd: cmd.toggle, hidden=False, )) self.add( pr.RemoteVariable( name="PacketLength", description="", offset=0x04, bitSize=32, bitOffset=0, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="Period", description="", offset=0x08, bitSize=32, bitOffset=0, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="TxEn", description="", offset=0x0C, bitSize=1, bitOffset=0, base=pr.Bool, mode="RW", )) self.add( pr.RemoteCommand( name="OneShot", description="", offset=0x0C, bitSize=1, bitOffset=1, base=pr.UInt, function=pr.BaseCommand.toggle, hidden=False, )) self.add( pr.RemoteVariable( name="Missed", description="", offset=0x10, bitSize=32, bitOffset=0, base=pr.UInt, pollInterval=1, mode="RO", )) self.add( pr.RemoteVariable( name="FrameRate", description="", offset=0x14, bitSize=32, bitOffset=0, base=pr.UInt, pollInterval=1, mode="RO", )) self.add( pr.RemoteVariable( name="FrameRateMax", description="", offset=0x18, bitSize=32, bitOffset=0, base=pr.UInt, pollInterval=1, mode="RO", )) self.add( pr.RemoteVariable( name="FrameRateMin", description="", offset=0x1C, bitSize=32, bitOffset=0, base=pr.UInt, pollInterval=1, mode="RO", )) self.add( pr.RemoteVariable( name="BandWidth", description="", offset=0x20, bitSize=64, bitOffset=0, base=pr.UInt, pollInterval=1, mode="RO", )) self.add( pr.RemoteVariable( name="BandWidthMax", description="", offset=0x28, bitSize=64, bitOffset=0, base=pr.UInt, pollInterval=1, mode="RO", )) self.add( pr.RemoteVariable( name="BandWidthMin", description="", offset=0x30, bitSize=64, bitOffset=0, base=pr.UInt, pollInterval=1, mode="RO", )) self.add( pr.RemoteVariable( name="FrameCount", description="", offset=0x40, bitSize=64, bitOffset=0, base=pr.UInt, pollInterval=1, mode="RO", ))
def __init__(self, numLane=1, description='Container for the PIP core registers', **kwargs): super().__init__(description=description, **kwargs) for i in range(numLane): self.add( pr.RemoteVariable( name=f'REMOTE_BAR0_BASE_ADDRESS[{i}]', offset=0x000 + 8 * i, bitSize=32, mode='RW', )) self.add( pr.RemoteVariable( name=f'DepackEofeCnt[{i}]', offset=0x080 + 4 * i, bitSize=32, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='RxFrameCnt', offset=0x0E0, bitSize=32, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='RxDropFrameCnt', offset=0x0E4, bitSize=32, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='TxFrameCnt', offset=0x0E8, bitSize=32, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='TxDropFrameCnt', offset=0x0EC, bitSize=32, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='TxAxiErrorCnt', offset=0x0F0, bitSize=32, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='NUM_AXIS_G', offset=0x0F4, bitSize=5, mode='RO', )) self.add( pr.RemoteVariable( name='EnableTx', offset=0x0F8, bitSize=numLane, mode='RW', )) self.add( pr.RemoteVariable( name='AxiWriteCache', offset=0x0F8, bitSize=4, bitOffset=16, mode='RW', )) self.add( pr.RemoteCommand(name='CountReset', description='Status counter reset', offset=0x0FC, bitSize=1, function=pr.BaseCommand.touchOne))
def __init__(self, NUM_ELINK_G=4, pollInterval=1, **kwargs): super().__init__(**kwargs) statusCntBitSize = 16 self.addRemoteVariables( name='Rd53LinkUpCnt', offset=0x0, bitSize=statusCntBitSize, mode='RO', number=NUM_ELINK_G, stride=4, pollInterval=1, ) self.add( pr.RemoteVariable( name='LpGbtDownLinkUpCnt', offset=0x4 * NUM_ELINK_G + 0x00, bitSize=statusCntBitSize, mode='RO', pollInterval=pollInterval, )) self.add( pr.RemoteVariable( name='LpGbtUpLinkUpCnt', offset=0x4 * NUM_ELINK_G + 0x04, bitSize=statusCntBitSize, mode='RO', pollInterval=pollInterval, )) self.add( pr.RemoteVariable( name='Rd53LinkUp', offset=0x400, bitSize=NUM_ELINK_G, bitOffset=0, mode='RO', pollInterval=pollInterval, )) self.add( pr.RemoteVariable( name='LpGbtDownLinkUp', offset=0x400, bitSize=1, bitOffset=NUM_ELINK_G + 0, mode='RO', pollInterval=pollInterval, )) self.add( pr.RemoteVariable( name='LpGbtUpLinkUp', offset=0x400, bitSize=1, bitOffset=NUM_ELINK_G + 1, mode='RO', pollInterval=pollInterval, )) self.add( pr.RemoteVariable( name='InvCmd', description='Invert the serial CMD bit', offset=0x800, bitSize=NUM_ELINK_G, mode='RW', )) self.add( pr.RemoteVariable( name='DlyCmd', description= '0x1: add 3.125 ns delay on the CMD output (used to deskew the CMD from discrete re-timing flip-flop IC)', offset=0x804, bitSize=NUM_ELINK_G, mode='RW', units='3.125 ns', )) self.add( pr.RemoteVariable( name='wdtRstEn', offset=0x808, bitSize=2, mode='RW', )) self.add( pr.RemoteVariable( name='UpLinkFecMode', offset=0x80C, bitSize=1, mode='RW', enum={ 0x0: 'FEC5', 0x1: 'FEC12', }, )) self.add( pr.RemoteVariable( name='BitOrderCmd4b', description= 'Used to control the inbound bit ordering into the 4:1 gearbox: 0x0=LSB shifted first, 0x1=MSB shifted first', offset=0x810, bitSize=1, mode='RW', )) self.add( pr.RemoteVariable( name='BitOrderData32b', description= 'Used to control the outbound bit ordering out of the 8:32 gearbox: 0x0=LSB shifted first, 0x1=MSB shifted first', offset=0x818, bitSize=1, mode='RW', )) self.add( pr.RemoteVariable( name='InvData', description= 'Used to invert the data if there is a polarity swap at the connector', offset=0x81C, bitSize=1, mode='RW', )) self.add( pr.RemoteVariable( name='UpLinkFecDisable', offset=0x820, bitSize=1, mode='RW', )) self.add( pr.RemoteVariable( name='UpLinkInterleaverBypass', offset=0x824, bitSize=1, mode='RW', )) self.add( pr.RemoteVariable( name='UpLinkScramblerBypass', offset=0x828, bitSize=1, mode='RW', )) self.add( pr.RemoteVariable( name='UpLinkLinkDownPattern', description= 'Sets the linkdown pattern on the 8bit bus before the 8:32 gearbox', offset=0x82C, bitSize=8, mode='RW', )) self.addRemoteVariables( name='UpLinkTxDummyFec12', offset=0x830, bitSize=10, mode='RW', number=2, stride=4, ) self.addRemoteVariables( name='UpLinkTxDummyFec5', offset=0x838, bitSize=6, mode='RW', number=2, stride=4, ) self.add( pr.RemoteVariable( name='UpLinkDebugMode', offset=0x840, description= 'Enable bitmask to override the 8:32 gearbox input with UpLinkDebugPattern', bitSize=7, mode='RW', )) self.add( pr.RemoteVariable( name='UplinkEcData', offset=0x850, bitSize=2, mode='RW', )) self.add( pr.RemoteVariable( name='UplinkIcData', offset=0x854, bitSize=2, mode='RW', )) self.addRemoteVariables( name='UpLinkDebugPatternA', description= 'When UpLinkDebugMode[elink]=0x1 then 8:32 gearbox output toggles between UpLinkDebugPatternA[elink] & UpLinkDebugPatternB[elink]', offset=0x900, bitSize=32, mode='RW', number=7, stride=4, ) self.addRemoteVariables( name='UpLinkDebugPatternB', description= 'When UpLinkDebugMode[elink]=0x1 then 8:32 gearbox output toggles between UpLinkDebugPatternA[elink] & UpLinkDebugPatternB[elink]', offset=0x920, bitSize=32, mode='RW', number=7, stride=4, ) self.add( pr.RemoteCommand( name='DownlinkRst', offset=0xFF0, bitSize=1, bitOffset=0, function=lambda cmd: cmd.post(1), hidden=False, )) self.add( pr.RemoteCommand( name='UplinkRst', offset=0xFF4, bitSize=1, bitOffset=0, function=lambda cmd: cmd.post(1), hidden=False, )) self.add( pr.RemoteVariable( name='RollOverEn', description='Rollover enable for status counters', offset=0xFF8, bitSize=7, mode='RW', )) self.add( pr.RemoteCommand( name='CntRst', description='Status counter reset', offset=0xFFC, bitSize=1, function=lambda cmd: cmd.post(1), hidden=False, ))
def __init__(self, writeEn=False, **kwargs): super().__init__(**kwargs) ############################## # Variables ############################## allowAccess = 'RW' if writeEn else 'RO' statusName = [ 'phyReady', # 0 'rxPause', # 1 'txPause', # 2 'rxFrame', # 3 'rxOverFlow',# 4 'rxCrcError',# 5 'txFrame', # 6 'txUnderRun',# 7 'txNotReady',# 8 'txDisable', # 9 'sigDet', # 10 'txFault', # 11 'gtTxRst', # 12 'gtRxRst', # 13 'rstCntDone',# 14 'qplllock', # 15 'txRstdone', # 16 'rxRstdone', # 17 'txUsrRdy', # 18 ] for i in range(19): self.add(pr.RemoteVariable( name = statusName[i]+'Cnt', offset = 4*i, mode = 'RO', pollInterval = 1, )) for i in range(19): self.add(pr.RemoteVariable( name = statusName[i], offset = 0x100, mode = 'RO', bitSize = 1, bitOffset = i, pollInterval = 1, )) self.add(pr.RemoteVariable( name = 'PhyStatus', offset = 0x108, bitSize = 8, mode = 'RO', pollInterval = 1, )) self.add(pr.RemoteVariable( name = 'MacAddress', description = 'MacAddress (big-Endian configuration)', offset = 0x200, 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 = 'PauseTime', offset = 0x21C, bitSize = 16, mode = allowAccess, )) self.add(pr.RemoteVariable( name = 'FilterEnable', offset = 0x228, bitSize = 1, mode = allowAccess, )) self.add(pr.RemoteVariable( name = 'PauseEnable', offset = 0x22C, bitSize = 1, mode = allowAccess, )) self.add(pr.RemoteVariable( name = 'PauseFifoThreshold', offset = 0x800, bitSize = 16, mode = allowAccess, )) if writeEn: self.add(pr.RemoteVariable( name = 'pma_pmd_type', offset = 0x230, bitSize = 3, mode = 'RW', )) self.add(pr.RemoteVariable( name = 'pma_loopback', offset = 0x234, bitSize = 1, mode = 'RW', )) self.add(pr.RemoteVariable( name = 'pma_reset', offset = 0x238, bitSize = 1, mode = 'RW', )) self.add(pr.RemoteVariable( name = 'pcs_loopback', offset = 0x23C, bitSize = 1, mode = 'RW', )) self.add(pr.RemoteVariable( name = 'pcs_reset', offset = 0x240, bitSize = 1, mode = 'RW', )) self.add(pr.RemoteVariable( name = 'RollOverEn', offset = 0xF00, bitSize = 19, mode = 'RW', )) self.add(pr.RemoteCommand( name = 'CounterReset', offset = 0xFF4, bitSize = 1, function = lambda cmd: cmd.post(1), hidden = False, )) self.add(pr.RemoteCommand( name = 'SoftReset', offset = 0xFF8, bitSize = 1, function = lambda cmd: cmd.post(1), hidden = False, )) self.add(pr.RemoteCommand( name = 'HardReset', offset = 0xFFC, bitSize = 1, function = lambda cmd: cmd.post(1), hidden = False, ))
def __init__(self, name="AxiStreamMonitoring", description="AxiStreamMonitoring Container", numberLanes=1, **kwargs): super().__init__(name=name, description=description, **kwargs) self.add( pr.RemoteCommand( name='CntRst', description="Counter Reset", offset=0x0, bitSize=1, function=lambda cmd: cmd.post(1), )) def addPair( name, offset, bitSize, units, bitOffset, description, function, pollInterval=0, ): self.add( pr.RemoteVariable( name=("Raw" + name), 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, disp='{:1.1f}', dependencies=[self.variables["Raw" + name]], )) ############################################# # Create block / variable combinations ############################################# for i in range(numberLanes): self.add( pr.RemoteVariable( name=f'FrameCnt[{i}]', description= 'Increments every time a tValid + tLast + tReady detected', offset=(i * 0x40 + 0x04), bitSize=64, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name=f'FrameRate[{i}]', description="Current Frame Rate", offset=(i * 0x40 + 0x0C), bitSize=32, bitOffset=0, mode="RO", base=pr.Int, units='Hz', pollInterval=1, )) self.add( pr.RemoteVariable( name=f'FrameRateMax[{i}]', description="Max Frame Rate", offset=(i * 0x40 + 0x10), bitSize=32, bitOffset=0, mode="RO", base=pr.Int, units='Hz', pollInterval=1, )) self.add( pr.RemoteVariable( name=f'FrameRateMin[{i}]', description="Min Frame Rate", offset=(i * 0x40 + 0x14), bitSize=32, bitOffset=0, mode="RO", base=pr.Int, units='Hz', pollInterval=1, )) addPair( name=f'Bandwidth[{i}]', description="Current Bandwidth", offset=(i * 0x40 + 0x18), bitSize=64, bitOffset=0, function=self.convMbps, units='Mbps', pollInterval=1, ) addPair( name=f'BandwidthMax[{i}]', description="Max Bandwidth", offset=(i * 0x40 + 0x20), bitSize=64, bitOffset=0, function=self.convMbps, units='Mbps', pollInterval=1, ) addPair( name=f'BandwidthMin[{i}]', description="Min Bandwidth", offset=(i * 0x40 + 0x28), bitSize=64, bitOffset=0, function=self.convMbps, units='Mbps', pollInterval=1, )
def __init__(self, maxBuffers=4, description='Container for the GPUAsync core registers', **kwargs): super().__init__(description=description, **kwargs) self.add( pr.RemoteVariable( name='AxiReadCache', offset=0x004, bitSize=4, bitOffset=0, mode='RO', )) self.add( pr.RemoteVariable( name='AxiWriteCache', offset=0x004, bitSize=4, bitOffset=8, mode='RO', )) self.add( pr.RemoteVariable( name='BusWidth', offset=0x004, bitSize=8, bitOffset=16, disp='{}', mode='RO', )) self.add( pr.RemoteVariable( name='MaxBuffers', offset=0x004, bitSize=5, bitOffset=24, disp='{}', mode='RO', )) self.add( pr.RemoteVariable( name='BufferCount', offset=0x008, bitSize=8, bitOffset=0, disp='{}', mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='BufferEnable', offset=0x008, bitSize=1, bitOffset=8, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='RxFrameCnt', offset=0x010, bitSize=32, disp='{}', mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='TxFrameCnt', offset=0x014, bitSize=32, disp='{}', mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='WriteAxiErrorCnt', offset=0x018, bitSize=32, disp='{}', mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='ReadAxiErrorCnt', offset=0x01C, bitSize=32, disp='{}', mode='RO', pollInterval=1, )) self.add( pr.RemoteCommand(name='CountReset', description='Status counter reset', offset=0x020, bitSize=1, function=pr.BaseCommand.touchOne)) for i in range(maxBuffers): self.add( pr.RemoteVariable( name=f'RemoteWriteAddress[{i}]', offset=0x100 + i * 16, bitSize=32, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name=f'RemoteWriteSize[{i}]', offset=0x108 + i * 16, bitSize=32, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name=f'RemoteReadAddress[{i}]', offset=0x200 + i * 16, bitSize=32, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name=f'RemoteReadSize[{i}]', offset=0x400 + i * 4, bitSize=32, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name=f'TotLatency[{i}]', offset=0x500 + i * 16, bitSize=32, disp='{}', mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name=f'GpuLatency[{i}]', offset=0x504 + i * 16, bitSize=32, disp='{}', mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name=f'WrLatency[{i}]', offset=0x508 + i * 16, bitSize=32, disp='{}', mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name=f'RdLatency[{i}]', offset=0x50C + i * 16, bitSize=32, disp='{}', mode='RO', pollInterval=1, ))
def __init__(self, serial=[None, None], camType=[None, None], **kwargs): super().__init__(**kwargs) ############################## # Variables ############################## self.add( pr.RemoteVariable( name="ChanCount", description="Supported channels", offset=0x00, bitSize=4, bitOffset=0x00, mode="RO", )) self.add( pr.RemoteVariable( name="RstPll", description="Camera link channel PLL reset", offset=0x04, bitSize=1, bitOffset=0, mode="RW", hidden=True, )) @self.command( description="toggles Camera link channel PLL reset", ) def ResetPll(): self.RstPll.set(0x1) self.RstPll.set(0x0) self.add( pr.RemoteCommand( name="ResetFsm", description="Camera link channel FSM reset", offset=0x04, bitSize=1, bitOffset=1, function=pr.BaseCommand.toggle, )) self.add( pr.RemoteCommand( name="CntRst", description="", offset=0x04, bitSize=1, bitOffset=2, function=pr.BaseCommand.toggle, )) self.add( pr.RemoteVariable( name="LinkLockedA", description="Camera link channel locked status", offset=0x10, bitSize=1, bitOffset=0, base=pr.Bool, pollInterval=1, mode="RO", )) self.add( pr.RemoteVariable( name="LinkLockedB", description="Camera link channel locked status", offset=0x10, bitSize=1, bitOffset=1, base=pr.Bool, pollInterval=1, mode="RO", )) self.add( pr.RemoteVariable( name="LinkLockedC", description="Camera link channel locked status", offset=0x10, bitSize=1, bitOffset=2, base=pr.Bool, pollInterval=1, mode="RO", )) self.add( pr.RemoteVariable( name="LinkLockedCntA", description="Camera link channel locked status counter", offset=0x10, bitSize=8, bitOffset=8, disp='{}', mode="RO", pollInterval=1, )) self.add( pr.RemoteVariable( name="LinkLockedCntB", description="Camera link channel locked status counter", offset=0x10, bitSize=8, bitOffset=16, disp='{}', mode="RO", pollInterval=1, )) self.add( pr.RemoteVariable( name="LinkLockedCntC", description="Camera link channel locked status counter", offset=0x10, bitSize=8, bitOffset=24, disp='{}', mode="RO", pollInterval=1, )) self.add( pr.RemoteVariable( name="ShiftCountA", description="Shift count for channel", offset=0x14, bitSize=3, bitOffset=0, mode="RO", pollInterval=1, )) self.add( pr.RemoteVariable( name="ShiftCountB", description="Shift count for channel", offset=0x14, bitSize=3, bitOffset=8, mode="RO", pollInterval=1, )) self.add( pr.RemoteVariable( name="ShiftCountC", description="Shift count for channel", offset=0x14, bitSize=3, bitOffset=16, mode="RO", pollInterval=1, )) self.add( pr.RemoteVariable( name="DelayA", description="Precision delay for channel A", offset=0x18, bitSize=5, bitOffset=0, mode="RO", pollInterval=1, )) self.add( pr.RemoteVariable( name="DelayB", description="Precision delay for channel B", offset=0x18, bitSize=5, bitOffset=8, mode="RO", pollInterval=1, )) self.add( pr.RemoteVariable( name="DelayC", description="Precision delay for channel C", offset=0x18, bitSize=5, bitOffset=16, mode="RO", pollInterval=1, )) self.addRemoteVariables( name="ClkInFreq", description="Clock Input Freq", offset=0x01C, bitSize=32, bitOffset=0, units='Hz', disp='{:d}', mode="RO", pollInterval=1, number=3, stride=4, ) self.addRemoteVariables( name="ClinkClkFreq", description="CameraLink Clock Freq", offset=0x028, bitSize=32, bitOffset=0, units='Hz', disp='{:d}', mode="RO", pollInterval=1, number=3, stride=4, ) for i in range(2): if camType[i] is not None: self.add( surf.protocols.clink.ClinkChannel( name=f'Ch[{i}]', offset=0x100 + (i * 0x100), serial=serial[i], camType=camType[i], # expand = False, )) for i in range(3): self.add( surf.protocols.clink.ClockManager( name=f'Pll[{i}]', offset=0x1000 + (i * 0x1000), type='MMCME2', expand=False, )) for i in range(3): self.add( pr.LocalVariable( name=f'PllConfig[{i}]', description='Sets the PLL to a known set of configurations', mode='RW', value='', ))
def __init__(self, name = "Pgp2bAxi", description = "Configuration and status of a downstream PGP link", writeEn = True, **kwargs): super().__init__(name=name, description=description, **kwargs) if writeEn: self.add(pr.RemoteVariable( name = "Loopback", description = "GT Loopback Mode", offset = 0xC, bitSize = 3, bitOffset = 0, mode = "RW", base = pr.UInt, enum = {0: 'No', 1: 'Near-end PCS', 2: 'Near-end PMA', 4: 'Far-end PMA', 6: 'Far-end PCS'}, )) self.add(pr.RemoteVariable( name = "LocData", description = "Sideband data to transmit", offset = 0x10, bitSize = 8, bitOffset = 0, mode = "RW", base = pr.UInt, )) self.add(pr.RemoteVariable( name = "LocDataEn", description = "Enable sideband data to transmit", offset = 0x10, bitSize = 1, bitOffset = 8, mode = "RW", base = pr.Bool, )) self.add(pr.RemoteVariable( name = "AutoStatus", description = "Auto Status Send Enable (PPI)", offset = 0x14, bitSize = 1, bitOffset = 0, mode = "RW", base = pr.Bool, )) self.add(pr.RemoteVariable( name = "RxPhyReady", offset = 0x20, bitSize = 1, bitOffset = 0, mode = "RO", base = pr.Bool, description = "RX Phy is Ready", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "TxPhyReady", offset = 0x20, bitSize = 1, bitOffset = 1, mode = "RO", base = pr.Bool, description = "TX Phy is Ready", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "RxLocalLinkReady", offset = 0x20, bitSize = 1, bitOffset = 2, mode = "RO", base = pr.Bool, description = "Rx Local Link Ready", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "RxRemLinkReady", offset = 0x20, bitSize = 1, bitOffset = 3, mode = "RO", base = pr.Bool, description = "Rx Remote Link Ready", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "TxLinkReady", offset = 0x20, bitSize = 1, bitOffset = 4, mode = "RO", base = pr.Bool, description = "Tx Link Ready", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "RxLinkPolarity", offset = 0x20, bitSize = 2, bitOffset = 8, mode = "RO", base = pr.UInt, description = "Rx Link Polarity", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "RxRemPause", offset = 0x20, bitSize = 4, bitOffset = 12, mode = "RO", base = pr.UInt, description = "RX Remote Pause Asserted", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "TxLocPause", offset = 0x20, bitSize = 4, bitOffset = 16, mode = "RO", base = pr.UInt, description = "Tx Local Pause Asserted", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "RxRemOverflow", offset = 0x20, bitSize = 4, bitOffset = 20, mode = "RO", base = pr.UInt, description = "Received remote overflow flag", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "TxLocOverflow", offset = 0x20, bitSize = 4, bitOffset = 24, mode = "RO", base = pr.UInt, description = "Received local overflow flag", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "RxRemLinkData", offset = 0x24, bitSize = 8, bitOffset = 0, mode = "RO", base = pr.UInt, description = "", pollInterval = 1, )) countVars = [ "RxCellErrorCount", "RxLinkDownCount", "RxLinkErrorCount", "RxRemOverflow0Count", "RxRemOverflow1Count", "RxRemOverflow2Count", "RxRemOverflow3Count", "RxFrameErrorCoumt", "RxFrameCount", "TxLocOverflow0Count", "TxLocOverflow1Count", "TxLocOverflow2Count", "TxLocOverflow3Count", "TxFrameErrorCount", "TxFrameCount", ] for offset, name in enumerate(countVars): self.add(pr.RemoteVariable( name = name, offset = ((offset*4)+0x28), disp = '{:d}', bitSize = 32, bitOffset = 0, mode = "RO", base = pr.UInt, pollInterval = 1, )) self.add(pr.RemoteVariable( name = "LastTxOpCode", offset = 0x70, bitSize = 8, bitOffset = 0, mode = "RO", base = pr.UInt, description = "", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "LastRxOpCode", offset = 0x74, bitSize = 8, bitOffset = 0, mode = "RO", base = pr.UInt, description = "", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "TxOpCodeCount", offset = 0x78, bitSize = 8, bitOffset = 0, mode = "RO", base = pr.UInt, disp = "{:d}", description = "", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "RxOpCodeCount", offset = 0x7C, bitSize = 8, bitOffset = 0, mode = "RO", base = pr.UInt, disp = "{:d}", description = "", pollInterval = 1, )) self.add(pr.RemoteCommand( name = 'CountReset', offset = 0x00, bitSize = 1, bitOffset = 0, function = pr.BaseCommand.toggle, )) self.add(pr.RemoteCommand( name = "ResetRx", offset = 0x04, bitSize = 1, bitOffset = 0, function = pr.BaseCommand.toggle, )) self.add(pr.RemoteCommand( name = 'ResetTx', offset = 0x04, bitSize = 1, bitOffset = 1, function = pr.BaseCommand.toggle, )) self.add(pr.RemoteCommand( name = 'ResetGt', offset = 0x04, bitSize = 1, bitOffset =2, function = pr.BaseCommand.toggle, )) # @self.command() # def ResetTxRx(): # self.ResetRx.set(1, False) # self.ResetTx.set(1, False) # # Both are same block # self.ResetTx._block.startTransaction(rim.Write, check=True) # self.ResetRx.set(0, False) # self.ResetTx.set(0, False) # self.ResetTx._block.startTransaction(rim.Write, check=True) if writeEn: self.add(pr.RemoteCommand( name = "Flush", offset = 0x08, bitSize = 1, bitOffset = 0, function = pr.BaseCommand.toggle, )) def softReset(self): if writeEn: self.Flush() def hardReset(self): self.ResetTxRx() def countReset(self): self.CountReset() self.add(pr.RemoteVariable( name = "RxClkFreqRaw", offset = 0x64, bitSize = 32, mode = "RO", base = pr.UInt, hidden = True, pollInterval = 1, )) self.add(pr.RemoteVariable( name = "TxClkFreqRaw", offset = 0x68, bitSize = 32, mode = "RO", base = pr.UInt, hidden = True, pollInterval = 1, )) def convtMHz(var): return var.dependencies[0].value() * 1.0E-6 self.add(pr.LinkVariable( name = "RxClkFreq", mode = "RO", units = "MHz", disp = '{:0.2f}', dependencies = [self.RxClkFreqRaw], linkedGet = convtMHz, )) self.add(pr.LinkVariable( name = "TxClkFreq", mode = "RO", units = "MHz", disp = '{:0.2f}', dependencies = [self.TxClkFreqRaw], linkedGet = convtMHz, ))
def __init__(self, description = "LTC2945 Voltage and Current Monitor", shunt = 0, **kwargs): super().__init__(description=description, **kwargs) self.add(pr.RemoteCommand( name = 'ADCReadStart', description = '', offset = 0x100, bitSize = 1, bitOffset = 0, base = pr.UInt, function = lambda cmd: cmd.post(1) )) ####################### # Control Register ####################### self.add(pr.RemoteVariable( name = 'MultiplierSelect', description = 'Selects ADIN or SENSE+/VDD (depends on VinMonitor) data for digital multiplication with SENSE data', offset = 0x0, bitOffset = 0, bitSize = 1, enum = {1: 'SENSE+/VDD', 0: 'ADIN'})) self.add(pr.RemoteVariable( name = 'ShutdownEnable', description = 'Enables Low-Iq / Shutdown Mode', offset = 0x0, bitOffset = 1, bitSize = 1, enum = {0: 'Normal Operation', 1: 'Shutdown'})) self.add(pr.RemoteVariable( name = 'VinMonitor', description = 'Enables VDD or SENSE+ voltage monitoring', offset = 0x0, bitOffset = 2, bitSize = 1, enum = {1: 'SENSE+', 0: 'VDD'})) self.add(pr.RemoteVariable( name = 'AdcBusy', description = 'Adc Current Status', mode = 'RO', offset = 0x0, bitOffset = 3, bitSize = 1)) self.add(pr.RemoteVariable( name = 'TestMode', description = 'Test Mode Halts ADC Operations and Enables Writes to Interal ADC/LOGIC Registers', offset = 0x0, bitOffset = 4, bitSize = 1, enum = {0: 'Disabled', 1: 'Enabled'})) self.add(pr.RemoteVariable( name = 'AdcChannelLabel', description = 'ADC Channel Label for Snapshot Mode', offset = 0x0, bitOffset = 5, bitSize = 2, enum = {0: 'DeltaSense', 1: 'Vin', 2: 'ADIN'})) self.add(pr.RemoteVariable( name = 'AdcSnapshotMode', description = 'Enables ADC Snapshot Mode. Only channel selcted by AdcChannelLabel is measure by the ADC. After the conversion, the BUSY bit is reset and the ADC is halted.', offset = 0x0, bitOffset = 7, bitSize = 1, enum = {0: 'Disabled', 1: 'Enabled'})) ########################## # ALERT Register ######################### alerts = ['MaxPowerAlert', 'MinPowerAlert', 'MaxSenseAlert', 'MinSenseAlert', 'MaxVinAlert', 'MinVinAlert', 'MaxADinAlert', 'MinADinAlert'] for i, name in enumerate(alerts): self.add(pr.RemoteVariable( name = name, offset = 0x4, bitOffset = i, bitSize = 1, enum = {0: 'Disabled', 1: 'Enabled'})) ######################### # STATUS Register ######################### statuses = ['PowerOvervaluePresent', 'PowerUndervaluePresent', 'SenseOvervaluePresent', 'SenseUndervaluePresent', 'VinOvervaluePresent', 'VinUndervaluePresent', 'ADinOvervaluePresent', 'ADinUndervaluePresent'] for i, name in enumerate(statuses): self.add(pr.RemoteVariable( name = name, mode = 'RO', offset = 0x8, bitOffset = i, bitSize = 1, base = pr.Bool)) ########################### # Fault Register ########################### faults = ['PowerOvervalueFault', 'PowerUndervalueFault', 'SenseOvervalueFault', 'SenseUndervalueFault', 'VinOvervalueFault', 'VinUndervalueFault', 'ADinOvervalueFault', 'ADinUndervalueFault'] for i, name in enumerate(faults): self.add(pr.RemoteVariable( name = name, mode = 'RO', offset = 0xC, bitOffset = i, bitSize = 1, base = pr.Bool)) ############################## # Fault Clear ############################# self.add(pr.RemoteCommand( name = 'FaultClear', description = 'Clear faults', offset = 0x10, bitOffset = 0, bitSize = 8, function = pr.RemoteCommand.read)) ############################# # ADC Registers ############################ def convPower(raw): return lambda: (raw.value() * 10.48) / 16777216.0 / shunt def convCurrent(raw): return lambda: (raw.value() * .1024) / 4096.0 / shunt def convVoltage(raw): return lambda: (raw.value() * 102.4) / 4096.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}')) def addGroup(name, offset, mode, conv, units): addPair(name, offset, mode, conv, units) addPair('Max'+name, offset+4, mode, conv, units) addPair('Min'+name, offset+8, mode, conv, units) addGroup('Power', 0x14, 'RO', convPower, 'Watts') addGroup('Current', 0x28, 'RO', convCurrent, 'Amps') addGroup('Vin', 0x3C, 'RO', convVoltage, 'Volts') addGroup('ADin', 0x50, 'RO', convVoltage, 'Volts')
def __init__( self, verify=True, **kwargs): super().__init__( size = (0x1 << 19), **kwargs) ################ # Base addresses ################ generalAddr = (0x0 << 14) offsetCorrector = (0x1 << 14) # With respect to CH # digitalGain = (0x2 << 14) # With respect to CH mainDigital = (0x3 << 14) # With respect to CH jesdDigital = (0x4 << 14) # With respect to CH # decFilter = (0x5 << 14) # With respect to CH # pwrDet = (0x6 << 14) # With respect to CH masterPage = (0x7 << 14) analogPage = (0x8 << 14) chA = (0x0 << 14) chB = (0x8 << 14) rawInterface = (0x1 << 18) ##################### # Add Device Channels ##################### self.add(surf.devices.ti.Adc32Rf45Channel(name='CH[0]',description='Channel A',offset=(0x0 << 14),expand=False,verify=verify)) self.add(surf.devices.ti.Adc32Rf45Channel(name='CH[1]',description='Channel B',offset=(0x8 << 14),expand=False,verify=verify)) ################## # General Register ################## self.add(pr.RemoteCommand( name = "RESET", description = "Send 0x81 value to reset the device", offset = (generalAddr + (4*0x000)), bitSize = 8, bitOffset = 0, base = pr.UInt, # mode = "WO", hidden = True, function = pr.BaseCommand.createTouch(0x81), overlapEn = True, )) self.add(pr.RemoteVariable( name = "HW_RST", description = "Hardware Reset", offset = (0xF << 14), bitSize = 1, bitOffset = 0, base = pr.UInt, mode = "RW", hidden = True, overlapEn = True, )) ############# # Master Page ############# self.add(pr.RemoteVariable( name = "PDN_SYSREF", description = "0 = Normal operation, 1 = SYSREF input capture buffer is powered down and further SYSREF input pulses are ignored", offset = (masterPage + (4*0x020)), bitSize = 1, bitOffset = 4, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "PDN_CHB", description = "0 = Normal operation, 1 = Channel B is powered down", offset = (masterPage + (4*0x020)), bitSize = 1, bitOffset = 1, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "GLOBAL_PDN", description = "0 = Normal operation, 1 = Global power-down enabled", offset = (masterPage + (4*0x020)), bitSize = 1, bitOffset = 0, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "INCR_CM_IMPEDANCE", description = "0 = VCM buffer directly drives the common point of biasing resistors, 1 = VCM buffer drives the common point of biasing resistors with > 5 kOhm", offset = (masterPage + (4*0x032)), bitSize = 1, bitOffset = 5, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "AlwaysWrite0x1_A", description = "Always set this bit to 1", offset = (masterPage + (4*0x039)), bitSize = 1, bitOffset = 6, base = pr.UInt, mode = "WO", value = 0x1, hidden = True, verify = False, overlapEn = True, )) self.add(pr.RemoteVariable( name = "AlwaysWrite0x1_B", description = "Always set this bit to 1", offset = (masterPage + (4*0x039)), bitSize = 1, bitOffset = 4, base = pr.UInt, mode = "WO", value = 0x1, hidden = True, verify = False, overlapEn = True, )) self.add(pr.RemoteVariable( name = "PDN_CHB_EN", description = "This bit enables the power-down control of channel B through the SPI in register 20h: 0 = PDN control disabled, 1 = PDN control enabled", offset = (masterPage + (4*0x039)), bitSize = 1, bitOffset = 1, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "SYNC_TERM_DIS", description = "0 = On-chip, 100-Ohm termination enabled, 1 = On-chip, 100-Ohm termination disabled", offset = (masterPage + (4*0x039)), bitSize = 1, bitOffset = 0, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "SYSREF_DEL_EN", description = "0 = SYSREF delay disabled, 1 = SYSREF delay enabled through register settings [3Ch (bits 1-0), 5Ah (bits 7-5)]", offset = (masterPage + (4*0x03C)), bitSize = 1, bitOffset = 6, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "SYSREF_DEL_HI", description = "When the SYSREF delay feature is enabled (3Ch, bit 6) the delay can be adjusted in 25-ps steps; the first step is 175 ps. The PVT variation of each 25-ps step is +/-10 ps. The 175-ps step is +/-50 ps", offset = (masterPage + (4*0x03C)), bitSize = 2, bitOffset = 0, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "JESD_OUTPUT_SWING", description = "These bits select the output amplitude (VOD) of the JESD transmitter for all lanes.", offset = (masterPage + (4*0x3D)), bitSize = 3, bitOffset = 0, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "SYSREF_DEL_LO", description = "When the SYSREF delay feature is enabled (3Ch, bit 6) the delay can be adjusted in 25-ps steps; the first step is 175 ps. The PVT variation of each 25-ps step is +/-10 ps. The 175-ps step is +/-50 ps", offset = (masterPage + (4*0x05A)), bitSize = 3, bitOffset = 5, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "SEL_SYSREF_REG", description = "0 = SYSREF is logic low, 1 = SYSREF is logic high", offset = (masterPage + (4*0x057)), bitSize = 1, bitOffset = 4, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "ASSERT_SYSREF_REG", description = "0 = SYSREF is asserted by device pins, 1 = SYSREF can be asserted by the ASSERT SYSREF REG register bit", offset = (masterPage + (4*0x057)), bitSize = 1, bitOffset = 3, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "SYNCB_POL", description = "0 = Polarity is not inverted, 1 = Polarity is inverted", offset = (masterPage + (4*0x058)), bitSize = 1, bitOffset = 5, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) # ########## # # ADC PAGE # ########## self.add(pr.RemoteVariable( name = "SLOW_SP_EN1", description = "0 = ADC sampling rates are faster than 2.5 GSPS, 1 = ADC sampling rates are slower than 2.5 GSPS", offset = (analogPage + (4*0x03F)), bitSize = 1, bitOffset = 2, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) self.add(pr.RemoteVariable( name = "SLOW_SP_EN2", description = "0 = ADC sampling rates are faster than 2.5 GSPS, 1 = ADC sampling rates are slower than 2.5 GSPS", offset = (analogPage + (4*0x042)), bitSize = 1, bitOffset = 4, base = pr.UInt, mode = "RW", verify = verify, overlapEn = True, )) ############################## # Commands ############################## @self.command(description = "Device Initiation") def Init(): self._rawWrite(generalAddr + (4*0x0012),0x04) # write 4 to address 12 page select self._rawWrite(generalAddr + (4*0x0056),0x00) # sysref dis - check this was written earlier self._rawWrite(generalAddr + (4*0x0057),0x00) # sysref dis - whether it has to be zero self._rawWrite(generalAddr + (4*0x0020),0x00) self._rawWrite(jesdDigital + chA + (4*0x03E),0x00) self._rawWrite(jesdDigital + chB + (4*0x03E),0x00) self.IL_Config_Nyq1_ChA() self.IL_Config_Nyq1_ChB() time.sleep(0.250) self.SetNLTrim() time.sleep(0.250) self.JESD_DDC_config() time.sleep(0.250) self._rawWrite(offsetCorrector + chA + (4*0x068),0xA2) #... freeze offset estimation self._rawWrite(offsetCorrector + chB + (4*0x068),0xA2) #... freeze offset estimation self._rawWrite(generalAddr + (4*0x0012),0x04) # write 4 to address 12 page select self._rawWrite(generalAddr + (4*0x0056),0x00) # sysref dis - check this was written earlier self._rawWrite(generalAddr + (4*0x0057),0x00) # sysref dis - whether it has to be zero self._rawWrite(generalAddr + (4*0x0020),0x00) self._rawWrite(generalAddr + (4*0x0012),0x04) # write 4 to address 12 page select self._rawWrite(jesdDigital + chA + (4*0x03E),0x40) #... MASK CLKDIV SYSREF self._rawWrite(jesdDigital + chB + (4*0x03E),0x40) #... MASK CLKDIV SYSREF self._rawWrite(jesdDigital + chA + (4*0x03E),0x60) #... MASK CLKDIV SYSREF + MASK NCO SYSREF self._rawWrite(jesdDigital + chB + (4*0x03E),0x60) #... MASK CLKDIV SYSREF + MASK NCO SYSREF self._rawWrite(generalAddr + (4*0x0020),0x10) # PDN_SYSREF = 0x1 @self.command() def Powerup_AnalogConfig(): self._rawWrite(generalAddr + (4*0x0000),0x81) # Global software reset. Remember the sequence of programming the config files is Powerup_Analog_Config-->IL_Config_Nyqx_chA-->IL_Config_Nyqx_chB-->NL_Config_Nyqx_chA-->NL_Config_Nyqx_chB-->JESD_Config self._rawWrite(generalAddr + (4*0x0011),0xFF) # Select ADC page. self._rawWrite(generalAddr + (4*0x0022),0xC0) # Analog trims start here. self._rawWrite(generalAddr + (4*0x0032),0x80) # ... self._rawWrite(generalAddr + (4*0x0033),0x08) # ... self._rawWrite(generalAddr + (4*0x0042),0x03) # ... self._rawWrite(generalAddr + (4*0x0043),0x03) # ... self._rawWrite(generalAddr + (4*0x0045),0x58) # ... self._rawWrite(generalAddr + (4*0x0046),0xC4) # ... self._rawWrite(generalAddr + (4*0x0047),0x01) # ... self._rawWrite(generalAddr + (4*0x0053),0x01) # ... self._rawWrite(generalAddr + (4*0x0054),0x08) # ... self._rawWrite(generalAddr + (4*0x0064),0x05) # ... self._rawWrite(generalAddr + (4*0x0072),0x84) # ... self._rawWrite(generalAddr + (4*0x008C),0x80) # ... self._rawWrite(generalAddr + (4*0x0097),0x80) # ... self._rawWrite(generalAddr + (4*0x00F0),0x38) # ... self._rawWrite(generalAddr + (4*0x00F1),0xBF) # Analog trims ended here. self._rawWrite(generalAddr + (4*0x0011),0x00) # Disable ADC Page self._rawWrite(generalAddr + (4*0x0012),0x04) # Select Master Page self._rawWrite(generalAddr + (4*0x0025),0x01) # Global Analog Trims start here. self._rawWrite(generalAddr + (4*0x0026),0x40) #... self._rawWrite(generalAddr + (4*0x0027),0x80) #... self._rawWrite(generalAddr + (4*0x0029),0x40) #... self._rawWrite(generalAddr + (4*0x002A),0x80) #... self._rawWrite(generalAddr + (4*0x002C),0x40) #... self._rawWrite(generalAddr + (4*0x002D),0x80) #... self._rawWrite(generalAddr + (4*0x002F),0x40) #... self._rawWrite(generalAddr + (4*0x0034),0x01) #... self._rawWrite(generalAddr + (4*0x003F),0x01) #... self._rawWrite(generalAddr + (4*0x0039),0x50) #... self._rawWrite(generalAddr + (4*0x003B),0x28) #... self._rawWrite(generalAddr + (4*0x0040),0x80) #... self._rawWrite(generalAddr + (4*0x0042),0x40) #... self._rawWrite(generalAddr + (4*0x0043),0x80) #... self._rawWrite(generalAddr + (4*0x0045),0x40) #... self._rawWrite(generalAddr + (4*0x0046),0x80) #... self._rawWrite(generalAddr + (4*0x0048),0x40) #... self._rawWrite(generalAddr + (4*0x0049),0x80) #... self._rawWrite(generalAddr + (4*0x004B),0x40) #... self._rawWrite(generalAddr + (4*0x0053),0x60) #... self._rawWrite(generalAddr + (4*0x0059),0x02) #... self._rawWrite(generalAddr + (4*0x005B),0x08) #... self._rawWrite(generalAddr + (4*0x005c),0x07) #... self._rawWrite(generalAddr + (4*0x0057),0x10) # Register control for SYSREF --these lines are added in revision SBAA226C. self._rawWrite(generalAddr + (4*0x0057),0x18) # Pulse SYSREF, pull high --these lines are added in revision SBAA226C. self._rawWrite(generalAddr + (4*0x0057),0x10) # Pulse SYSREF, pull back low --these lines are added in revision SBAA226C. self._rawWrite(generalAddr + (4*0x0057),0x18) # Pulse SYSREF, pull high --these lines are added in revision SBAA226C. self._rawWrite(generalAddr + (4*0x0057),0x10) # Pulse SYSREF, pull back low --these lines are added in revision SBAA226C. self._rawWrite(generalAddr + (4*0x0057),0x00) # Give SYSREF control back to device pin --these lines are added in revision SBAA226C. self._rawWrite(generalAddr + (4*0x0056),0x00) # sysref dis - check this was written earlier self._rawWrite(generalAddr + (4*0x0020),0x00) # Pdn sysref = 0 self._rawWrite(generalAddr + (4*0x0012),0x00) # Master page disabled self._rawWrite(generalAddr + (4*0x0011),0xFF) # Select ADC Page self._rawWrite(generalAddr + (4*0x0083),0x07) # Additioanal Analog trims self._rawWrite(generalAddr + (4*0x005C),0x00) #... self._rawWrite(generalAddr + (4*0x005C),0x01) #... self._rawWrite(generalAddr + (4*0x0011),0x00) #Disable ADC Page. Power up Analog writes end here. Program appropriate -->IL_Config_Nyqx_chA-->IL_Config_Nyqx_chB-->NL_Config_Nyqx_chA-->NL_Config_Nyqx_chB-->JESD_Config self._rawWrite(rawInterface + (4*0x4001),0x00) #DC corrector Bandwidth settings self._rawWrite(rawInterface + (4*0x4002),0x00) #... self._rawWrite(rawInterface + (4*0x4003),0x00) #... self._rawWrite(rawInterface + (4*0x4004),0x61) #... self._rawWrite(rawInterface + (4*0x6068),0x22) #... self._rawWrite(rawInterface + (4*0x4003),0x01) #... self._rawWrite(rawInterface + (4*0x6068),0x22) #... @self.command(description = "Set IL ChA") def IL_Config_Nyq1_ChA(): self._rawWrite(mainDigital + chA + (4*0x044),0x01) # Program global settings for Interleaving Corrector self._rawWrite(mainDigital + chA + (4*0x068),0x04) # self._rawWrite(mainDigital + chA + (4*0x0FF),0xC0) #... self._rawWrite(mainDigital + chA + (4*0x0A2),0x08) # Progam nyquist zone 1 for chA, nyquist zone = 1 : 0x08, nyquist zone = 2 : 0x09, nyquist zone = 3 : 0x0A self._rawWrite(mainDigital + chA + (4*0x0A9),0x03) #... self._rawWrite(mainDigital + chA + (4*0x0AB),0x77) #... self._rawWrite(mainDigital + chA + (4*0x0AC),0x01) #... self._rawWrite(mainDigital + chA + (4*0x0AD),0x77) #... self._rawWrite(mainDigital + chA + (4*0x0AE),0x01) #... self._rawWrite(mainDigital + chA + (4*0x096),0x0F) #... self._rawWrite(mainDigital + chA + (4*0x097),0x26) #... self._rawWrite(mainDigital + chA + (4*0x08F),0x0C) #... self._rawWrite(mainDigital + chA + (4*0x08C),0x08) #... self._rawWrite(mainDigital + chA + (4*0x080),0x0F) #... self._rawWrite(mainDigital + chA + (4*0x081),0xCB) #... self._rawWrite(mainDigital + chA + (4*0x07D),0x03) #... self._rawWrite(mainDigital + chA + (4*0x056),0x75) #... self._rawWrite(mainDigital + chA + (4*0x057),0x75) #... self._rawWrite(mainDigital + chA + (4*0x053),0x00) #... self._rawWrite(mainDigital + chA + (4*0x04B),0x03) #... self._rawWrite(mainDigital + chA + (4*0x049),0x80) #... self._rawWrite(mainDigital + chA + (4*0x043),0x26) #... self._rawWrite(mainDigital + chA + (4*0x05E),0x01) #... self._rawWrite(mainDigital + chA + (4*0x042),0x38) #... self._rawWrite(mainDigital + chA + (4*0x05A),0x04) #... self._rawWrite(mainDigital + chA + (4*0x071),0x20) #... self._rawWrite(mainDigital + chA + (4*0x062),0x00) #... self._rawWrite(mainDigital + chA + (4*0x098),0x00) #... self._rawWrite(mainDigital + chA + (4*0x099),0x08) #... self._rawWrite(mainDigital + chA + (4*0x09C),0x08) #... self._rawWrite(mainDigital + chA + (4*0x09D),0x20) #... self._rawWrite(mainDigital + chA + (4*0x0BE),0x03) #... self._rawWrite(mainDigital + chA + (4*0x069),0x00) #... self._rawWrite(mainDigital + chA + (4*0x045),0x10) #... self._rawWrite(mainDigital + chA + (4*0x08D),0x64) #... self._rawWrite(mainDigital + chA + (4*0x08B),0x20) #... self._rawWrite(mainDigital + chA + (4*0x000),0x00) # Dig Core reset self._rawWrite(mainDigital + chA + (4*0x000),0x01) #... self._rawWrite(mainDigital + chA + (4*0x000),0x00) #... @self.command() def IL_Config_Nyq1_ChB(): self._rawWrite(mainDigital + chB + (4*0x049),0x80) # Special setting for chB self._rawWrite(mainDigital + chB + (4*0x042),0x20) # Special setting for chB self._rawWrite(mainDigital + chB + (4*0x0A2),0x08) # Progam nyquist zone 1 for chB, nyquist zone = 1 : 0x08, nyquist zone = 2 : 0x09, nyquist zone = 3 : 0x0A self._rawWrite(mainDigital + chB + (4*0x003),0x00) # Main digital page selected for chA self._rawWrite(mainDigital + chB + (4*0x000),0x00) #... self._rawWrite(mainDigital + chB + (4*0x000),0x01) #... self._rawWrite(mainDigital + chB + (4*0x000),0x00) #... @self.command(description = "Set nonlinear trims") def SetNLTrim(): # Nonlinearity trims self._rawWrite(rawInterface + (4*0x4003),0x00) #chA Non Linearity Trims for Nyq1. Remember the sequence of programming the config files is Powerup_Analog_Config-->IL_Config_Nyqx_chA-->IL_Config_Nyqx_chB-->NL_Config_Nyqx_chA-->NL_Config_Nyqx_chB-->JESD_Config self._rawWrite(rawInterface + (4*0x4004),0x20) #... self._rawWrite(rawInterface + (4*0x4002),0xF8) #... self._rawWrite(rawInterface + (4*0x603C),0xF5) #... self._rawWrite(rawInterface + (4*0x603D),0x01) #... self._rawWrite(rawInterface + (4*0x603E),0xF0) #... self._rawWrite(rawInterface + (4*0x603F),0x0C) #... self._rawWrite(rawInterface + (4*0x6040),0x0A) #... self._rawWrite(rawInterface + (4*0x6041),0xFE) #... self._rawWrite(rawInterface + (4*0x6053),0xF5) #... self._rawWrite(rawInterface + (4*0x6054),0x01) #... self._rawWrite(rawInterface + (4*0x6055),0xEE) #... self._rawWrite(rawInterface + (4*0x6056),0x0E) #... self._rawWrite(rawInterface + (4*0x6057),0x0B) #... self._rawWrite(rawInterface + (4*0x6058),0xFE) #... self._rawWrite(rawInterface + (4*0x606A),0xF4) #... self._rawWrite(rawInterface + (4*0x606B),0x01) #... self._rawWrite(rawInterface + (4*0x606C),0xF0) #... self._rawWrite(rawInterface + (4*0x606D),0x0B) #... self._rawWrite(rawInterface + (4*0x606E),0x09) #... self._rawWrite(rawInterface + (4*0x606F),0xFE) #... self._rawWrite(rawInterface + (4*0x6081),0xF5) #... self._rawWrite(rawInterface + (4*0x6082),0x01) #... self._rawWrite(rawInterface + (4*0x6083),0xEE) #... self._rawWrite(rawInterface + (4*0x6084),0x0D) #... self._rawWrite(rawInterface + (4*0x6085),0x0A) #... self._rawWrite(rawInterface + (4*0x6086),0xFE) #... self._rawWrite(rawInterface + (4*0x6098),0xFD) #... self._rawWrite(rawInterface + (4*0x6099),0x00) #... self._rawWrite(rawInterface + (4*0x609A),0x00) #... self._rawWrite(rawInterface + (4*0x609B),0x00) #... self._rawWrite(rawInterface + (4*0x609C),0x00) #... self._rawWrite(rawInterface + (4*0x609D),0x00) #... self._rawWrite(rawInterface + (4*0x60AF),0xFF) #... self._rawWrite(rawInterface + (4*0x60B0),0x00) #... self._rawWrite(rawInterface + (4*0x60B1),0x01) #... self._rawWrite(rawInterface + (4*0x60B2),0xFF) #... self._rawWrite(rawInterface + (4*0x60B3),0xFF) #... self._rawWrite(rawInterface + (4*0x60B4),0x00) #... self._rawWrite(rawInterface + (4*0x60C6),0xFE) #... self._rawWrite(rawInterface + (4*0x60C7),0x00) #... self._rawWrite(rawInterface + (4*0x60C8),0x00) #... self._rawWrite(rawInterface + (4*0x60C9),0x02) #... self._rawWrite(rawInterface + (4*0x60CA),0x00) #... self._rawWrite(rawInterface + (4*0x60CB),0x00) #... self._rawWrite(rawInterface + (4*0x60DD),0xFF) #... self._rawWrite(rawInterface + (4*0x60DE),0x00) #... self._rawWrite(rawInterface + (4*0x60DF),0x02) #... self._rawWrite(rawInterface + (4*0x60E0),0x00) #... self._rawWrite(rawInterface + (4*0x60E1),0xFE) #... self._rawWrite(rawInterface + (4*0x60E2),0x00) #... self._rawWrite(rawInterface + (4*0x60F4),0x00) #... self._rawWrite(rawInterface + (4*0x60F5),0x00) #... self._rawWrite(rawInterface + (4*0x60FB),0x01) #... self._rawWrite(rawInterface + (4*0x60FC),0x01) #... self._rawWrite(rawInterface + (4*0x4003),0x00) #chB Non Linearity Trims for Nyq1. Remember the sequence of programming the config files is Powerup_Analog_Config-->IL_Config_Nyqx_chA-->IL_Config_Nyqx_chB-->NL_Config_Nyqx_chA-->NL_Config_Nyqx_chB-->JESD_Config self._rawWrite(rawInterface + (4*0x4004),0x20) #... self._rawWrite(rawInterface + (4*0x4002),0xF9) #... self._rawWrite(rawInterface + (4*0x6074),0xF4) #... self._rawWrite(rawInterface + (4*0x6075),0x01) #... self._rawWrite(rawInterface + (4*0x6076),0xEF) #... self._rawWrite(rawInterface + (4*0x6077),0x0C) #... self._rawWrite(rawInterface + (4*0x6078),0x0A) #... self._rawWrite(rawInterface + (4*0x6079),0xFE) #... self._rawWrite(rawInterface + (4*0x608B),0xF4) #... self._rawWrite(rawInterface + (4*0x608C),0x01) #... self._rawWrite(rawInterface + (4*0x608D),0xEE) #... self._rawWrite(rawInterface + (4*0x608E),0x0D) #... self._rawWrite(rawInterface + (4*0x608F),0x0A) #... self._rawWrite(rawInterface + (4*0x6090),0xFE) #... self._rawWrite(rawInterface + (4*0x60A2),0xF4) #... self._rawWrite(rawInterface + (4*0x60A3),0x01) #... self._rawWrite(rawInterface + (4*0x60A4),0xEF) #... self._rawWrite(rawInterface + (4*0x60A5),0x0C) #... self._rawWrite(rawInterface + (4*0x60A6),0x0A) #... self._rawWrite(rawInterface + (4*0x60A7),0xFE) #... self._rawWrite(rawInterface + (4*0x60B9),0xF4) #... self._rawWrite(rawInterface + (4*0x60BA),0x01) #... self._rawWrite(rawInterface + (4*0x60BB),0xEF) #... self._rawWrite(rawInterface + (4*0x60BC),0x0D) #... self._rawWrite(rawInterface + (4*0x60BD),0x0A) #... self._rawWrite(rawInterface + (4*0x60BE),0xFE) #... self._rawWrite(rawInterface + (4*0x60D0),0xFF) #... self._rawWrite(rawInterface + (4*0x60D1),0x00) #... self._rawWrite(rawInterface + (4*0x60D2),0xFF) #... self._rawWrite(rawInterface + (4*0x60D3),0x01) #... self._rawWrite(rawInterface + (4*0x60D4),0x00) #... self._rawWrite(rawInterface + (4*0x60D5),0x00) #... self._rawWrite(rawInterface + (4*0x60E7),0xFF) #... self._rawWrite(rawInterface + (4*0x60E8),0x00) #... self._rawWrite(rawInterface + (4*0x60E9),0x01) #... self._rawWrite(rawInterface + (4*0x60EA),0x00) #... self._rawWrite(rawInterface + (4*0x60EB),0x00) #... self._rawWrite(rawInterface + (4*0x60EC),0x00) #... self._rawWrite(rawInterface + (4*0x60FE),0xFE) #... self._rawWrite(rawInterface + (4*0x60FF),0x00) #... self._rawWrite(rawInterface + (4*0x4002),0xFA) #... self._rawWrite(rawInterface + (4*0x6000),0xFF) #... self._rawWrite(rawInterface + (4*0x6001),0x02) #... self._rawWrite(rawInterface + (4*0x6002),0x01) #... self._rawWrite(rawInterface + (4*0x6003),0x00) #... self._rawWrite(rawInterface + (4*0x6015),0xFF) #... self._rawWrite(rawInterface + (4*0x6016),0x00) #... self._rawWrite(rawInterface + (4*0x6017),0x01) #... self._rawWrite(rawInterface + (4*0x6018),0x00) #... self._rawWrite(rawInterface + (4*0x6019),0xFF) #... self._rawWrite(rawInterface + (4*0x601A),0x00) #... self._rawWrite(rawInterface + (4*0x602C),0x00) #... self._rawWrite(rawInterface + (4*0x602D),0x00) #... self._rawWrite(rawInterface + (4*0x6033),0x01) #... self._rawWrite(rawInterface + (4*0x6034),0x01) #... self._rawWrite(rawInterface + (4*0x4002),0x00) #... self._rawWrite(rawInterface + (4*0x4003),0x00) #... self._rawWrite(rawInterface + (4*0x4004),0x68) #... self._rawWrite(rawInterface + (4*0x6068),0x00) #... self._rawWrite(rawInterface + (4*0x0011),0x00) #... self._rawWrite(rawInterface + (4*0x0012),0x04) #... self._rawWrite(rawInterface + (4*0x005c),0x87) #... self._rawWrite(rawInterface + (4*0x0012),0x00) #... @self.command() def JESD_DDC_config(): # JESD DIGITAL PAGE channels = self.find(typ=surf.devices.ti.Adc32Rf45Channel) for channel in channels: channel.SCRAMBLE_EN.set(0x1, write=True) channel.node('12BIT_MODE').set(0x0, write=True) # need to use node to find variables with leading # channel.SYNC_REG_EN.set(0x0, write=True) channel.SYNC_REG.set(0x0, write=True) channel.RAMP_12BIT.set(0x0, write=True) channel.JESD_MODE0.set(0x0, write=True) channel.JESD_MODE1.set(0x0, write=True) channel.JESD_MODE2.set(0x1, write=True) channel.LMFC_MASK_RESET.set(0x0, write=True) channel.LINK_LAY_RPAT.set(0x0, write=True) channel.LINK_LAYER_TESTMODE.set(0x0, write=True) channel.node('40X_MODE').set(0x7, write=True) # need to use node to find variables with leading 3 channel.PLL_MODE.set(0x2, write=True) channel.SEL_EMP_LANE0.set(0x03, write=True) channel.SEL_EMP_LANE1.set(0x3F, write=True) # unused lane channel.SEL_EMP_LANE2.set(0x03, write=True) channel.SEL_EMP_LANE3.set(0x3F, write=True) # unused lane channel.TX_LINK_DIS.set(0x0, write=True) channel.FRAME_ALIGN.set(0x1, write=True) channel.LANE_ALIGN.set(0x1, write=True) channel.TESTMODE_EN.set(0x0, write=True) channel.CTRL_K.set(0x1, write=True) channel.FRAMES_PER_MULTIFRAME.set(0x1F, write=True) # Decimation filter page channel.DDC_EN.set(0x1,write=True) channel.DECIM_FACTOR.set(0x0,write=True) channel.DUAL_BAND_EN.set(0x0,write=True) channel.REAL_OUT_EN.set(0x0,write=True) channel.DDC0_NCO1_LSB.set(0x00,write=True) channel.DDC0_NCO1_MSB.set(0x4e,write=True) channel.DDC0_NCO2_LSB.set(0x00,write=True) channel.DDC0_NCO2_MSB.set(0x00,write=True) channel.DDC0_NCO3_LSB.set(0x00,write=True) channel.DDC0_NCO3_MSB.set(0x00,write=True) channel.NCO_SEL_PIN.set(0x00,write=True) channel.NCO_SEL.set(0x00,write=True) channel.LMFC_RESET_MODE.set(0x00,write=True) channel.DDC0_6DB_GAIN.set(0x01,write=True) channel.DDC1_6DB_GAIN.set(0x01,write=True) channel.DDC_DET_LAT.set(0x05,write=True) channel.WBF_6DB_GAIN.set(0x01,write=True) channel.CUSTOM_PATTERN1_LSB.set(0x00,write=True) channel.CUSTOM_PATTERN1_MSB.set(0x00,write=True) channel.CUSTOM_PATTERN2_LSB.set(0x00,write=True) channel.CUSTOM_PATTERN2_MSB.set(0x00,write=True) channel.TEST_PATTERN_SEL.set(0x00,write=True) channel.TEST_PAT_RES.set(0x00,write=True) channel.TP_RES_EN.set(0x00,write=True) @self.command(description = "Digital Reset") def DigRst(): # Wait for 50 ms for the device to estimate the interleaving errors time.sleep(0.250) # TODO: Optimize this timeout self._rawWrite(jesdDigital + chA + (4*0x000),0x00) # clear reset self._rawWrite(jesdDigital + chB + (4*0x000),0x00) # clear reset self._rawWrite(jesdDigital + chA + (4*0x000),0x01) # CHA digital reset self._rawWrite(jesdDigital + chB + (4*0x000),0x01) # CHB digital reset self._rawWrite(jesdDigital + chA + (4*0x000),0x00) # clear reset self._rawWrite(jesdDigital + chB + (4*0x000),0x00) # clear reset # Wait for 50 ms for the device to estimate the interleaving errors time.sleep(0.250) # TODO: Optimize this timeout self._rawWrite(mainDigital + chA + (4*0x000),0x00) # clear reset self._rawWrite(mainDigital + chB + (4*0x000),0x00) # clear reset self._rawWrite(mainDigital + chA + (4*0x000),0x01) # CHA digital reset self._rawWrite(mainDigital + chB + (4*0x000),0x01) # CHB digital reset self._rawWrite(mainDigital + chA + (4*0x000),0x00) # clear reset self._rawWrite(mainDigital + chB + (4*0x000),0x00) # clear reset
def __init__(self, name="Adc32Rf45", description="Adc32Rf45 Module", verify=False, **kwargs): super().__init__(name=name, description=description, size=(0x1 << 18), **kwargs) ################ # Base addresses ################ generalAddr = (0x0 << 14) offsetCorrector = (0x1 << 14) # With respect to CH digitalGain = (0x2 << 14) # With respect to CH mainDigital = (0x3 << 14) # With respect to CH jesdDigital = (0x4 << 14) # With respect to CH decFilter = (0x5 << 14) # With respect to CH pwrDet = (0x6 << 14) # With respect to CH masterPage = (0x7 << 14) analogPage = (0x8 << 14) chA = (0x0 << 14) chB = (0x8 << 14) ##################### # Add Device Channels ##################### self.add( Adc32Rf45Channel(name='CH[0]', description='Channel A', offset=(0x0 << 14), expand=False, verify=verify)) self.add( Adc32Rf45Channel(name='CH[1]', description='Channel B', offset=(0x8 << 14), expand=False, verify=verify)) ################## # General Register ################## self.add( pr.RemoteCommand( name="RESET", description="Send 0x81 value to reset the device", offset=(generalAddr + (4 * 0x000)), bitSize=8, bitOffset=0, base=pr.UInt, # mode = "WO", hidden=True, function=pr.BaseCommand.createTouch(0x81))) self.add( pr.RemoteVariable( name="HW_RST", description="Hardware Reset", offset=(0xF << 14), bitSize=1, bitOffset=0, base=pr.UInt, mode="RW", hidden=True, )) ############# # Master Page ############# self.add( pr.RemoteVariable( name="PDN_SYSREF", description= "0 = Normal operation, 1 = SYSREF input capture buffer is powered down and further SYSREF input pulses are ignored", offset=(masterPage + (4 * 0x020)), bitSize=1, bitOffset=4, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="PDN_CHB", description= "0 = Normal operation, 1 = Channel B is powered down", offset=(masterPage + (4 * 0x020)), bitSize=1, bitOffset=1, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="GLOBAL_PDN", description= "0 = Normal operation, 1 = Global power-down enabled", offset=(masterPage + (4 * 0x020)), bitSize=1, bitOffset=0, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="INCR_CM_IMPEDANCE", description= "0 = VCM buffer directly drives the common point of biasing resistors, 1 = VCM buffer drives the common point of biasing resistors with > 5 kOhm", offset=(masterPage + (4 * 0x032)), bitSize=1, bitOffset=5, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="AlwaysWrite0x1_A", description="Always set this bit to 1", offset=(masterPage + (4 * 0x039)), bitSize=1, bitOffset=6, base=pr.UInt, mode="WO", value=0x1, hidden=True, verify=False, )) self.add( pr.RemoteVariable( name="AlwaysWrite0x1_B", description="Always set this bit to 1", offset=(masterPage + (4 * 0x039)), bitSize=1, bitOffset=4, base=pr.UInt, mode="WO", value=0x1, hidden=True, verify=False, )) self.add( pr.RemoteVariable( name="PDN_CHB_EN", description= "This bit enables the power-down control of channel B through the SPI in register 20h: 0 = PDN control disabled, 1 = PDN control enabled", offset=(masterPage + (4 * 0x039)), bitSize=1, bitOffset=1, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="SYNC_TERM_DIS", description= "0 = On-chip, 100-Ohm termination enabled, 1 = On-chip, 100-Ohm termination disabled", offset=(masterPage + (4 * 0x039)), bitSize=1, bitOffset=0, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="SYSREF_DEL_EN", description= "0 = SYSREF delay disabled, 1 = SYSREF delay enabled through register settings [3Ch (bits 1-0), 5Ah (bits 7-5)]", offset=(masterPage + (4 * 0x03C)), bitSize=1, bitOffset=6, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="SYSREF_DEL_HI", description= "When the SYSREF delay feature is enabled (3Ch, bit 6) the delay can be adjusted in 25-ps steps; the first step is 175 ps. The PVT variation of each 25-ps step is +/-10 ps. The 175-ps step is +/-50 ps", offset=(masterPage + (4 * 0x03C)), bitSize=2, bitOffset=0, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="JESD_OUTPUT_SWING", description= "These bits select the output amplitude (VOD) of the JESD transmitter for all lanes.", offset=(masterPage + (4 * 0x3D)), bitSize=3, bitOffset=0, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="SYSREF_DEL_LO", description= "When the SYSREF delay feature is enabled (3Ch, bit 6) the delay can be adjusted in 25-ps steps; the first step is 175 ps. The PVT variation of each 25-ps step is +/-10 ps. The 175-ps step is +/-50 ps", offset=(masterPage + (4 * 0x05A)), bitSize=3, bitOffset=5, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="SEL_SYSREF_REG", description="0 = SYSREF is logic low, 1 = SYSREF is logic high", offset=(masterPage + (4 * 0x057)), bitSize=1, bitOffset=4, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="ASSERT_SYSREF_REG", description= "0 = SYSREF is asserted by device pins, 1 = SYSREF can be asserted by the ASSERT SYSREF REG register bit", offset=(masterPage + (4 * 0x057)), bitSize=1, bitOffset=3, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="SYNCB_POL", description= "0 = Polarity is not inverted, 1 = Polarity is inverted", offset=(masterPage + (4 * 0x058)), bitSize=1, bitOffset=5, base=pr.UInt, mode="RW", verify=verify, )) # ########## # # ADC PAGE # ########## self.add( pr.RemoteVariable( name="SLOW_SP_EN1", description= "0 = ADC sampling rates are faster than 2.5 GSPS, 1 = ADC sampling rates are slower than 2.5 GSPS", offset=(analogPage + (4 * 0x03F)), bitSize=1, bitOffset=2, base=pr.UInt, mode="RW", verify=verify, )) self.add( pr.RemoteVariable( name="SLOW_SP_EN2", description= "0 = ADC sampling rates are faster than 2.5 GSPS, 1 = ADC sampling rates are slower than 2.5 GSPS", offset=(analogPage + (4 * 0x042)), bitSize=1, bitOffset=2, base=pr.UInt, mode="RW", verify=verify, )) ############################## # Commands ############################## @self.command(name="Init", description="Device Initiation") def Init(): self.RESET() ############## # Analog trims ############## self._rawWrite(analogPage + (4 * 0x0022), 0xC0) # Analog trims start here. self._rawWrite(analogPage + (4 * 0x0032), 0x80) # Dither clk mux : 1 : FLOP CLK self._rawWrite(analogPage + (4 * 0x0033), 0x08) # DAC Prog_vreg_1p5[2:0] : 4 : 1.624 self._rawWrite(analogPage + (4 * 0x0042), 0x03) # Delay_element_trim : 3 : +6 fingers self._rawWrite(analogPage + (4 * 0x0043), 0x03) # Prog_out_diff_reg1/reg_new : 3 : 1.231 self._rawWrite(analogPage + (4 * 0x0045), 0x58) # Clk settings self._rawWrite(analogPage + (4 * 0x0046), 0xC4) # Clk settings self._rawWrite(analogPage + (4 * 0x0047), 0x01) # Clk settings self._rawWrite(analogPage + (4 * 0x0053), 0x01) # Dither_clk_mux : 1 : DITHER_CLK_NEW self._rawWrite(analogPage + (4 * 0x0054), 0x08) # Prog_ftrim_1/2x_hirange self._rawWrite(analogPage + (4 * 0x0064), 0x05) # Adither_msb_force[1:0] : 2 : force 0 self._rawWrite( analogPage + (4 * 0x0072), 0x84) # Offset_interleaving_sample_change : Asserted self._rawWrite(analogPage + (4 * 0x008C), 0x80) # Prog_trim_cdac_force : Asserted self._rawWrite(analogPage + (4 * 0x0097), 0x80) # Prog_trim_fdac_force : Asserted self._rawWrite(analogPage + (4 * 0x00F0), 0x38) # Fuse enable self._rawWrite(analogPage + (4 * 0x00F1), 0xBF) # Analog trims ended here. ##################### # Global Analog Trims ##################### self._rawWrite(masterPage + (4 * 0x0025), 0x01) # Global Analog Trims start here. self._rawWrite(masterPage + (4 * 0x0026), 0x40) # ... self._rawWrite(masterPage + (4 * 0x0027), 0x80) # ... self._rawWrite(masterPage + (4 * 0x0029), 0x40) # ... self._rawWrite(masterPage + (4 * 0x002A), 0x80) # ... self._rawWrite(masterPage + (4 * 0x002C), 0x40) # ... self._rawWrite(masterPage + (4 * 0x002D), 0x80) # ... self._rawWrite(masterPage + (4 * 0x002F), 0x40) # ... self._rawWrite(masterPage + (4 * 0x0034), 0x01) # CHB CAP NL DISABLE self._rawWrite(masterPage + (4 * 0x003F), 0x01) # CHA CAP NL DISABLE self._rawWrite(masterPage + (4 * 0x0039), 0x50) # Iref_50u_inbuf_trim_reg[2:0] : 0x5 self._rawWrite(masterPage + (4 * 0x003B), 0x28) # ... self._rawWrite( masterPage + (4 * 0x0040), 0x80 ) # CHA Sha settings ( Vref_1p6_profg[2:0] : 4 : -100m Incm_prog[2:0] : 4 : +80m) self._rawWrite(masterPage + (4 * 0x0042), 0x40) # ... self._rawWrite(masterPage + (4 * 0x0043), 0x80) # ... self._rawWrite(masterPage + (4 * 0x0045), 0x40) # ... self._rawWrite(masterPage + (4 * 0x0046), 0x80) # ... self._rawWrite(masterPage + (4 * 0x0048), 0x40) # ... self._rawWrite(masterPage + (4 * 0x0049), 0x80) # ... self._rawWrite(masterPage + (4 * 0x004B), 0x40) # ... self._rawWrite( masterPage + (4 * 0x0053), 0x60 ) # Clk buf Prog_outcm[1:0] : 2 : -50m Prog_n_incm[1:0] : 1 : -60m self._rawWrite(masterPage + (4 * 0x0059), 0x02) # No clock disable self._rawWrite(masterPage + (4 * 0x005B), 0x08) # Sp reg Outcm_prog[2:0] : 4 : -100m self._rawWrite(masterPage + (4 * 0x0062), 0xE0) # Sha current -60u self._rawWrite(masterPage + (4 * 0x0065), 0x81) # Incm -> m200m self._rawWrite(masterPage + (4 * 0x006B), 0x04) # self._rawWrite(masterPage + (4 * 0x006C), 0x08) # CSET disable self._rawWrite(masterPage + (4 * 0x006E), 0x80) # Iref_10u_comp_trim : 2 : 20u self._rawWrite(masterPage + (4 * 0x006F), 0xC0) # Intr_coarse_ref_trim : 3 : 60u self._rawWrite(masterPage + (4 * 0x0070), 0xC0) # CSET disable self._rawWrite(masterPage + (4 * 0x0071), 0x03) # CSET disable self._rawWrite(masterPage + (4 * 0x0076), 0xA0) # Prog_stg1_idac_large : 1 : 880u self._rawWrite(masterPage + (4 * 0x0077), 0x0A) # Prog_stg1_idac_large : 1 : 880u self._rawWrite( masterPage + (4 * 0x007D), 0x41) # Clamp dis and Prog_sha_load_cap[1:0] : 1 : 0f self._rawWrite(masterPage + (4 * 0x0081), 0x18) # In_clk_delay_prog[2:0] : 7 : 240f self._rawWrite(masterPage + (4 * 0x0084), 0x55) # Prog_stg1_idac_large : 1 : 880u self._rawWrite( masterPage + (4 * 0x008A), 0x41) # Clamp dis and Prog_sha_load_cap[1:0] : 1 : 0f self._rawWrite(masterPage + (4 * 0x008E), 0x18) # In_clk_delay_prog[2:0] : 7 : 240f self._rawWrite( masterPage + (4 * 0x005c), 0x07 ) # No fuse blown, val = 0x00 //Refsys fuse en =0x07 - NEW PG ######################### # Additional Analog trims ######################### self._rawWrite(analogPage + (4 * 0x0083), 0x07) # flash convergence self._rawWrite(analogPage + (4 * 0x005C), 0x01) # flash convergence ################### # IL Configurations ################### # Channel A self._rawWrite( mainDigital + chA + (4 * 0x0FF), 0xC0 ) # Internal IL writes to improve performance. Transition TDD enable for both channels self._rawWrite(mainDigital + chA + (4 * 0x0A9), 0x03) # Validities for transtion TDD count values self._rawWrite(mainDigital + chA + (4 * 0x0AB), 0x77) # H2L transition TDD count MSB self._rawWrite(mainDigital + chA + (4 * 0x0AC), 0x01) # H2L transition TDD count LSB self._rawWrite(mainDigital + chA + (4 * 0x0AD), 0x77) # L2H transition TDD count MSB self._rawWrite(mainDigital + chA + (4 * 0x0AE), 0x01) # L3H transition TDD count LSB self._rawWrite(mainDigital + chA + (4 * 0x096), 0x0F) # Hw slope threshold1 self._rawWrite(mainDigital + chA + (4 * 0x097), 0x26) # Hw slope threshold2 self._rawWrite( mainDigital + chA + (4 * 0x08F), 0x0C ) # Validity for VALIDITY_BIT_SECONDARY_ESTIM_GF_DBC_ERROR_THRESH, VALIDITY_BIT_SECONDARY_ESTIM_GF_DBFs_ERROR_THRESH self._rawWrite(mainDigital + chA + (4 * 0x08C), 0x08) # Validity for IL_CORR_WINDOW self._rawWrite(mainDigital + chA + (4 * 0x080), 0x0F) # RATIO_CHECK_HIGH_TH self._rawWrite(mainDigital + chA + (4 * 0x081), 0xCB) # RATIO_CHECK_LOW_TH_HIGH_TH_RATIO self._rawWrite( mainDigital + chA + (4 * 0x07D), 0x03 ) # Validities for RATIO_CHECK_HIGH_TH and RATIO_CHECK_LOW_TH_HIGH_TH_RATIO self._rawWrite(mainDigital + chA + (4 * 0x068), 0x00) # BAND_EDGE_SMOOTH_EN (Value of 0 at [1:1]) self._rawWrite(mainDigital + chA + (4 * 0x056), 0x75) # SECONDARY_ESTIM_GF_DBFS_ERROR_THRESH self._rawWrite(mainDigital + chA + (4 * 0x057), 0x75) # SECONDARY_ESTIM_GF_DBC_ERROR_THRESH self._rawWrite(mainDigital + chA + (4 * 0x053), 0x00) # IL_CORR_WINDOW_DIS at bit position [2:2] self._rawWrite(mainDigital + chA + (4 * 0x04B), 0x03) # ADJACENT_EST_CHECK_MAX_CLUSTER_SIZE self._rawWrite(mainDigital + chA + (4 * 0x049), 0x80) # DC correction bandwidth settings self._rawWrite(mainDigital + chA + (4 * 0x043), 0x20) # Validity bit for BAND_EDGE_SMOOTH_EN self._rawWrite( mainDigital + chA + (4 * 0x042), 0x38 ) # Validity bit for DC correction bandwidth settings,Hw slope threshold,ADJACENT_EST_CHECK_MAX_CLUSTER_SIZE self._rawWrite(mainDigital + chA + (4 * 0x05A), 0x04) # NL_FUSE_SAMPLING_FREQ_TOLERANCE self._rawWrite( mainDigital + chA + (4 * 0x071), 0x20 ) # Validity for NL_FUSE_SAMPLING_FREQ_TOLERANCE0x60A2 0x19 // nyquist zone = 2 # Channel B self._rawWrite(mainDigital + chB + (4 * 0x049), 0x80) # DC correction bandwidth settings self._rawWrite( mainDigital + chB + (4 * 0x042), 0x20) # Validity bit for DC correction bandwidth settings self._rawWrite(mainDigital + chB + (4 * 0x0A2), 0x09) # nyquist zone = 2 self._rawWrite(mainDigital + chB + (4 * 0x08D), 0x50) # Firmware writes for NL correction self._rawWrite(mainDigital + chB + (4 * 0x08B), 0x05) # Firmware writes for NL correction self._rawWrite(mainDigital + chB + (4 * 0x000), 0x00) # clear reset # Channel A/B & IL resets self._rawWrite(jesdDigital + chA + (4 * 0x000), 0x00) # clear reset self._rawWrite(jesdDigital + chB + (4 * 0x000), 0x00) # clear reset self._rawWrite(jesdDigital + chA + (4 * 0x000), 0x01) # CHA digital reset self._rawWrite(jesdDigital + chB + (4 * 0x000), 0x01) # CHB digital reset self._rawWrite(jesdDigital + chA + (4 * 0x000), 0x00) # clear reset self._rawWrite(jesdDigital + chB + (4 * 0x000), 0x00) # clear reset self._rawWrite(jesdDigital + chA + (4 * 0x003), 0x00) # No Bypass IL, bypass 0x80 self._rawWrite(jesdDigital + chB + (4 * 0x003), 0x00) # No Bypass IL, bypass 0x80 # Wait for 50 ms for the device to estimate the interleaving errors time.sleep(0.050) # Additional IL Configurations self._rawWrite(mainDigital + chA + (4 * 0x068), 0x04) # Firmware freeze enable 0x04 self._rawWrite(mainDigital + chA + (4 * 0x044), 0x01) # Firmware freeze validity self._rawWrite(mainDigital + chA + (4 * 0x069), 0x00) # Watch Dog timer Disable self._rawWrite(mainDigital + chA + (4 * 0x045), 0x10) # Watch Dog timer Validity self._rawWrite(mainDigital + chA + (4 * 0x08D), 0x64) # Firmware sensor read periodicity set to 100 self._rawWrite(mainDigital + chA + (4 * 0x08B), 0x20) # Firmware sensor read periodicity validity self._rawWrite(mainDigital + chA + (4 * 0x000), 0x00) # clear reset self._rawWrite(mainDigital + chB + (4 * 0x000), 0x00) # clear reset self._rawWrite(mainDigital + chA + (4 * 0x000), 0x01) # CHA digital reset self._rawWrite(mainDigital + chB + (4 * 0x000), 0x01) # CHB digital reset self._rawWrite(mainDigital + chA + (4 * 0x000), 0x00) # clear reset self._rawWrite(mainDigital + chB + (4 * 0x000), 0x00) # clear reset @self.command(name="DigRst", description="Digital Reset") def DigRst(): time.sleep( 0.050 ) # Wait for 50 ms for the device to estimate the interleaving errors self._rawWrite(jesdDigital + chA + (4 * 0x000), 0x00) # clear reset self._rawWrite(jesdDigital + chB + (4 * 0x000), 0x00) # clear reset self._rawWrite(jesdDigital + chA + (4 * 0x000), 0x01) # CHA digital reset self._rawWrite(jesdDigital + chB + (4 * 0x000), 0x01) # CHB digital reset self._rawWrite(jesdDigital + chA + (4 * 0x000), 0x00) # clear reset self._rawWrite(jesdDigital + chB + (4 * 0x000), 0x00) # clear reset time.sleep( 0.050 ) # Wait for 50 ms for the device to estimate the interleaving errors self._rawWrite(mainDigital + chA + (4 * 0x000), 0x00) # clear reset self._rawWrite(mainDigital + chB + (4 * 0x000), 0x00) # clear reset self._rawWrite(mainDigital + chA + (4 * 0x000), 0x01) # CHA digital reset self._rawWrite(mainDigital + chB + (4 * 0x000), 0x01) # CHB digital reset self._rawWrite(mainDigital + chA + (4 * 0x000), 0x00) # clear reset self._rawWrite(mainDigital + chB + (4 * 0x000), 0x00) # clear reset
def __init__(self, **kwargs): super().__init__(size=(0x1 << 18), **kwargs) ################ # Base addresses ################ generalAddr = (0x0 << 14) mainDigital = (0x1 << 14) # With respect to CH # jesdDigital = (0x2 << 14) # With respect to CH # jesdAnalog = (0x3 << 14) # With respect to CH masterPage = (0x7 << 14) analogPage = (0x8 << 14) unusedPages = (0xE << 14) chA = (0x0 << 14) chB = (0x8 << 14) ##################### # Add Device Channels ##################### self.add( surf.devices.ti.Ads54J60Channel(name='CH[0]', description='Channel A', offset=chA, expand=False)) self.add( surf.devices.ti.Ads54J60Channel(name='CH[1]', description='Channel B', offset=chB, expand=False)) ################## # General Register ################## self.add( pr.RemoteCommand( name="RESET", description="Send 0x81 value to reset the device", offset=(generalAddr + (4 * 0x000)), bitSize=8, bitOffset=0, base=pr.UInt, # mode = "WO", hidden=True, function=pr.BaseCommand.createTouch(0x81))) self.add( pr.RemoteVariable( name="HW_RST", description="Hardware Reset", offset=(0xF << 14), bitSize=1, bitOffset=0, base=pr.UInt, mode="RW", hidden=True, )) ############# # Master Page ############# self.add( pr.RemoteVariable( name="PDN_ADC_CHA_0", description="", offset=(masterPage + (4 * 0x20)), bitSize=4, bitOffset=4, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="PDN_ADC_CHB", description="", offset=(masterPage + (4 * 0x20)), bitSize=4, bitOffset=0, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="PDN_BUFFER_CHB_0", description="", offset=(masterPage + (4 * 0x20)), bitSize=2, bitOffset=6, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="PDN_BUFFER_CHA_0", description="", offset=(masterPage + (4 * 0x20)), bitSize=2, bitOffset=4, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="PDN_ADC_CHA_1", description="", offset=(masterPage + (4 * 0x23)), bitSize=4, bitOffset=4, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="PDN_ADC_CHB_1", description="", offset=(masterPage + (4 * 0x23)), bitSize=4, bitOffset=0, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="PDN_BUFFER_CHB_1", description="", offset=(masterPage + (4 * 0x24)), bitSize=2, bitOffset=6, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="PDN_BUFFER_CHA_1", description="", offset=(masterPage + (4 * 0x24)), bitSize=2, bitOffset=4, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="GLOBAL_PDN", description="", offset=(masterPage + (4 * 0x26)), bitSize=1, bitOffset=7, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="OVERRIDE_PDN_PIN", description="", offset=(masterPage + (4 * 0x26)), bitSize=1, bitOffset=6, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="PDN_MASK_SEL", description="", offset=(masterPage + (4 * 0x26)), bitSize=1, bitOffset=5, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="EN_INPUT_DC_COUPLING", description="", offset=(masterPage + (4 * 0x4F)), bitSize=1, bitOffset=0, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="MASK_SYSREF", description="", offset=(masterPage + (4 * 0x53)), bitSize=1, bitOffset=6, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="EN_SYSREF_DC_COUPLING", description="", offset=(masterPage + (4 * 0x53)), bitSize=1, bitOffset=1, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="SET_SYSREF", description="", offset=(masterPage + (4 * 0x53)), bitSize=1, bitOffset=0, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="ENABLE_MANUAL_SYSREF", description="", offset=(masterPage + (4 * 0x54)), bitSize=1, bitOffset=7, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="PDN_MASK", description="", offset=(masterPage + (4 * 0x55)), bitSize=1, bitOffset=4, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="FOVR_CHB", description="", offset=(masterPage + (4 * 0x59)), bitSize=1, bitOffset=7, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="AlwaysWrite0x1_A", description="Always set this bit to 1", offset=(masterPage + (4 * 0x59)), bitSize=1, bitOffset=5, base=pr.UInt, mode="WO", value=0x1, hidden=True, verify=False, )) ############# # Analog Page ############# self.add( pr.RemoteVariable( name="FOVR_THRESHOLD_PROG", description="", offset=(analogPage + (4 * 0x5F)), bitSize=8, bitOffset=0, base=pr.UInt, mode="RW", )) ############################## # Commands ############################## @self.command(name="DigRst", description="Digital Reset") def DigRst(): self._rawWrite(mainDigital + chA + (4 * 0x000), 0x00) # CHA: clear reset self._rawWrite(mainDigital + chB + (4 * 0x000), 0x00) # CHB: clear reset self._rawWrite(mainDigital + chA + (4 * 0x000), 0x01) # CHA: PULSE RESET self._rawWrite(mainDigital + chB + (4 * 0x000), 0x01) # CHB: PULSE RESET self._rawWrite(mainDigital + chA + (4 * 0x000), 0x00) # CHA: clear reset self._rawWrite(mainDigital + chB + (4 * 0x000), 0x00) # CHB: clear reset @self.command(name="PllRst", description="PLL Reset") def PllRst(): self._rawWrite(mainDigital + chA + (4 * 0x017), 0x00) # CHA: PLL clear self._rawWrite(mainDigital + chB + (4 * 0x017), 0x00) # CHB: PLL clear self._rawWrite(mainDigital + chA + (4 * 0x017), 0x40) # CHA: PLL reset self._rawWrite(mainDigital + chB + (4 * 0x017), 0x40) # CHB: PLL reset self._rawWrite(mainDigital + chA + (4 * 0x017), 0x00) # CHA: PLL clear self._rawWrite(mainDigital + chB + (4 * 0x017), 0x00) # CHB: PLL clear @self.command(name="Init", description="Device Initiation") def Init(): self.HW_RST.set(0x1) self.HW_RST.set(0x0) time.sleep(0.001) self.RESET() self._rawWrite( unusedPages, 0x00 ) # Clear any unwanted content from the unused pages of the JESD bank. self._rawWrite( mainDigital + chA + (4 * 0x0F7), 0x01 ) # Use the DIG RESET register bit to reset all pages in the JESD bank (self-clearing bit) self._rawWrite( mainDigital + chB + (4 * 0x0F7), 0x01 ) # Use the DIG RESET register bit to reset all pages in the JESD bank (self-clearing bit) self._rawWrite(mainDigital + chA + (4 * 0x000), 0x01) # CHA: PULSE RESET self._rawWrite(mainDigital + chB + (4 * 0x000), 0x01) # CHB: PULSE RESET self._rawWrite(mainDigital + chA + (4 * 0x000), 0x00) # CHA: clear reset self._rawWrite(mainDigital + chB + (4 * 0x000), 0x00) # CHB: clear reset self._rawWrite(masterPage + (4 * 0x059), 0x20) # Set the ALWAYS WRITE 1 bit self.PllRst()
def __init__(self, name="AxiStreamBatcherEventBuilder", description="AxiStreamBatcherEventBuilder Container", numberSlaves=1, tickUnit='TBD', **kwargs): super().__init__(name=name, description=description, **kwargs) self.addRemoteVariables( name='DataCnt', description='Increments every time a data frame is received', offset=0x000, bitSize=32, mode='RO', number=numberSlaves, stride=4, pollInterval=1, ) self.addRemoteVariables( name='NullCnt', description='Increments every time a null frame is received', offset=0x100, bitSize=32, mode='RO', number=numberSlaves, stride=4, pollInterval=1, ) self.addRemoteVariables( name='TimeoutDropCnt', description= 'Increments every time a timeout slave channel drop event happens', offset=0x200, bitSize=32, mode='RO', number=numberSlaves, stride=4, pollInterval=1, ) self.add( pr.RemoteVariable( name='TransactionCnt', description= 'Increments every time a transition frame is received', offset=0xFC0, bitSize=32, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='TRANS_TDEST_G', description='TRANS_TDEST_G generic value', offset=0xFC4, bitSize=8, mode='RO', )) self.add( pr.RemoteVariable( name='Bypass', description='Mask to bypass a channel', offset=0xFD0, bitSize=numberSlaves, mode='RW', )) self.add( pr.RemoteVariable( name='Timeout', description= 'Sets the timer\'s timeout duration. Setting to 0x0 (default) bypasses the timeout feature', offset=0xFF0, bitSize=32, mode='RW', units=tickUnit, )) self.add( pr.RemoteVariable( name='NUM_SLAVES_G', description='NUM_SLAVES_G generic value', offset=0xFF4, bitSize=8, mode='RO', disp='{:d}', )) self.add( pr.RemoteVariable( name="State", description="current state of FSM (for debugging)", offset=0xFF8, bitSize=1, bitOffset=8, mode="RO", pollInterval=1, enum={ 0x0: 'IDLE_S', 0x1: 'MOVE_S', }, )) self.add( pr.RemoteVariable( name="Blowoff", description="Blows off the inbound AXIS stream (for debugging)", offset=0xFF8, bitSize=1, bitOffset=0, base=pr.Bool, mode="RW", )) self.add( pr.RemoteCommand( name="CntRst", description="", offset=0xFFC, bitSize=1, bitOffset=0, function=pr.BaseCommand.toggle, )) self.add( pr.RemoteCommand( name="TimerRst", description="", offset=0xFFC, bitSize=1, bitOffset=1, function=pr.BaseCommand.toggle, )) self.add( pr.RemoteCommand( name="HardRst", description="", offset=0xFFC, bitSize=1, bitOffset=2, function=pr.BaseCommand.toggle, )) self.add( pr.RemoteCommand( name="SoftRst", description="", offset=0xFFC, bitSize=1, bitOffset=3, function=pr.BaseCommand.toggle, ))
def __init__(self, **kwargs): super().__init__(**kwargs) ############################## # Variables ############################## self.add( pr.RemoteVariable(name="PhyReadyCount", offset=0x00, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", disp='{:d}')) self.add( pr.RemoteVariable(name="RxPauseCount", offset=0x04, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", disp='{:d}')) self.add( pr.RemoteVariable(name="TxPauseCount", offset=0x08, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", disp='{:d}')) self.add( pr.RemoteVariable(name="RxCountEn", offset=0x0C, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", disp='{:d}')) self.add( pr.RemoteVariable(name="RxOverflowCount", offset=0x10, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", disp='{:d}')) self.add( pr.RemoteVariable(name="RxCrcErrorCount", offset=0x14, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", disp='{:d}')) self.add( pr.RemoteVariable(name="TxCountEn", offset=0x18, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", disp='{:d}')) self.add( pr.RemoteVariable(name="TxUnderRunCount", offset=0x1C, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", disp='{:d}')) self.add( pr.RemoteVariable(name="TxNotReadyCount", offset=0x20, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", disp='{:d}')) self.add( pr.RemoteVariable( name="StatusVector", offset=0x100, bitSize=9, bitOffset=0x00, base=pr.UInt, mode="RO", )) self.add( pr.RemoteVariable( name="PhyStatus", offset=0x108, bitSize=8, bitOffset=0x00, base=pr.UInt, mode="RO", )) self.add( pr.RemoteVariable( name="MacAddress", offset=0x200, bitSize=48, bitOffset=0x00, base=pr.UInt, mode="RO", )) self.add( pr.RemoteVariable( name="PauseTime", offset=0x21C, bitSize=16, bitOffset=0x00, base=pr.UInt, mode="RO", )) self.add( pr.RemoteVariable( name="FilterEnable", offset=0x228, bitSize=1, bitOffset=0x00, base=pr.UInt, mode="RO", )) self.add( pr.RemoteVariable( name="PauseEnable", offset=0x22C, bitSize=1, bitOffset=0x00, base=pr.UInt, mode="RO", )) self.add( pr.RemoteVariable( name="RollOverEn", offset=0xF00, bitSize=9, bitOffset=0x00, base=pr.UInt, mode="RW", )) self.add( pr.RemoteCommand(name="CounterReset", offset=0xFF4, bitSize=1, bitOffset=0x00, base=pr.UInt, function=pr.RemoteCommand.touchOne)) self.add( pr.RemoteCommand(name="SoftReset", offset=0xFF8, bitSize=1, bitOffset=0x00, base=pr.UInt, function=pr.RemoteCommand.touchOne)) self.add( pr.RemoteCommand(name="HardReset", offset=0xFFC, bitSize=1, bitOffset=0x00, base=pr.UInt, function=pr.RemoteCommand.touchOne))
def __init__(self, name='Sem', description='FEB Soft Error Mitigation Module', **kwargs): super().__init__(name=name, description=description, **kwargs) self.add( pr.RemoteVariable(name="SemStatus", offset=0x00, bitSize=7, bitOffset=0, mode='RO', base=pr.UInt, pollInterval=5, enum={ 0: 'Initialization', 1: 'Undef_0x1', 2: 'Observation', 4: 'Correction', 8: 'Classification', 16: 'Injection', 32: 'Idle', 95: 'Halt' })) self.add( pr.RemoteVariable(name="Essential", offset=0x00, bitSize=1, bitOffset=7, mode='RO', base=pr.Bool, pollInterval=5)) self.add( pr.RemoteVariable(name="Uncorrectable", offset=0x00, bitSize=1, bitOffset=8, mode='RO', base=pr.Bool, pollInterval=5)) self.add( pr.RemoteVariable(name="HeartbeatCount", offset=0x04, bitSize=32, bitOffset=0, mode='RO', base=pr.UInt, pollInterval=5)) self.add( pr.RemoteVariable(name="InjectBitAddress", offset=0x10, bitSize=5, bitOffset=0, base=pr.UInt)) self.add( pr.RemoteVariable(name="InjectWordAddress", offset=0x10, bitSize=7, bitOffset=5, base=pr.UInt)) self.add( pr.RemoteVariable(name="InjectLinearFrame", offset=0x10, bitSize=17, bitOffset=12, base=pr.UInt)) self.add( pr.RemoteVariable(name="InjectAddrHigh", offset=0x10, bitSize=11, bitOffset=29, base=pr.UInt)) countNames = [ 'InitilizationCount', 'ObservationCount', 'CorrectionCount', 'ClassificationCount', 'InjectionCount', 'IdleCount', 'EssentialCount', 'UncorrectableCount' ] for i, name in enumerate(countNames): self.add( pr.RemoteVariable(name=name, mode='RO', offset=0x20 + (i * 4), bitSize=12, bitOffset=0, base=pr.UInt, disp='{:d}')) self.CorrectionCount.pollInterval = 5 self.add( pr.RemoteCommand(name="InjectStrobe", offset=0x0C, bitSize=1, bitOffset=0, base=pr.UInt, function=pr.BaseCommand.touchOne)) self.add( pr.RemoteVariable( name='FpgaIndex', description='FPGA Index', offset=0xFC, bitSize=4, mode='RW', )) @self.command( description= 'Direct a transition to the IDLE state through the Injection interface' ) def InjectIdleState(): self.InjectAddrHigh.set(0xE00 >> 1) self.InjectStrobe() @self.command( description= 'Direct a transition to the OBSERVATION state through the Injection interface' ) def InjectObservationState(): self.InjectAddrHigh.set(0xA00 >> 1) self.InjectStrobe() @self.command(description='Inject a SEM error') def InjectError(): self.InjectIdleState() self.InjectAddrHigh.set(0xC00 >> 1) self.InjectStrobe() self.InjectObservationState() @self.command(description='Inject a SEM Reset') def InjectReset(): self.InjectIdleState() self.InjectAddrHigh.set(0xB00 >> 1) self.InjectStrobe()
def __init__(self, name='Ad9249ReadoutGroup', description='Configure readout of 1 bank of an AD9249', fpga='7series', channels=8, **kwargs): assert (channels > 0 and channels <= 8 ), f'channels ({channels}) must be between 0 and 8' super().__init__(name=name, description=description, **kwargs) if fpga == '7series': delayBits = 6 elif fpga == 'ultrascale': delayBits = 10 else: delayBits = 6 for i in range(channels): self.add( pr.RemoteVariable( name=f'ChannelDelay[{i}]', description=f'IDELAY value for serial channel {i}', offset=i * 4, bitSize=delayBits, bitOffset=0, base=pr.UInt, mode='RW', verify=False, )) self.add( pr.RemoteVariable( name='FrameDelay', description='IDELAY value for FCO', offset=0x20, bitSize=delayBits, bitOffset=0, base=pr.UInt, mode='RW', verify=False, )) self.add( pr.RemoteVariable( name='LostLockCount', description= 'Number of times that frame lock has been lost since reset', offset=0x30, bitSize=16, bitOffset=0, base=pr.UInt, mode='RO', )) self.add( pr.RemoteVariable( name='Locked', description='Readout has locked on to the frame boundary', offset=0x30, bitSize=1, bitOffset=16, base=pr.Bool, mode='RO', )) self.add( pr.RemoteVariable( name='AdcFrame', description='Last deserialized FCO value for debug', offset=0x34, bitSize=16, bitOffset=0, base=pr.UInt, mode='RO', )) self.add( pr.RemoteVariable( name='Invert', description='Optional ADC data inversion (offset binary only)', offset=0x40, bitSize=1, bitOffset=0, base=pr.Bool, mode='RW', )) for i in range(channels): self.add( pr.RemoteVariable( name=f'AdcChannel[{i:d}]', description= f'Last deserialized channel {i:d} ADC value for debug', offset=0x80 + (i * 4), bitSize=32, bitOffset=0, base=pr.UInt, disp='{:_x}', mode='RO', )) self.add( pr.RemoteCommand( name='LostLockCountReset', description='Reset LostLockCount', function=pr.BaseCommand.toggle, offset=0x38, bitSize=1, bitOffset=0, )) self.add( pr.RemoteCommand( name='FreezeDebug', description='Freeze all of the AdcChannel registers', hidden=True, offset=0xA0, bitSize=1, bitOffset=0, base=pr.UInt, function=pr.RemoteCommand.touch))
def __init__( self, name = "SsiPrbsTx", description = "SsiPrbsTx", **kwargs): super().__init__(name=name, description=description, **kwargs) ############################## # Variables ############################## self.add(pr.RemoteVariable( name = "AxiEn", description = "", offset = 0x00, bitSize = 1, bitOffset = 0x00, base = pr.Bool, mode = "RW", )) self.add(pr.RemoteVariable( name = "TxEn", description = "", offset = 0x00, bitSize = 1, bitOffset = 0x01, base = pr.Bool, mode = "RW", )) self.add(pr.RemoteVariable( name = "Busy", description = "", offset = 0x00, bitSize = 1, bitOffset = 0x02, base = pr.UInt, mode = "RO", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "Overflow", description = "", offset = 0x00, bitSize = 1, bitOffset = 0x03, base = pr.UInt, mode = "RO", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "FwCnt", description = "", offset = 0x00, bitSize = 1, bitOffset = 0x05, base = pr.Bool, mode = "RW", )) self.add(pr.RemoteVariable( name = "PacketLength", description = "", offset = 0x04, bitSize = 32, bitOffset = 0x00, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "tDest", description = "", offset = 0x08, bitSize = 8, bitOffset = 0x00, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "tId", description = "", offset = 0x08, bitSize = 8, bitOffset = 8, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "DataCount", description = "", offset = 0x0C, bitSize = 32, bitOffset = 0x00, base = pr.UInt, mode = "RO", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "EventCount", description = "", offset = 0x10, bitSize = 32, bitOffset = 0x00, base = pr.UInt, mode = "RO", pollInterval = 1, )) self.add(pr.RemoteVariable( name = "RandomData", description = "", offset = 0x14, bitSize = 32, bitOffset = 0x00, base = pr.UInt, mode = "RO", pollInterval = 1, )) self.add(pr.RemoteCommand( name = "OneShot", description = "", offset = 0x18, bitSize = 1, bitOffset = 0, base = pr.UInt, function = pr.BaseCommand.touchOne )) self.add(pr.RemoteVariable( name = "TrigDly", offset = 0x1C, bitSize = 32, mode = "RW", ))
def __init__(self, name="EmuTimingFsm", description="Container for EmuTiming FSM registers", ADDR_WIDTH_G=10, **kwargs): super().__init__(name=name, description=description, **kwargs) self.add( pr.RemoteCommand( name="OneShot", description="One-shot trigger the FSM", offset=0x00, bitSize=1, function=lambda cmd: cmd.post(1), )) self.add( pr.RemoteVariable( name='TimerSize', description= 'Sets the timer\'s timeout configuration size between iterations', offset=0x04, bitSize=32, mode='RW', units='1/160MHz', )) self.add( pr.RemoteVariable( name='MaxAddr', description= 'Max address used in the looping through the timing/trigger pattern LUTs', offset=0x08, bitSize=ADDR_WIDTH_G, mode='RW', )) self.add( pr.RemoteVariable( name='Iteration', description= 'Number of time to loop through the timing/trigger pattern LUTs', offset=0x0C, bitSize=16, mode='RW', )) self.add( pr.RemoteVariable( name='BackPreasureCnt', description= 'Increments when back pressure detected during AXIS streaming', offset=0x10, bitSize=32, mode='RO', )) self.add( pr.RemoteVariable( name='Busy', description='0x0 in IDLE state else 0x1', offset=0x14, bitSize=1, mode='RO', ))
def __init__(self, name="ClinkChannel", description="CameraLink channel", serial=None, camType=None, **kwargs): super().__init__(name=name, description=description, **kwargs) ############################## # Variables ############################## self.add( pr.RemoteVariable( name="LinkMode", offset=0x00, bitSize=3, bitOffset=0, mode="RW", enum={ 0: 'Disable', 1: 'Base', 2: 'Medium', 3: 'Full', 4: 'Deca' }, description=""" Link mode control for camera link lanes: Disable: Nothing connected Base: Port Supported [A,B,C], # of chips = 1, # of connectors = 1 Medium: Port Supported [A,B,C,D,E,F], # of chips = 2, # of connectors = 2 Full: Port Supported [A,B,C,D,E,F,G,H], # of chips = 3, # of connectors = 3 Deca: Refer to section /"2.2.3 Camera Link 80 bit/" CameraLink spec V2.0, page 16 """, )) self.add( pr.RemoteVariable( name="DataMode", description="Data mode", offset=0x04, bitSize=4, bitOffset=0, mode="RW", enum={ 0: 'None', 1: '8Bit', 2: '10Bit', 3: '12Bit', 4: '14Bit', 5: '16Bit', 6: '24Bit', 7: '30Bit', 8: '36Bit' }, )) self.add( pr.RemoteVariable( name="FrameMode", offset=0x08, bitSize=2, bitOffset=0, mode="RW", enum={ 0: 'None', 1: 'Line', 2: 'Frame' }, description=""" None: Disables output Line: 1D camera Frame" 2D pixel array """, )) self.add( pr.RemoteVariable( name="TapCount", description= "# of video output taps on the Camera Link Interface (# of individual data value channels)", offset=0x0C, bitSize=4, bitOffset=0, minimum=0, maximum=10, mode="RW", )) self.add( pr.RemoteVariable( name="DataEn", description= "Data enable. When 0x0 causes reset on ClinkData\'s FSM module", offset=0x10, bitSize=1, bitOffset=0, base=pr.Bool, mode="RW", )) self.add( pr.RemoteVariable( name="Blowoff", description= "Blows off the outbound AXIS stream (for debugging)", offset=0x10, bitSize=1, bitOffset=1, base=pr.Bool, mode="RW", )) self.add( pr.RemoteCommand( name="CntRst", description="", offset=0x10, bitSize=1, bitOffset=2, function=pr.BaseCommand.toggle, )) self.add( pr.RemoteVariable( name="SerThrottle", description= "Throttles the UART Serial TX byte rate. Used when the camera cannot accept new bytes until the previous command processed", offset=0x10, bitSize=16, bitOffset=16, disp='{}', mode="RW", units="microsec", value=30000, # 30ms/byte )) self.add( pr.RemoteVariable( name="BaudRate", description="Baud rate", offset=0x14, bitSize=24, bitOffset=0, disp='{}', mode="RW", units="bps", value=9600, )) self.add( pr.RemoteVariable( name="SwControlValue", description="Software camera control bit values", offset=0x18, bitSize=4, bitOffset=0, mode="RW", )) self.add( pr.RemoteVariable( name="SwControlEn", description= "Software camera control bit enable mask for lane A", offset=0x1C, bitSize=4, bitOffset=0, mode="RW", )) self.add( pr.RemoteVariable( name="Running", description="Camera link lane running status", offset=0x20, bitSize=1, bitOffset=0, base=pr.Bool, mode="RO", pollInterval=1, )) self.add( pr.RemoteVariable( name="FrameCount", description="Frame counter", offset=0x24, bitSize=32, bitOffset=0, disp='{}', mode="RO", pollInterval=1, )) self.add( pr.RemoteVariable( name="DropCount", description="Drop counter", offset=0x28, bitSize=32, bitOffset=0, disp='{}', mode="RO", pollInterval=1, )) ############################################################################## self._rx = None self._tx = None # Check if serial interface defined if serial is not None: # Check for OPA1000 camera if (camType == 'Opal1000'): # Override defaults self.BaudRate._default = 57600 # Add the device self.add( cl.UartOpal1000( name='UartOpal1000', serial=serial, expand=False, )) # Check for Piranha4 camera elif (camType == 'Piranha4'): # Add the device self.add( cl.UartPiranha4( name='UartPiranha4', serial=serial, expand=False, )) # Check for Uniq UP-900CL-12B camera elif (camType == 'Up900cl12b'): # Override defaults self.SerThrottle._default = 30000 # Add the device self.add( cl.UartUp900cl12b( name='UartUp900cl12b', serial=serial, expand=False, )) # Else generic interface to serial stream elif camType is None: # Add the device self.add( cl.UartGeneric( name='UartGeneric', serial=serial, expand=False, )) else: raise ValueError('Invalid camType (%s)' % (camType))
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))
def __init__(self, enLclsI=False, enLclsII=True, **kwargs): super().__init__(**kwargs) self.add( pr.RemoteVariable( name='MasterEnable', description= 'Enables both the trigger and event processing in Firmware', offset=0x00, bitSize=1, bitOffset=0, base=pr.Bool, mode='RW', pollInterval=1, )) self.add( pr.RemoteVariable( name='TriggerCount', offset=0x28, bitSize=32, bitOffset=0, base=pr.UInt, mode='RO', disp='{:d}', pollInterval=1, )) if enLclsII: self.add( pr.RemoteVariable( name='Partition', description='Selected Partition to listen for events on', offset=0x04, bitSize=3, bitOffset=0, base=pr.UInt, mode='RW', disp='{:d}', pollInterval=1, )) self.add( pr.RemoteVariable(name='TriggerSource', description='Source of trigger', offset=0x04, bitSize=1, bitOffset=16, base=pr.UInt, mode='RW', enum={ 0: 'XPM', 1: 'EVR' })) self.add( pr.RemoteVariable( name='PauseThreshold', description='Buffer level at which Pause is asserted', offset=0x08, bitSize=5, bitOffset=0, base=pr.UInt, mode='RW', disp='{:d}', pollInterval=1, )) self.add( pr.RemoteVariable( name='TriggerDelay', description= 'Number of timingClk cycles to delay trigger output to application', offset=0x0C, bitSize=32, bitOffset=0, base=pr.UInt, mode='RW', disp='{:d}', pollInterval=1, )) self.add( pr.RemoteVariable( name='XpmOverflow', description='Overflow signal to XPM Feedback', offset=0x10, bitSize=1, bitOffset=0, base=pr.Bool, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='XpmPause', description='Pause condition and signal to XPM Feedback', offset=0x10, bitSize=1, bitOffset=1, base=pr.Bool, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='FifoOverflow', description='Event Buffer Overflow condition', offset=0x10, bitSize=1, bitOffset=2, base=pr.Bool, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='FifoPause', description='Event Buffer Pause condition', offset=0x10, bitSize=1, bitOffset=3, base=pr.Bool, mode='RO', pollInterval=1, )) if enLclsII: self.add( pr.RemoteVariable( name='FifoWrCnt', description='Number of Events in Event Buffer', offset=0x10, bitSize=5, bitOffset=4, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='L0Count', description='Number of L0 Triggers received', offset=0x14, bitSize=32, bitOffset=0, base=pr.UInt, mode='RO', disp='{:d}', pollInterval=1, )) self.add( pr.RemoteVariable( name='L1AcceptCount', description='Number of L1 Triggers Accepted', offset=0x18, bitSize=32, bitOffset=0, base=pr.UInt, mode='RO', disp='{:d}', pollInterval=1, )) self.add( pr.RemoteVariable( name='L1RejectCount', description='Number of L1 Triggers Rejected', offset=0x1C, bitSize=32, bitOffset=0, base=pr.UInt, mode='RO', disp='{:d}', pollInterval=1, )) self.add( pr.RemoteVariable( name='TransitionCount', description='', offset=0x20, bitSize=32, bitOffset=0, base=pr.UInt, mode='RO', disp='{:d}', pollInterval=1, )) self.add( pr.RemoteVariable( name='XpmMessageCount', description='', offset=0x24, bitSize=32, bitOffset=0, base=pr.UInt, mode='RO', disp='{:d}', pollInterval=1, )) self.add( pr.RemoteVariable( name='LastPartitionAddr', offset=0x2C, bitSize=32, bitOffset=0, base=pr.UInt, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='LastPartitionWord0', offset=0x30, bitSize=48, bitOffset=0, base=pr.UInt, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='PauseToTrig', offset=0x38, bitSize=12, bitOffset=0, base=pr.UInt, mode='RO', pollInterval=1, )) self.add( pr.RemoteVariable( name='NotPauseToTrig', offset=0x3C, bitSize=12, bitOffset=0, base=pr.UInt, mode='RO', pollInterval=1, )) self.add( pr.RemoteCommand(name='ResetCounters', offset=0x40, bitSize=1, bitOffset=0, function=pr.RemoteCommand.touchOne)) self.add( pr.RemoteCommand(name='FifoReset', offset=0x10, bitSize=1, bitOffset=31, function=pr.RemoteCommand.touchOne))