#Generate instruction
            opcode = sub
            addr0 = gf.int_to_bin(r, gf.DADDR_BITS)  #Operand0
            addr1 = gf.int_to_bin(r + (gf.DROWS / 2), gf.DADDR_BITS)  #Operand1
            addr2 = gf.int_to_bin(r + (gf.DROWS / 2),
                                  gf.DADDR_BITS)  #Secondary address
            sel0 = gf.int_to_bin(
                s, 3)  #set sel's to the strip currently being written
            sel1 = gf.int_to_bin(s, 3)
            selq = gf.int_to_bin(
                t, 3)  #Set the selq to the tile currently being written

            i_word = addr2 + selq + opcode + sel1 + sel0 + addr1 + addr0  #Complete instruction in binary
            i_wordH = gf.bin_to_hex(i_word)  #Complete instruction in hex
            i_wordH = gf.formatH_for_roach(
                i_wordH
            )  #Insert '\x' marks to indicate hex to python transmit script

            #Format final lines to be written to files
            word = i_word + ":" + i_wordH  #Instruction line containing both the binary and roach formated instruction

            #Write instruction and data words to file
            zI[t][s].write(word + "\n")

        #Write data and answer arrays to files
        #This is done seperatly in order to write all the values sequentially despite them being generated out of order (one in the lower half of memory and one in the upper half for each instruction row)
        for i in range(0, gf.DROWS):
            zD[t][s].write(d_wordH[i] + "\n")
            zA[t][s].write(a_wordH[i] + "\n")
#Close files
gf.close_files(gf.STRIPS, gf.TILES, a[0], a[1])
예제 #2
0
				sel0_range=range(gf.STRIPS)
				for i in range(r+1):
						sel0_range=[sel0_range[-1]]+sel0_range[:-1]

				for s in range(0,gf.STRIPS):

						addr0	= gf.int_to_bin(r,gf.DADDR_BITS)				#Operand0
						addr1	= gf.int_to_bin(r,gf.DADDR_BITS)				#Operand1 (Is unused and meaningless for a copy
						addr2	= gf.int_to_bin(r,gf.DADDR_BITS)				#Specified address
						sel0	= gf.int_to_bin(sel0_range[s],3)				#Set to prearranged other strip
						sel1	= gf.int_to_bin(s,3)	#Operand1 set to local (it's meaningless)
						selq	= gf.int_to_bin(t,3)	#Set the selq to the tile currently being written    
						
						i_word = addr2+selq+opcode+sel1+sel0+addr1+addr0	#Complete instruction in binary
						i_wordH = gf.bin_to_hex(i_word) #Complete instruction in hex 
						i_wordH = gf.formatH_for_roach(i_wordH)	#Insert buffer zeros
						i_wordH = "Address %d:" %(r) + i_wordH 
						zI[t][s].write(i_wordH+"\n")
						
##Create a single row nop accross the whole system to give the data memory offset needed to save the inter-tile copied data
r= NO_inter_strip
opcode=nop
for t in range(0,gf.TILES):
		for s in range(0,gf.STRIPS):
				#Zero written to the data rows
				varFP=fp.custom_floating_point_creator (0,gf.D_wf,gf.D_we)
				varH =gf.bin_to_hex_l(varFP,64)
				d_wordH = "Address %d:" %(r) + varH
				zD[t][s].write(d_wordH+"\n")

				#No answer written as the inter-tile test is going to write to this location
예제 #3
0
						if op == 2: #I'm implimenting OP==2 as a TRUE_NOP, op==12 is a HALF_NOP
								addr2	= gf.int_to_bin(r,gf.DADDR_BITS)		#Secondary address same as row so NOTHING will be written
						else:
								addr2	= gf.int_to_bin(r+(gf.DROWS/2),gf.DADDR_BITS)		#Secondary address
						sel0	= gf.int_to_bin(s,3)	#set sel's to the strip currently being written
						sel1	= gf.int_to_bin(s,3)
						selq	= gf.int_to_bin(t,3)	#Set the selq to the tile currently being written    
						
						i_word = addr2+selq+opcode+sel1+sel0+addr1+addr0	#Complete instruction in binary
						i_wordH = gf.bin_to_hex(i_word) #Complete instruction in hex 
						###########
						if op == 3: #TRUE_NOP
								print "HEEEEEEEEERRRRR: TRUE_NOP: ", i_wordH
						###########
						i_wordH = gf.formatH_for_roach(i_wordH)	#Insert '\x' marks to indicate hex to python transmit script

						#Format final lines to be written to files
						word = opcode_names[op]+i_word+":"+i_wordH				#Instruction line containing both the binary and roach formatted instruction

						#Write instruction and data words to file
						zI[t][s].write(word+"\n")

				#Write data and answer arrays to files
				#This is done seperatly in order to write all the values sequentially despite them being generated out of order (one in the lower half of memory and one in the upper half for each instruction row)
				for i in range(0,gf.DROWS):
						zD[t][s].write(d_wordH[i]+"\n")
						zA[t][s].write(a_wordH[i]+"\n")
