def __init__(self): CircuitSimulator.__init__(self) self.loadCircuit(params.chip6502File) # No need to update the names based on params.mos6502WireInit. # The names have already been saved in the net_6502.pkl file. # This is provided as an example of how to update a chip's # wires with your own string names. #self.updateWireNames(params.mos6502WireInit) # Store indices into the wireList. This saves having # to look up the wires by their string name from the # wireNames dict. self.addressBusPads = [] for padName in params.cpuAddressBusPadNames: wireIndex = self.getWireIndex(padName) self.addressBusPads.append(wireIndex) self.dataBusPads = [] for padName in params.dataBusPadNames: wireIndex = self.getWireIndex(padName) self.dataBusPads.append(wireIndex) self.padIndRW = self.getWireIndex('R/W') self.padIndCLK0 = self.getWireIndex('CLK0') self.padIndRDY = self.getWireIndex('RDY') self.padIndCLK1Out = self.getWireIndex('CLK1OUT') self.padIndSYNC = self.getWireIndex('SYNC') self.padReset = self.getWireIndex('RES')
def __init__(self): CircuitSimulatorLists.__init__(self) self.loadCircuit(params.chipTIAFile) self.colLumToRGB8LUT = [] # For debugging or inspecting, this can be used to hold # the last values written to our write-only control addresses. self.lastControlValue = array('B', [0] * (0x2C + 1)) self.initColLumLUT() # Temporarily inhibit TIA from driving DB6 and DB7 self.setHighWN('CS3') self.setHighWN('CS0') self.clocksForResetLow = 8 self.recalcAllWires() # The pads of each chip in the chip simulations can be # accessed by their name, like 'RDY' or 'CLK0', or by # their wire index. Accessing by wire index is faster # so we cache indices here for certain named wires. self.addressBusPads = [] for padName in params.tiaAddressBusPadNames: wireIndex = self.getWireIndex(padName) self.addressBusPads.append(wireIndex) self.dataBusPads = [] for padName in params.dataBusPadNames: wireIndex = self.getWireIndex(padName) self.dataBusPads.append(wireIndex) self.dataBusDrivers = [] for padName in params.tiaDataBusDrivers: wireIndex = self.getWireIndex(padName) self.dataBusDrivers.append(wireIndex) self.inputPads = [] for padName in params.tiaInputPadNames: wireIndex = self.getWireIndex(padName) self.inputPads.append(wireIndex) self.indDB6_drvLo = self.getWireIndex('DB6_drvLo') self.indDB6_drvHi = self.getWireIndex('DB6_drvHi') self.indDB7_drvLo = self.getWireIndex('DB7_drvLo') self.indDB7_drvHi = self.getWireIndex('DB7_drvHi') self.padIndCLK0 = self.getWireIndex('CLK0') self.padIndCLK2 = self.getWireIndex('CLK2') self.padIndPH0 = self.getWireIndex('PH0') self.padIndCS0 = self.getWireIndex('CS0') self.padIndCS3 = self.getWireIndex('CS3') self.padIndsCS0CS3 = [self.padIndCS0, self.padIndCS3] self.padIndRW = self.getWireIndex('R/W') self.padIndDEL = self.getWireIndex('del') # The TIA's RDY_low wire is high when it's pulling the # 6502's RDY to ground. RDY_lowCtrl controls RDY_low self.indRDY_lowCtrl = self.getWireIndex('RDY_lowCtrl') self.vblank = self.getWireIndex('VBLANK') self.vsync = self.getWireIndex('VSYNC') self.wsync = self.getWireIndex('WSYNC') self.rsync = self.getWireIndex('RSYNC') # Wires that govern the output pixel's luminance and color self.L0_lowCtrl = self.getWireIndex('L0_lowCtrl') self.L1_lowCtrl = self.getWireIndex('L1_lowCtrl') self.L2_lowCtrl = self.getWireIndex('L2_lowCtrl') self.colcnt_t0 = self.getWireIndex('COLCNT_T0') self.colcnt_t1 = self.getWireIndex('COLCNT_T1') self.colcnt_t2 = self.getWireIndex('COLCNT_T2') self.colcnt_t3 = self.getWireIndex('COLCNT_T3')
def __init__(self): CircuitSimulator.__init__(self) self.loadCircuit(params.chipTIAFile) self.colLumToRGB8LUT = [] # For debugging or inspecting, this can be used to hold # the last values written to our write-only control addresses. self.lastControlValue = array('B', [0] * (0x2C + 1)) self.initColLumLUT() # Temporarily inhibit TIA from driving DB6 and DB7 self.setHighWN('CS3') self.setHighWN('CS0') self.clocksForResetLow = 8 self.recalcAllWires() # The pads of each chip in the chip simulations can be # accessed by their name, like 'RDY' or 'CLK0', or by # their wire index. Accessing by wire index is faster # so we cache indices here for certain named wires. self.addressBusPads = [] for padName in params.tiaAddressBusPadNames: wireIndex = self.getWireIndex(padName) self.addressBusPads.append(wireIndex) self.dataBusPads = [] for padName in params.dataBusPadNames: wireIndex = self.getWireIndex(padName) self.dataBusPads.append(wireIndex) self.dataBusDrivers = [] for padName in params.tiaDataBusDrivers: wireIndex = self.getWireIndex(padName) self.dataBusDrivers.append(wireIndex) self.inputPads = [] for padName in params.tiaInputPadNames: wireIndex = self.getWireIndex(padName) self.inputPads.append(wireIndex) self.indDB6_drvLo = self.getWireIndex('DB6_drvLo') self.indDB6_drvHi = self.getWireIndex('DB6_drvHi') self.indDB7_drvLo = self.getWireIndex('DB7_drvLo') self.indDB7_drvHi = self.getWireIndex('DB7_drvHi') self.padIndCLK0 = self.getWireIndex('CLK0') self.padIndCLK2 = self.getWireIndex('CLK2') self.padIndPH0 = self.getWireIndex('PH0') self.padIndCS0 = self.getWireIndex('CS0') self.padIndCS3 = self.getWireIndex('CS3') self.padIndsCS0CS3 = [self.padIndCS0, self.padIndCS3] self.padIndRW = self.getWireIndex('R/W') self.padIndDEL = self.getWireIndex('del') # The TIA's RDY_low wire is high when it's pulling the # 6502's RDY to ground. RDY_lowCtrl controls RDY_low self.indRDY_lowCtrl = self.getWireIndex('RDY_lowCtrl') self.vblank = self.getWireIndex('VBLANK') self.vsync = self.getWireIndex('VSYNC') self.wsync = self.getWireIndex('WSYNC') self.rsync = self.getWireIndex('RSYNC') # Wires that govern the output pixel's luminance and color self.L0_lowCtrl = self.getWireIndex('L0_lowCtrl') self.L1_lowCtrl = self.getWireIndex('L1_lowCtrl') self.L2_lowCtrl = self.getWireIndex('L2_lowCtrl') self.colcnt_t0 = self.getWireIndex('COLCNT_T0') self.colcnt_t1 = self.getWireIndex('COLCNT_T1') self.colcnt_t2 = self.getWireIndex('COLCNT_T2') self.colcnt_t3 = self.getWireIndex('COLCNT_T3')