def testSyndriverRams(self): # syndriver switch row pattern1 = [HICANN.SynapseSwitchRow() for ii in range(224)] pattern2 = [HICANN.SynapseSwitchRow() for ii in range(224)] d = [True] + [False] * 15 for i in range(0, 224): pattern1[i][:] = d[-i % len(d):] + d[:-i % len(d)] side = Coordinate.left row = Coordinate.SynapseSwitchRowOnHICANN(Coordinate.Y(i), side) HICANN.set_syndriver_switch_row(self.h, row, pattern1[i]) pattern2[i] = HICANN.get_syndriver_switch_row(self.h, row) self.assertEqual(pattern1, pattern2)
def L1TransmissionTest(self, block): #period between events used in testing below period = 150 #set PLL frequency #HICANN.set_PLL_frequency(self.h, 100) #configure DNC mergers mergers = HICANN.DNCMergerLine() for i in range(8): mer = Coordinate.DNCMergerOnHICANN(i) mergers[mer].config = HICANN.Merger.RIGHT_ONLY mergers[mer].slow = True mergers[mer].loopback = False HICANN.set_dnc_merger(self.h, mergers) #configure merger tree, phase tree = HICANN.MergerTree() #default settings are OK phase = HICANN.phase_t(0) HICANN.set_merger_tree(self.h, tree) HICANN.set_phase(self.h, phase) #configure background generator bgarray = HICANN.BackgroundGeneratorArray() for i in range(8): bgarray[i].enable(True) bgarray[i].random(False) bgarray[i].seed(200) bgarray[i].period(period) bgarray[i].address(HICANN.L1Address(0)) HICANN.set_background_generator(self.h, bgarray) #configure sending repeaters rep = Coordinate.RepeaterBlockOnHICANN(Coordinate.X(0), Coordinate.Y(1)) HICANN.set_repeater_block(self.h, rep, HICANN.RepeaterBlock()) sr = HICANN.HorizontalRepeater() sr.setOutput(Coordinate.right) for i in range(8): HICANN.set_repeater(self.h, Coordinate.HLineOnHICANN(6 + 8 * i).repeater(), sr) #configure crossbars and synapse switches cb = HICANN.Crossbar() ss = HICANN.SynapseSwitch() row_cfg = HICANN.CrossbarRow() syn_row_cfg = HICANN.SynapseSwitchRow() for i in range(8): if block.x().value() == 0 and block.y().value() == 2: cb.set(Coordinate.VLineOnHICANN(28 - 4 * i), Coordinate.HLineOnHICANN(6 + 8 * i), True) row_cfg = cb.get_row(Coordinate.HLineOnHICANN(6 + 8 * i), Coordinate.left) HICANN.set_crossbar_switch_row( self.h, Coordinate.HLineOnHICANN(6 + 8 * i), Coordinate.left, row_cfg) elif block.x().value() == 1 and block.y().value() == 2: cb.set(Coordinate.VLineOnHICANN(227 + 4 * i), Coordinate.HLineOnHICANN(6 + 8 * i), True) row_cfg = cb.get_row(Coordinate.HLineOnHICANN(6 + 8 * i), Coordinate.right) HICANN.set_crossbar_switch_row( self.h, Coordinate.HLineOnHICANN(6 + 8 * i), Coordinate.right, row_cfg) elif block.x().value() == 0 and block.y().value() == 0: addr = Coordinate.SynapseSwitchRowOnHICANN( Coordinate.Y(15 - 2 * i), Coordinate.left) cb.set(Coordinate.VLineOnHICANN(28 - 4 * i), Coordinate.HLineOnHICANN(6 + 8 * i), True) ss.set(Coordinate.VLineOnHICANN(28 - 4 * i), addr.line(), True) #connecting two parallel vertical lanes ss.set(Coordinate.VLineOnHICANN(29 - 4 * i), addr.line(), True) row_cfg = cb.get_row(Coordinate.HLineOnHICANN(6 + 8 * i), Coordinate.left) HICANN.set_crossbar_switch_row( self.h, Coordinate.HLineOnHICANN(6 + 8 * i), Coordinate.left, row_cfg) syn_row_cfg = ss.get_row(addr) HICANN.set_syndriver_switch_row(self.h, addr, syn_row_cfg) elif block.x().value() == 1 and block.y().value() == 0: addr = Coordinate.SynapseSwitchRowOnHICANN( Coordinate.Y(15 - 2 * i), Coordinate.right) cb.set(Coordinate.VLineOnHICANN(227 + 4 * i), Coordinate.HLineOnHICANN(6 + 8 * i), True) ss.set(Coordinate.VLineOnHICANN(227 + 4 * i), addr.line(), True) #connecting two parallel vertical lanes ss.set(Coordinate.VLineOnHICANN(226 + 4 * i), addr.line(), True) row_cfg = cb.get_row(Coordinate.HLineOnHICANN(6 + 8 * i), Coordinate.right) HICANN.set_crossbar_switch_row( self.h, Coordinate.HLineOnHICANN(6 + 8 * i), Coordinate.right, row_cfg) syn_row_cfg = ss.get_row(addr) HICANN.set_syndriver_switch_row(self.h, addr, syn_row_cfg) elif block.x().value() == 1 and block.y().value() == 1: cb.set(Coordinate.VLineOnHICANN(28 - 4 * i), Coordinate.HLineOnHICANN(6 + 8 * i), True) cb.set(Coordinate.VLineOnHICANN(28 - 4 * i), Coordinate.HLineOnHICANN(7 + 8 * i), True) row_cfg = cb.get_row(Coordinate.HLineOnHICANN(6 + 8 * i), Coordinate.left) HICANN.set_crossbar_switch_row( self.h, Coordinate.HLineOnHICANN(6 + 8 * i), Coordinate.left, row_cfg) row_cfg = cb.get_row(Coordinate.HLineOnHICANN(7 + 8 * i), Coordinate.left) HICANN.set_crossbar_switch_row( self.h, Coordinate.HLineOnHICANN(7 + 8 * i), Coordinate.left, row_cfg) #readout-routine vr = HICANN.VerticalRepeater() rb = HICANN.RepeaterBlock() startrep = 0 #starting readout-repeater registertype = HICANN.RepeaterBlock.EVEN #which readout-circuit is responsible dir = Coordinate.top #transmit-direction if block.x().value() == 0 and block.y().value() == 2: startrep = 0 registertype = HICANN.RepeaterBlock.EVEN dir = Coordinate.bottom elif block.x().value() == 1 and block.y().value() == 2: startrep = 227 registertype = HICANN.RepeaterBlock.EVEN dir = Coordinate.bottom elif block.x().value() == 0 and block.y().value() == 0: startrep = 1 registertype = HICANN.RepeaterBlock.ODD dir = Coordinate.top elif block.x().value() == 1 and block.y().value() == 0: startrep = 226 registertype = HICANN.RepeaterBlock.ODD dir = Coordinate.top success_counter = 0 # unfortunately center right readout routine is too different... if not (block.x().value() == 1 and block.y().value() == 1): for i in range(startrep, startrep + 32, 4): #configure receiving repeater vr.setInput(dir) HICANN.set_repeater(self.h, Coordinate.VLineOnHICANN(i).repeater(), vr) HICANN.flush(self.h) t.sleep(0.0005) #time for the dll to lock #configure receiving repeater block rb.start_tdi[registertype] = False #reset the full flag HICANN.set_repeater_block(self.h, block, rb) rb.start_tdi[ registertype] = True #start recording received data HICANN.set_repeater_block(self.h, block, rb) HICANN.flush(self.h) t.sleep(0.001) #recording lasts for ca. 4 us - 1 ms rb = HICANN.get_repeater_block(self.h, block) test = rb.tdi_data[registertype] for x in range( 2 ): #see how many events come with correct delay (+/- 2) if ((abs(abs(test[x + 1].time - test[x].time) - period)) < 3): success_counter += 1 #~ print "From repeater " + str(i) + " received: " #~ if rb.full_flag[registertype]: #~ print "Full flag is set" #~ else: #~ print "Full flag is NOT set" #~ print "Neuron number " + str(test[0].address) + " at time " + str(test[0].time) #~ print "Neuron number " + str(test[1].address) + " at time " + str(test[1].time) #~ print "Neuron number " + str(test[2].address) + " at time " + str(test[2].time) + "\n" rb.start_tdi[ registertype] = False #reset the full flag TWO (!) times HICANN.set_repeater_block(self.h, block, rb) HICANN.set_repeater_block(self.h, block, rb) #set repeater mode to IDLE to prevent conflicts vr.setIdle() HICANN.set_repeater(self.h, Coordinate.VLineOnHICANN(i).repeater(), vr) else: hr = HICANN.HorizontalRepeater() for i in range(7, 64, 8): #configure receiving repeater hr.setInput(Coordinate.right) HICANN.set_repeater(self.h, Coordinate.HLineOnHICANN(i).repeater(), hr) HICANN.flush(self.h) t.sleep(0.0005) #time for the dll to lock #configure receiving repeater block rb.start_tdi[ HICANN.RepeaterBlock.EVEN] = False #reset the full flag HICANN.set_repeater_block(self.h, block, rb) rb.start_tdi[HICANN.RepeaterBlock. EVEN] = True #start recording received data HICANN.set_repeater_block(self.h, block, rb) HICANN.flush(self.h) t.sleep(0.0001) #recording lasts for ca. 4 us - 1 ms rb = HICANN.get_repeater_block(self.h, block) test = rb.tdi_data[HICANN.RepeaterBlock.EVEN] #~ print "From repeater " + str(i) + " received: " #~ if rb.full_flag[registertype]: #~ print "Full flag is set" #~ else: #~ print "Full flag is NOT set" #~ print "Neuron number " + str(test[0].address) + " at time " + str(test[0].time) #~ print "Neuron number " + str(test[1].address) + " at time " + str(test[1].time) #~ print "Neuron number " + str(test[2].address) + " at time " + str(test[2].time) + "\n" for x in range( 2): #see how many events come with correct delay if ((abs(abs(test[x + 1].time - test[x].time) - period)) < 3): success_counter += 1 rb.start_tdi[HICANN.RepeaterBlock. EVEN] = False #reset the full flag TWO (!) times HICANN.set_repeater_block(self.h, block, rb) HICANN.set_repeater_block(self.h, block, rb) #set repeater mode to IDLE to prevent conflicts hr.setIdle() HICANN.set_repeater(self.h, Coordinate.HLineOnHICANN(i).repeater(), hr) HICANN.flush(self.h) return success_counter
def test_HICANNL1CenterRightRepeaterHWTest(self): count = self.L1TransmissionTest( Coordinate.RepeaterBlockOnHICANN(Coordinate.X(1), Coordinate.Y(1))) self.assertGreater( count, 3) #3 or more events with correct delay (out of 16) are enough
# Configure DNC mergers.: for merger in iter_all(Coordinate.DNCMergerOnHICANN): hicann.layer1[merger].slow = True # Needed for sending repeaters # Configure sending repeater to forward spikes to the right h_line = Coordinate.HLineOnHICANN(62) sending_repeater = hicann.repeater[Coordinate.HRepeaterOnHICANN(h_line, Coordinate.left)] sending_repeater.setOutput(Coordinate.right, True) # Enable a crossbar switch to route the signal into the first vertical line v_line_c = Coordinate.VLineOnHICANN(0) hicann.crossbar_switches.set(v_line_c, h_line, True) # Configure synapse switches and forward to synapse switch row 81 driver_line_c = Coordinate.SynapseSwitchRowOnHICANN(Coordinate.Y(81), Coordinate.left) hicann.synapse_switches.set(v_line_c, driver_line_c.line(), True) # Configure synapse driver driver = hicann.synapses[Coordinate.SynapseDriverOnHICANN(driver_line_c)] driver.set_l1() # Set to process spikes from L1 driver[Coordinate.top].set_gmax_div(Coordinate.left, 11) # Set 'base' weight driver[Coordinate.top].set_gmax_div(Coordinate.right, 11) driver[Coordinate.top].set_syn_in(Coordinate.left, 1) # Forward to left neuron input driver[Coordinate.top].set_syn_in(Coordinate.right, 0) # … and do not to the right one! driver[Coordinate.top].set_gmax(0) # Select floating gate value (4 different different strenghts available/analog values) driver[Coordinate.bottom] = driver[Coordinate.top] # Copy settings from top row to bottom one