#Close files
gf.close_files(gf.STRIPS,gf.TILES,a[0],a[1],a[2])
예제 #4
0
        #new_count = len(string[p:p+(len_dchunk*16)])
        print("new_count1: ", new_count)
        new_count = gf.int_to_bin(
            new_count,
            (gf.SC_len - gf.DADDR_BITS - 9))  #How many words to load
        print("new_count2: ", new_count)

        start_add = gf.hydra_Daddr(i * len_dchunk)
        row = gf.int_to_bin(start_add[0], gf.DADDR_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)
        LDprogram = LDprogram + commandH + string[p:p + (
            len_dchunk * 16)] + ZERO_WORD_RH + ZERO_WORD_RH

else:  #If it happens to fit within one packet executing this is shorter
    start = gf.int_to_bin(0, gf.DADDR_BITS + 6)
    count = gf.int_to_bin(count, gf.SC_len - gf.DADDR_BITS -
                          9)  #How many words to load
    command = count + start + cmd
    print "LDcommand1: ", command
    commandH = gf.bin_to_hex(command)
    print "LDcommand2: ", commandH
    commandH = gf.formatH_for_roach(commandH)
    print "LDcommand3: ", commandH
    LDprogram = commandH + string + ZERO_WORD_RH + ZERO_WORD_RH
    print "LDprogram: ", LDprogram[0:100]
예제 #5
0
						
print "Generating nop instruction words for a %dx%d with %d instructions per strip: total number of instructions being: "%(gf.STRIPS,gf.TILES,gf.IROWS),gf.IROWS*gf.STRIPS*gf.TILES
nop = "000010"
add = "000000"
for t in range(0, gf.TILES):
		for s in range(0,gf.STRIPS):
				for r in range(0,gf.IROWS):
						if t==0 and s==0 and r == 3 : #In Tile0Strip0Row 3, put an add instruction in to cause an overflow on addition of r3 to r4
								opcode	= add
								addr0	= gf.int_to_bin(r,gf.DADDR_BITS)
								addr1	= gf.int_to_bin(r+1,gf.DADDR_BITS)
								print "****************HERE TWO++++++++++++++"
						else:
								opcode	= add
								addr0	= gf.int_to_bin(r,gf.DADDR_BITS)
								addr1	= gf.int_to_bin(r,gf.DADDR_BITS)

						addr2	= gf.int_to_bin(r,gf.DADDR_BITS)
						sel0	= gf.int_to_bin(s,3)
						sel1	= gf.int_to_bin(s,3)
						selq	= gf.int_to_bin(t,3)
				
						i_word = addr2+selq+opcode+sel1+sel0+addr1+addr0	
						i_wordH = gf.bin_to_hex(i_word) 
						i_wordH = gf.formatH_for_roach(i_wordH)
				
						i_wordH = "Address %d:" %(r)+i_wordH	
						zI[t][s].write(i_wordH+"\n")

print "Completed all generation succesfully"
예제 #6
0
		for s in range(0,gf.STRIPS):
				for r in range(0,gf.DROWS):
						varI=random.randrange(0,100000)
						varFP=FP.custom_floating_point_creator (varI,gf.D_wf,gf.D_we)
						d_wordH = gf.bin_to_hex_l(varFP,64)
						d_wordH = "Address %d:" %(r) + d_wordH
						zD[t][s].write(d_wordH+"\n")
						zA[t][s].write(d_wordH+"\n")
						
print "Generating nop instruction words for a %dx%d with %d instructions per strip: total number of instructions being: "%(gf.STRIPS,gf.TILES,gf.IROWS),gf.IROWS*gf.STRIPS*gf.TILES
nop = "000010"
for t in range(0, gf.TILES):
		for s in range(0,gf.STRIPS):
				for r in range(0,gf.IROWS):
						opcode	= nop
						addr0	= gf.int_to_bin(r,gf.DADDR_BITS)
						addr1	= gf.int_to_bin(r,gf.DADDR_BITS)
						addr2	= gf.int_to_bin(r,gf.DADDR_BITS)
						sel0	= gf.int_to_bin(s,3)
						sel1	= gf.int_to_bin(s,3)
						selq	= gf.int_to_bin(t,3)
				
						i_word = addr2+selq+opcode+sel1+sel0+addr1+addr0	
						i_wordH = gf.bin_to_hex(i_word) 
						i_wordH = gf.formatH_for_roach(i_wordH)
				
						i_wordH = "Address %d:" %(r)+i_wordH	
						zI[t][s].write(i_wordH+"\n")

print "Completed all generation succesfully"
예제 #7
0
				else:
						new_count = count
				#new_count = len(string[p:p+(len_dchunk*16)])
				print ("new_count1: ", new_count)
				new_count= gf.int_to_bin(new_count,(gf.SC_len-gf.DADDR_BITS-9))	#How many words to load
				print ("new_count2: ", new_count)

				start_add = gf.hydra_Daddr(i*len_dchunk)
				row= gf.int_to_bin(start_add[0],gf.DADDR_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)
				LDprogram=LDprogram+commandH+string[p:p+(len_dchunk*16)]+ZERO_WORD_RH+ZERO_WORD_RH



