def __init__(self, name="FIR", description="Finite Impulse Response", **kwargs): super().__init__(name=name, description=description, **kwargs) for i in range(8): self.add( pr.RemoteVariable( name='CoefficientSet' + str(i), description='FIR coefficients', offset=i * 4, bitSize=32, bitOffset=0, mode='RW', disp='{:#08x}', )) self.add( pr.RemoteVariable( name='LoadCoefficients', description='LoadCoefficients', offset=32, bitSize=1, bitOffset=0, mode='RW', verify=False, disp='{:#01x}', ))
def __init__(self, name="ByPass", description="ByPass Container", **kwargs): super().__init__(name=name, description=description, **kwargs) self.add( pr.RemoteVariable( name='ScratchPad', description='Register to test reads and writes', offset=0x0000, bitSize=32, bitOffset=0, mode='RW', disp='{:#08x}', )) self.add( pr.RemoteVariable( name="ByPass", description='ByPass', offset=0x0004, bitSize=1, bitOffset=0, mode="RW", ))
def __init__(self,numPhyLanes=96,**kwargs): super().__init__(**kwargs) remapEnum = [[] for _ in range(128)] for i in range(128): if (i<numPhyLanes): remapEnum[i] = f'Ch{i}' else: remapEnum[i] = f'Disabled{i}' for i in range(numPhyLanes): self.add(pr.RemoteVariable( name = f'PhyToApp[{i}]', description = 'Sets the APP lane output based on PHY input index', offset = 4*(i+0), bitSize = 7, mode = 'RW', enum = dict(zip(range(128), remapEnum)), )) for i in range(numPhyLanes): self.add(pr.RemoteVariable( name = f'AppToPhy[{i}]', description = 'Sets the PHY lane output based on APP input index', offset = 4*(i+128), bitSize = 7, mode = 'RO', enum = dict(zip(range(128), remapEnum)), pollInterval = 1, hidden = True, ))
def __init__(self, **kwargs): super().__init__(**kwargs) self.add( pr.RemoteVariable(name='SuperFrameByteThreshold', offset=0x00, bitOffset=0, bitSize=32, mode='RW', base=pr.UInt, disp='{:d}')) self.add( pr.RemoteVariable(name='MaxSubFrames', offset=0x04, bitOffset=0, bitSize=16, mode='RW', base=pr.UInt, disp='{:d}')) self.add( pr.RemoteVariable(name='MaxClkGap', offset=0x08, bitOffset=0, bitSize=32, mode='RW', base=pr.UInt, disp='{:d}'))
def __init__( self, name = "XpmInhConfig", description = "XPM Inhibit configuration", **kwargs): super().__init__(name=name, description=description, **kwargs) self.add(pr.RemoteVariable( name = "intv", description = "Interval in 929kHz clks", offset = 0x00, bitSize = 12, bitOffset = 0x00, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "maxAcc", description = "Maximum accepts within interval", offset = 0x01, bitSize = 4, bitOffset = 0x04, base = pr.UInt, mode = "RW", )) self.add(pr.RemoteVariable( name = "inhEn", description = "Enable inhibit", offset = 0x03, bitSize = 1, bitOffset = 0x07, base = pr.UInt, mode = "RW", ))
def __init__(self, name="FrameSubtractor", description="Frame Subtractor", **kwargs): super().__init__(name=name, description=description, **kwargs) self.add( pr.RemoteVariable( name='ScratchPad', description='Register to test reads and writes', offset=0x0000, bitSize=32, bitOffset=0, mode='RW', disp='{:#08x}', )) self.add( pr.RemoteVariable( name="SubtractionActive", description='0 or 1', offset=0x0004, bitSize=32, bitOffset=0, mode="RW", ))
def __init__(self, **kwargs): super().__init__(**kwargs) self.add( pr.RemoteVariable( name='Config', description='ENUM Test Field', offset=0x0, bitSize=4, bitOffset=0, mode='RW', enum={ 0: 'Config2', # 0 maps to 2 1: 'Config1', # 1 maps to 1 2: 'Config0', # 2 maps to 0 }, )) self.add( pr.RemoteVariable( name='Status', description='ENUM Test Field', offset=0x4, bitSize=4, bitOffset=0, mode='RO', value=3, # Testing undef enum enum={ 0: 'Status0', 1: 'Status1', 2: 'Status2', }, ))
def __init__(self, name='MyAxiVersion', description='AXI-Lite Version Module', numUserConstants=0, **kwargs): super().__init__(name=name, description=description, **kwargs) self.add( pr.RemoteVariable( name="MacAddress", description="MacAddress (big-Endian configuration)", offset=0x400, bitSize=48, mode="RO", hidden=True, )) self.add( pr.LinkVariable( name="MAC_ADDRESS", description="MacAddress (human readable)", mode='RO', linkedGet=udp.getMacValue, dependencies=[self.variables["MacAddress"]], )) self.add( pr.RemoteVariable( name="Efuse", offset=0x408, bitSize=32, mode="RO", hidden=True, ))
def __init__(self,modeConfig='RW',**kwargs): super().__init__(**kwargs) for i in range(int(256/4)): for j in range(4): # 4 bytes all in the same 32-bit address alignment across multiple 32-bit word boundaries value = 4*i+j self.add(pr.RemoteVariable( name = f'TestBlockBytes[{value}]', offset = 0x000+4*i, bitSize = 8, bitOffset = 8*j, mode = modeConfig, value = None if modeConfig=='RW' else value, )) for i in range(256): # Sweeping across a non-byte remote variable with overlapping 32-bit address alignments # with same offsets for all variables (sometimes ASIC designers do this registers definition) self.add(pr.RemoteVariable( name = f'TestBlockBits[{i}]', offset = 0x100, bitSize = 9, bitOffset = 9*i, mode = modeConfig, value = None if modeConfig=='RW' else i, ))
def __init__(self, name="UdpEngineServer", description="UdpEngineServer", **kwargs): super().__init__(name=name, description=description, **kwargs) ############################## # Variables ############################## self.add( pr.RemoteVariable( name="ServerRemotePort", description="ServerRemotePort (big-Endian configuration)", offset=0x00, bitSize=16, bitOffset=0x00, base=pr.UInt, mode="RO", )) self.add( pr.RemoteVariable( name="ServerRemoteIp", description="ServerRemoteIp (big-Endian configuration)", offset=0x04, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", ))
def __init__(self, **kwargs): super().__init__(**kwargs) for i in range(8): self.add( pr.RemoteVariable( name=f'PartitionDelay[{i}]', offset=i * 4, bitSize=7, mode='RO', disp='{:d}', pollInterval=1, )) self.add( pr.RemoteVariable( name='TxId', offset=0x20, bitSize=32, mode='RW', pollInterval=1, )) self.add( pr.RemoteVariable( name='RxId', offset=0x24, bitSize=32, mode='RO', pollInterval=1, ))
def __init__(self, name='AccelTop', description='Spatial Top Module SW', **kwargs): super().__init__(name=name, description=description, **kwargs) self.add( pr.RemoteVariable( name='Enable', description='Enable signal for App', offset=0x000, bitSize=1, bitOffset=0, mode='RW', )) self.add( pr.RemoteVariable( name='Reset', description='Reset signal for App', offset=0x000, bitSize=1, bitOffset=1, mode='RW', )) self.add( pr.RemoteVariable( name='Done', description='App Done', offset=0x004, bitSize=32, bitOffset=0, mode='RO', )) ##### ArgIns self.add( pr.RemoteVariable( name='X_arg', description='argIn', offset=8, bitSize=32, bitOffset=0, mode='RW', )) ##### DRAM Ptrs: ##### ArgIOs ##### ArgOuts self.add( pr.RemoteVariable( name='Y_arg', description='argIn', offset=12, bitSize=32, bitOffset=0, mode='RO', ))
def __init__(self, **kwargs): super().__init__(**kwargs) self._queue = queue.Queue() self._pollThread = threading.Thread(target=self._pollWorker) self._pollThread.start() self.add( pr.RemoteVariable( name='Rnw', offset=0x00, bitOffset=0, bitSize=1, enum={ 0: "Write", 1: "Read", }, )) self.add( pr.RemoteVariable( name='Done', mode='RO', offset=0x04, bitOffset=0, bitSize=1, base=pr.Bool, )) self.add( pr.RemoteVariable( name='Resp', offset=0x04, bitOffset=1, bitSize=2, enum={ 0: 'OK', 1: 'EXOK', 2: 'SLVERR', 3: 'DECERR', }, )) self.add( pr.RemoteVariable( name='Addr', offset=0x08, bitOffset=0, bitSize=32, )) self.add( pr.RemoteVariable( name='Data', offset=0x0C, bitOffset=0, bitSize=32, ))
def __init__(self, name="BsasControl", description="HPS BLD Application Module", **kwargs): super().__init__(name=name, description=description, **kwargs) ############################## # Variables ############################## self.add( pr.RemoteVariable( name='Enable', description="Enable", offset=0x100, bitSize=1, bitOffset=0x00, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name='channelMask', description="Channel Mask", offset=0x104, bitSize=31, bitOffset=0x00, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name='channelSevr', description="Max severity by channel", offset=0x108, bitSize=64, bitOffset=0x00, base=pr.UInt, mode="RW", )) self.add( timing.EvrV2ChannelReg( name='acquire', description="Acquire Trigger", offset=0x400, )) self.add( timing.EvrV2ChannelReg( name='rowAdvance', description="Row Advance Trigger", offset=0x500, )) self.add( timing.EvrV2ChannelReg( name='tableReset', description="Table Reset Trigger", offset=0x600, ))
def __init__(self, name="AppCore", description="MicrowaveMux Application", numRxLanes=[0, 0], numTxLanes=[0, 0], **kwargs): super().__init__(name=name, description=description, **kwargs) ######### # Devices ######### for i in range(2): if ((numRxLanes[i] > 0) or (numTxLanes[i] > 0)): self.add( AmcMicrowaveMuxCore( name="MicrowaveMuxCore[%i]" % (i), offset=(i * 0x00100000), expand=True, )) self.add(SysgenCryo(offset=0x01000000, expand=True)) self.add(RtmCryoDet(offset=0x02000000, expand=False)) ########### # Registers ########### self.add( pr.RemoteVariable( name="DacSigTrigDelay", description="DacSig TrigDelay", offset=0x03000000, bitSize=24, bitOffset=0, base=pr.UInt, mode="RW", units="1/(307MHz)", )) self.add( pr.RemoteVariable( name="DacSigTrigArm", description="DacSig TrigArm", offset=0x03000004, bitSize=1, bitOffset=0, base=pr.UInt, mode="WO", hidden=True, )) ############################## # Commands ############################## @self.command( description="Arms for a DAC SIG Trigger to the DAQ MUX", ) def CmdDacSigTrigArm(): self.DacSigTrigArm.set(1)
def __init__(self, name="LclsTriggerPulse", description="Timing trigger pulse configuration", **kwargs): super().__init__(name=name, description=description, **kwargs) ############################## # Variables ############################## self.addRemoteVariables( name="OpCodeMask", description= "Opcode mask 256 bits to connect the pulse to any combination of opcodes", offset=0x00, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RW", number=8, stride=4, ) self.add( pr.RemoteVariable( name="PulseDelay", description="Pulse delay (Number of recovered clock cycles)", offset=0x20, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="PulseWidth", description="Pulse Width (Number of recovered clock cycles)", offset=0x24, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name="PulsePolarity", description="Pulse polarity: 0-Normal. 1-Inverted", offset=0x28, bitSize=1, bitOffset=0x00, base=pr.UInt, mode="RW", ))
def __init__(self, **kwargs): super().__init__(**kwargs) self.add( pr.RemoteVariable( name='AXIS_CLK_FREQ_G', offset=0x000, bitSize=32, mode='RO', disp='{:d}', units='Hz', )) self.add( pr.RemoteVariable( name='REFRESH_RATE_G', offset=0x004, bitSize=32, mode='RO', disp='{:d}', units='Hz', )) self.add( pr.RemoteVariable( name='DEFAULT_MAX_RATE_G', offset=0x008, bitSize=32, mode='RO', disp='{:d}', units='REFRESH_RATE_G', )) self.add( pr.RemoteVariable( name='MaxFrameRate', description= 'Sets the Frame Rate limit (in units of Units of \'REFRESH_RATE_G\'). Zero value means no limit', offset=0x100, bitSize=32, mode='RW', )) self.add( pr.RemoteVariable( name='BackpressureMode', description= '1: Assert back pressure when rate throttling, 0: Drop frames when rate throttling', offset=0x104, bitSize=1, mode='RW', ))
def __init__(self, **kwargs): super().__init__(**kwargs) self.add( pr.RemoteVariable( name='ORDER', description= 'When logic 0, the MSB of the data word is transmitted first. If logic 1, the LSB of the data word is transmitted first.', offset=(0xF0 << 2), bitSize=1, bitOffset=5, mode='WO', )) self.add( pr.RemoteVariable( name='CPOL', description= 'CPOL determines the polarity of the clock. The polarities can be converted with a simple inverter.', offset=(0xF0 << 2), bitSize=1, bitOffset=3, mode='WO', )) self.add( pr.RemoteVariable( name='CPHA', description= 'CPHA determines the timing (i.e. phase) of the data bits relative to the clock pulses. Conversion between these two forms is non-trivial.', offset=(0xF0 << 2), bitSize=1, bitOffset=2, mode='WO', )) self.add( pr.RemoteVariable( name='SpiClockRate', description='Sets the SPI clock rate', offset=(0xF0 << 2), bitSize=2, bitOffset=0, mode='WO', enum={ 0: "1843kHz", 1: "461kHz", 2: "115kHz", 3: "58kHz", }, ))
def __init__(self, name="SeqState", description="Sequence Engine State", **kwargs): super().__init__(name=name, description=description, **kwargs) self.add( pr.RemoteVariable( name="cntReq", description="Request counts", offset=0x00, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", )) self.add( pr.RemoteVariable( name="cntInv", description="Invalid counts", offset=0x04, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", )) self.add( pr.RemoteVariable( name="currAddr", description="Current address", offset=0x08, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", )) self.addRemoteVariables( name="cntCond", description="Current conditional count", offset=0x0c, bitSize=8, bitOffset=0x00, stride=1, base=pr.UInt, mode="RO", number=4, hidden=False, )
def __init__(self, expand=False, offset=0x0, **kwargs): super().__init__( expand=expand, offset=0x0, # This module assume offset 0x0 **kwargs) self.add(axi.AxiVersion( offset=AXIL_OFFSETS[7], expand=False, )) self.add(xilinx.Xadc( offset=AXIL_OFFSETS[8], expand=False, )) self.add( micron.AxiMicronN25Q( offset=AXIL_OFFSETS[9], addrMode=False, # Assume 24-bit address support only hidden=True, )) self.add( pr.RemoteVariable( name='LSST_PWR_CORE_VERSION_C', description='See LsstPwrCtrlPkg.vhd for definitions', offset=AXIL_OFFSETS[7] + 0x400, # 0x1C0400 base=pr.UInt, mode='RO', )) self.add( pr.RemoteVariable( name='BOARD_ID', description='eFuse[7:0] value', offset=AXIL_OFFSETS[7] + 0x404, # 0x1C0404 base=pr.UInt, bitSize=8, mode='RO', )) self.add( pr.RemoteVariable( name='NUM_LANE_G', description='Number of Ethernet lanes', offset=AXIL_OFFSETS[7] + 0x408, # 0x1C0408 base=pr.UInt, mode='RO', ))
def __init__(self, name="UdpEngineServer", description="UdpEngineServer", **kwargs): super().__init__(name=name, description=description, **kwargs) ############################## # Variables ############################## self.add( pr.RemoteVariable( name="ServerRemotePort", description="ServerRemotePort (big-Endian configuration)", offset=0x00, bitSize=16, bitOffset=0x00, base=pr.UInt, mode="RO", hidden=True, )) self.add( pr.LinkVariable( name="ServerRemotePortValue", description="ServerRemotePort (human readable)", mode='RO', linkedGet=udp.getPortValue, dependencies=[self.variables["ServerRemotePort"]], )) self.add( pr.RemoteVariable( name="ServerRemoteIp", description="ServerRemoteIp (big-Endian configuration)", offset=0x04, bitSize=32, bitOffset=0x00, base=pr.UInt, mode="RO", hidden=True, )) self.add( pr.LinkVariable( name="ServerRemoteIpValue", description="ServerRemoteIp (human readable)", mode='RO', linkedGet=udp.getIpValue, dependencies=[self.variables["ServerRemoteIp"]], ))
def __init__(self, name="BldEdef", description="HPS BLD Application Module", numEdefs=4, **kwargs): super().__init__(name=name, description=description, **kwargs) ############################## # Variables ############################## self.add( pr.RemoteVariable( name='rateSel', description="Rate select", offset=0x0, bitSize=13, bitOffset=0x00, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name='destSel', description="Destn select", offset=0x0, bitSize=19, bitOffset=0x0d, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name='tsUpdate', description="Timestamp bit update", offset=0x4, bitSize=5, bitOffset=0x0, base=pr.UInt, mode="RW", )) self.add( pr.RemoteVariable( name='Enable', description="Enable", offset=0x4, bitSize=1, bitOffset=0x1f, base=pr.UInt, mode="RW", ))
def __init__(self, name="AmcCryoCtrl", description="Debugging module", **kwargs): super().__init__(name=name, description=description, **kwargs) self.add( pr.RemoteVariable( name="txSyncRaw", description="txSyncRaw", offset=0x7F0, bitSize=2, bitOffset=0, base=pr.UInt, mode="RO", )) self.add( pr.RemoteVariable( name="txSync", description="txSync", offset=0x7F4, bitSize=2, bitOffset=0, base=pr.UInt, mode="RO", )) self.add( pr.RemoteVariable( name="rxSync", description="rxSync", offset=0x7F8, bitSize=1, bitOffset=0, base=pr.UInt, mode="RO", )) self.add( pr.RemoteVariable( name="txSyncMask", description="txSyncMask", offset=0x800, bitSize=2, bitOffset=0, base=pr.UInt, mode="RW", ))
def __init__(self, name="Memory", nelms=0x1000, mode="RO", description="Generic Memory", hidden=True, **kwargs): super().__init__(name=name, description=description, hidden=hidden, **kwargs) self.nelms = nelms for i in range(nelms): # Cryo channel ETA self.add( pr.RemoteVariable( name=f'Mem[{i}]', hidden=True, description="ETA mag Fix_16_10", offset=0x000000 + i * 4, bitSize=32, bitOffset=0, base=pr.UInt, mode=mode, )) @self.command() def read(): with self.root.updateGroups(): for i in range(self.nelms): self.node(f'Mem[{i}]').get()
def __init__(self, name="MpsSfpAmc", description="SFP Diagnostics Module", **kwargs): super().__init__(name=name, description=description, **kwargs) self.add( xpm.SfpSummary( # memBase = self.srp, name='SfpSummary', description='PCA9506', offset=0, )) self.add( pr.RemoteVariable( name='I2cMux', description='PCA9547 I2C Mux Control', offset=0x400, bitSize=8, bitOffset=0, base=pr.UInt, mode="RW", )) self.add( xpm.SfpI2c( # memBase = self.srp, name='SfpI2c', offset=0x800, ))
def addPair( name, offset, bitSize, units, bitOffset, description, function, pollInterval=0, ): self.add( pr.RemoteVariable( name=("Raw" + name), offset=offset, bitSize=bitSize, bitOffset=bitOffset, mode='RO', description=description, pollInterval=pollInterval, hidden=True, )) self.add( pr.LinkVariable( name=name, mode='RO', units=units, linkedGet=function, typeStr="Float32", dependencies=[self.variables["Raw" + name]], ))
def addErrorCountVar(**ecvkwargs): self.add( pr.RemoteVariable(bitSize=errorCountBits, mode='RO', disp='{:d}', pollInterval=1, **ecvkwargs))
def addPair( name, offset, bitSize, units, bitOffset, description, function, pollInterval=0, ): self.add( pr.RemoteVariable( name=(name + "Raw"), offset=offset, bitSize=bitSize, bitOffset=bitOffset, base=pr.UInt, mode='RO', description=description, pollInterval=pollInterval, hidden=True, )) self.add( pr.LinkVariable( name=name, mode='RO', units=units, linkedGet=function, dependencies=[self.variables[name + "Raw"]], ))
def addBoolPair(tap): self.add( pr.RemoteVariable( name=f'RawTap[{tap}]', description=f'Tap[{tap}] Fixed Point Coefficient', offset=4 * tap, bitSize=dataWordBitSize, base=pr.Int, mode='RW', hidden=True, )) var = self.variables[f'RawTap[{tap}]'] self.add( pr.LinkVariable( name=f'Tap[{tap}]', description=f'Tap[{tap}] Floating Point Coefficient', mode='RW', linkedGet=lambda: var.value() / 2**dataWordBitSize, linkedSet=lambda value, write: var.set( int(value * 2**dataWordBitSize)), dependencies=[var], disp='{:1.3f}', ))
def __init__(self, name="Dac", description="Container for AD5662 SPI modules", **kwargs): super().__init__(name=name, description=description, **kwargs) self.add( pr.RemoteVariable( name='RawValue', description='16-bit DAC Value', offset=0x0, bitSize=16, mode='WO', units='1.024V/2^16', )) self.add( pr.LinkVariable( name='FloatValue', mode='RW', units='V', disp='{:1.3f}', linkedGet=self.getVoltage, linkedSet=self.setVoltage, dependencies=[self.variables['RawValue']], ))