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])

print "completed succesfully"
Exemplo n.º 2
0
            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)

            selq = gf.sel_string(-1, t_index)
            addr2 = gf.addr_string(-1, ir_index)

            instruction_bin = addr2 + selq + opcode + sel1 + sel0 + addr1 + addr0
            i_wordH = gf.bin_to_hex(instruction_bin)
            i_wordHF = gf.formatH_for_roach(i_wordH)
            Iword = instruction_bin + ":" + i_wordHF

            zI[t_index][k].write(Iword + "\n")  #Write the word to file

        t_index = t_index + 1
    ir_index = ir_index + 1

gf.close_files(STRIPS, TILES, zI, zD, zA)
print "Count of data words: ", count
print "Count of T_NOPs insterted: ", count_nops
Exemplo n.º 3
0
								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])

print "completed succesfully"
Exemplo n.º 4
0
						#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,InstrRow)
						addr1=gf.addr_string(-1,InstrRow)
						
						selq=gf.selT_string(-1,t_index)
						addr2=gf.addr_string(-1,InstrRow)
						
						instruction_bin=addr2+selq+opcode+sel1+sel0+addr1+addr0
						i_wordH = gf.bin_to_hex(instruction_bin)
						i_wordHF = gf.formatH_for_roach(i_wordH)
						Iword=instruction_bin+":"+i_wordHF
						
						zI[t_index][s_index].write(Iword+"\n")	#Write the word to file
						count_nops = count_nops+1

gf.close_files(STRIPS,TILES,zI,zD,zA)
print "Now having added fillers for the system: "
print "Count of data words: ", count
print "Count of T_NOPs inserted: ", count_nops