else:	#If it happens to fit within one packet executing this is shorter
		start= gf.int_to_bin(0,gf.DADDR_BITS+6)
		count= gf.int_to_bin(count,gf.SC_len-gf.DADDR_BITS-9)	#How many words to load
		command=count+start+cmd
		print "LDcommand1: ", command
		commandH = gf.bin_to_hex(command) 
		print "LDcommand2: ", commandH
		commandH = gf.formatH_for_roach(commandH)
		print "LDcommand3: ", commandH
		LDprogram=commandH+string+ZERO_WORD_RH+ZERO_WORD_RH
		print "LDprogram: ", LDprogram[0:100]
예제 #8
0
						new_count = len_dchunk
						count = count-len_dchunk
				else:
						new_count = count

				new_count= gf.int_to_bin(new_count,(gf.SC_len-gf.INS_ADDR_CD-3))	#How many words to load

				start_add = gf.hydra_Daddr(i*len_dchunk)
				row= gf.int_to_bin(start_add[0],gf.DADDR_BITS)
				strip= gf.int_to_bin(start_add[1],gf.STRIP_Ad_bits)
				tile= gf.int_to_bin(start_add[2],gf.TILES_Ad_bits)
				start=row+strip+tile

				command=new_count+start+cmd
				commandH = gf.bin_to_hex(command) 
				commandH = gf.formatH_for_roach(commandH)
				LDprogram=ZERO_WORD_RH+LDprogram+commandH+string[p:p+(len_dchunk*16)]+ZERO_WORD_RH



else:	#If it happens to fit within one packet executing this is shorter
		start= gf.int_to_bin(0,gf.INS_ADDR_CD)
		count= gf.int_to_bin(count,gf.SC_len-gf.INS_ADDR_C-3)	#How many words to load
		command=count+start+cmd
		commandH = gf.bin_to_hex(command) 
		LD_commandH = gf.formatH_for_roach(commandH)
		LDprogram=ZERO_WORD_RH+LD_commandH+string+ZERO_WORD_RH
		Nosys_commands = 1

print "<<<<< LDcommand: ", commandH, " >>>>>"
print("\nPacked data portion of the program with system commands, %d data words were read\n" %rcounter)
예제 #9
0
파일: compiler.py 프로젝트: r4space/Fynbos
        #				print "		Tile: ",t, "t_index", t_index

        #Check that the tile value currently being read is the next one in numerical order
        #If it's not the tiles and strips with in them must have a TRUE_NOP inserted
        #Create inputs for a T_NOP operation //For where the xml supplies nothing for certain locations in hydra
        while t_index < t:
            #Creat this T_NOP for every strip in the tile
            for k in range(0, STRIPS):

                count_nops = count_nops + 1

                data = FP.fp_infinity(
                    gf.D_wf, gf.D_we, 1
                )  #Set NULLs to negative infinity in the current format as a recognisable default
                H_data = gf.bin_to_hex(data)
                H_data = gf.formatH_for_roach(H_data)

                Dword = "Address %d:" % (ir_index) + H_data
                zD[t_index][k].write(Dword + "\n")  #Write the word to file
                count = count + 1

                opcode = opcode_dict["NOP_I4"]
                #Set sel's to it's local strip/tile value as a matter of default which is the purpose of the index parameters
                sel0 = gf.sel_string(-1, k)
                sel1 = gf.sel_string(-1, k)

                #Set addresses to the same as the implied address (the row number)
                #In the case of addr2, this will mean addr2 is NOT written to making it a TRUE_NOP
                addr0 = gf.addr_string(-1, ir_index)
                addr1 = gf.addr_string(-1, ir_index)
예제 #10
0
파일: compiler.py 프로젝트: r4space/Fynbos
		for tile in row.getElementsByTagName("tile"):
				t=int(tile.getAttribute("id"))
#				print "		Tile: ",t, "t_index", t_index

				#Check that the tile value currently being read is the next one in numerical order
				#If it's not the tiles and strips with in them must have a TRUE_NOP inserted
				#Create inputs for a T_NOP operation //For where the xml supplies nothing for certain locations in hydra
				while t_index < t:
						#Create this T_NOP for every strip in the tile
						for k in range(0,STRIPS):	
								
								count_nops = count_nops+1

								data=FP.fp_infinity(gf.D_wf,gf.D_we,1)	#Set NULLs to negative infinity in the current format as a recognisable default
								H_data=gf.bin_to_hex(data)
								H_data=gf.formatH_for_roach(H_data)

								Dword="Address %d:"%(ir_index) + H_data
								zD[t_index][k].write(Dword+"\n")	#Write the word to file
								count = count+1
								
								opcode=opcode_dict["NOP_I4"]
								#Set sel's to it's local strip/tile value as a matter of default which is the purpose of the index parameters
								sel0=gf.selS_string(-1, k) 
								sel1=gf.selS_string(-1, k)
								
								#Set addresses to the same as the implied address (the row number)
								#In the case of addr2, this will mean addr2 is NOT written to making it a TRUE_NOP 
								addr0=gf.addr_string(-1,ir_index)
								addr1=gf.addr_string(-1,ir_index)