def updateMasterPopulationTable(self, spec, blockStartAddr, rowIndex, key, MASTER_POP_TABLE): """ Writes an entry in the Master Population Table for the newly created synaptic block. An entry in the table is a 16-bit value, with the following structure: Bits [2:0] Row length information. This value (from 0->7) indicates the maximum number of synapses in this block. It is translated in the row length translation table by the executing code each time the table is accessed, to calculate offsets. Bits [15:3] Address within the synaptic matrix region of the start of the block. This is 1K bytes aligned, so the true value is found by shifting left by 7 bits then adding the start address of the memory region. """ # Which core has this projection arrived from? x = packet_conversions.get_x_from_key(key) y = packet_conversions.get_y_from_key(key) # the plus one in p calc is due to the router table subtracting one off # its routing key for p (also due to unknown reasons). As the c code # compenstates for it, we also need to p = packet_conversions.get_p_from_key(key) # Calculate the index into the master population table for # a projection from the given core: tableSlotAddr = \ packet_conversions.get_mpt_sb_mem_addrs_from_coords(x, y, p) # What is the write address in the table for this index? spec.comment("\nUpdate entry in master population table for incoming" + " connection from {}, {}, {}:\n".format(x, y, p)) # Process start address (align to 1K boundary then shift right by 10 and # left by 3 (i.e. 7) to make it the top 13-bits of the field): if (blockStartAddr & 0x3FF) != 0: raise Exception( "Synaptic Block start address is not aligned to a 1K boundary") #moves by 7 to tack on at the end the row_length information # which resides in the last 3 bits entryAddrField = blockStartAddr >> 7 # Assembly entry: newEntry = entryAddrField | rowIndex # Write entry: spec.switchWriteFocus(region = MASTER_POP_TABLE) spec.setWritePtr(data = tableSlotAddr) spec.write(data = newEntry, sizeof = 'uint16') return
def updateMasterPopulationTable(self, spec, blockStartAddr, rowIndex, key, MASTER_POP_TABLE): """ Writes an entry in the Master Population Table for the newly created synaptic block. An entry in the table is a 16-bit value, with the following structure: Bits [2:0] Row length information. This value (from 0->7) indicates the maximum number of synapses in this block. It is translated in the row length translation table by the executing code each time the table is accessed, to calculate offsets. Bits [15:3] Address within the synaptic matrix region of the start of the block. This is 1K bytes aligned, so the true value is found by shifting left by 7 bits then adding the start address of the memory region. """ # Which core has this projection arrived from? x = packet_conversions.get_x_from_key(key) y = packet_conversions.get_y_from_key(key) # the plus one in p calc is due to the router table subtracting one off # its routing key for p (also due to unknown reasons). As the c code # compenstates for it, we also need to p = packet_conversions.get_p_from_key(key) # Calculate the index into the master population table for # a projection from the given core: tableSlotAddr = \ packet_conversions.get_mpt_sb_mem_addrs_from_coords(x, y, p) # What is the write address in the table for this index? spec.comment("\nUpdate entry in master population table for incoming" + " connection from {}, {}, {}:\n".format(x, y, p)) # Process start address (align to 1K boundary then shift right by 10 and # left by 3 (i.e. 7) to make it the top 13-bits of the field): if (blockStartAddr & 0x3FF) != 0: raise Exception( "Synaptic Block start address is not aligned to a 1K boundary") #moves by 7 to tack on at the end the row_length information # which resides in the last 3 bits entryAddrField = blockStartAddr >> 7 # Assembly entry: newEntry = entryAddrField | rowIndex # Write entry: spec.switchWriteFocus(region=MASTER_POP_TABLE) spec.setWritePtr(data=tableSlotAddr) spec.write(data=newEntry, sizeof='uint16') return