Nosys_commands = Nosys_commands + 1 for i in range(0, Nosys_commands): p = i * len_ichunk * 16 if count > len_dchunk: new_count = len_dchunk count = count - len_dchunk else: new_count = count print("new_count1: ", new_count) new_count = gf.int_to_bin(new_count, gf.SC_len - gf.IADDR_BITS - 9) #How many words to load print("new_count2: ", new_count) start_add = gf.hydra_Iaddr(i * len_ichunk) row = gf.int_to_bin(start_add[0], gf.IADDR_BITS) strip = gf.int_to_bin(start_add[1], 3) tile = gf.int_to_bin(start_add[2], 3) start = row + strip + tile command = new_count + start + cmd commandH = gf.bin_to_hex(command) commandH = gf.formatH_for_roach(commandH) LIprogram = LIprogram + commandH + string[p:p + ( len_ichunk * 16)] + ZERO_WORD_RH + ZERO_WORD_RH else: #If it happens to fit within one packet executing the following is quicker start = gf.int_to_bin( 0, gf.IADDR_BITS + 6) #address = IADDR_BITS+3bits for strip+3bits for tile
if count%len_ichunk >0: Nosys_commands = Nosys_commands+1 for i in range (0,Nosys_commands): p=i*len_ichunk*16 if count>len_dchunk: new_count = len_dchunk count = count-len_dchunk else: new_count = count print ("new_count1: ", new_count) new_count= gf.int_to_bin(new_count,gf.SC_len-gf.IADDR_BITS-9)#How many words to load print ("new_count2: ", new_count) start_add = gf.hydra_Iaddr(i*len_ichunk) row= gf.int_to_bin(start_add[0],gf.IADDR_BITS) strip= gf.int_to_bin(start_add[1],3) tile= gf.int_to_bin(start_add[2],3) start=row+strip+tile command=new_count+start+cmd commandH = gf.bin_to_hex(command) commandH = gf.formatH_for_roach(commandH) LIprogram=LIprogram+commandH+string[p:p+(len_ichunk*16)]+ZERO_WORD_RH+ZERO_WORD_RH else: #If it happens to fit within one packet executing the following is quicker start= gf.int_to_bin(0,gf.IADDR_BITS+6) #address = IADDR_BITS+3bits for strip+3bits for tile count= gf.int_to_bin(count,gf.SC_len-gf.IADDR_BITS-9) #How many words to load: goes into as many bits are left after the start address and the 3bits for setting the commadn type(LI in this case) hence 9 command=count+start+cmd commandH = gf.bin_to_hex(command)