Ejemplo n.º 1
0
#!/usr/bin/python2.6
##Memory test: Load a unique value into every data location and increment by one.
import generator_functions as gf
import random
#Assume a string is in binary unless the name ends in a 'H' meaning it's in hex
sub = "000010"

#Initialisation
a = gf.initialise_files(gf.STRIPS, gf.TILES)
zI = a[0]  #Array of handles on instruction files: zI[tile][strip]
zD = a[1]  #Array of handles on data files: zD[tile][strip]
zA = a[2]  #Array of handles on answer files: zA[tile][strip]
r = 0
s = 0
t = 0
#r = row number, s=strip number, t=tile number
print "Generating mem_test"

for t in range(0, gf.TILES):
    for s in range(0, gf.STRIPS):
        d_wordH = range(gf.DROWS)  #initialise a new data word array
        a_wordH = range(gf.DROWS)  #initialise a new answer word array

        #Generate data, instructions and answers and write instructions to files
        for r in range(0, gf.IROWS):  #Write a row in a strip in a tile

            #Generate random values:
            var1 = random.randrange(0, 17179869183)
            #var1= r
            var1H = gf.roach_word(var1)
            var2 = random.randrange(0, 17179869183)
Ejemplo n.º 2
0
count_nops = 0  #Counter holding the number of times a strip has to be filled with T_NOP instructions (i.e the number of potential operations not used)
#### MAIN ####
header_info = doc.getElementsByTagName("map").item(0)

DROWS = int(header_info.getAttribute("n_rows"))
IROWS = int(header_info.getAttribute("end_row"))
TILES = int(header_info.getAttribute("n_tiles"))
STRIPS = int(header_info.getAttribute("n_strips"))
print "File header info: "
print "	Number of tiles:", TILES
print "	Number of strips per tile:", STRIPS
print "	Number of instruction rows per strip:", IROWS
print "	Number of data rows per strip:", DROWS

#Initialise files for storing results:
a = gf.initialise_files(STRIPS, TILES)
zI = a[0]  #Array of handles on instruction files: zI[tile][strip]
zD = a[1]  #Array of handles on data files: zD[tile][strip]
zA = a[2]
count = 0

#tree[ROW][TILES][STRIPS][INSTRUCTION][DATA0][DATA1]
tree = [[["INSTRUCTION", "DATA"] * STRIPS] * TILES] * DROWS

ir_index = 0
dr_index = 0
t_index = 0
s_index = 0
for row in doc.getElementsByTagName("row"):
    r = int(row.getAttribute("id"))
    #		print "Row: ",r, "ir_index:", ir_index
Ejemplo n.º 3
0
#!/usr/bin/python2.6
##Memory test: Load a unique value into every data location by writing to both the implied and specified address.
#Writing only the implied address is also tested in the case of NOPs TRUE_NOPS however
import generator_functions as gf
import FP_creator as FP
import random
import sys

opcode_dict={0:"000000" , 1:"000001" , 2:"000010",3:"000011" , 4:"000101",5:"000110",6:"000111",7:"001100",8:"010100",9:"011100",10:"100100",11:"110100",12:"000010",13:"000100"}
opcode_names={0:"add" , 1:"sub", 2:"TRUE_NOP",3:"mul",4:"copy",5:"max",6:"min",7:"<",8:"==",9:"<=",10:">",11:">=",12:"HALF_NOP",13:"DIV"}

#Initialisation
a =	gf.initialise_files(gf.STRIPS,gf.TILES)
zI =a[0] #Array of handles on instruction files: zI[tile][strip]
zD =a[1] #Array of handles on data files: zD[tile][strip]
zA =a[2] #Array of handles on answer files: zA[tile][strip]
r=0;s=0;t=0; #r = row number, s=strip number, t=tile number
#Check Number of Data rows is double the number of instruction rows
if gf.DROWS != 2*gf.IROWS:
		print "ERROR: the number of data rows must be double the number of instruction rows for this script to be run"
		sys.exit()

print "Generating mem_test"

#Create an array that indicates if a strip is capable of division or not
local_div_strips = gf.div_strips
div_strips_array = range(0,gf.TILES)
for i in range (0,gf.TILES):
		div_strips_array[i]=range(0,gf.STRIPS)

for i in range (gf.TILES-1, -1, -1):
Ejemplo n.º 4
0
STRIPS=int(header_info.getAttribute("n_strips"))
print "File header info: "
print "	Number of tiles:",TILES
print "	Number of strips per tile:",STRIPS
if TILES != gf.TILES:
    print '\033[1;41mThis is a problem, the number of TILEs in the Fynbos config appears to be different to the number in the xml input\033[1;m' 
if STRIPS != gf.STRIPS:
    print '\033[1;41mThis is a problem, the number of TILEs in the Fynbos config appears to be different to the number in the xml input\033[1;m' 
	
print "	Execution end row:",endrow
print "	DAREA n_rows:",DROWS
print " Hydra data registers: ", gf.DROWS
print " Hydra instruction registers: ", gf.IROWS

#Initialise files for storing results:
a = gf.initialise_files(STRIPS,TILES)
zI=a[0]#Array of handles on instruction files: zI[tile][strip]
zD =a[1] #Array of handles on data files: zD[tile][strip]
zA=a[2]
count = 0

#tree[ROW][TILES][STRIPS][INSTRUCTION][DATA0][DATA1]
tree=[[["INSTRUCTION","DATA"]*STRIPS]*TILES]*DROWS

ir_index=0
dr_index=0
t_index=0
s_index=0
for row in doc.getElementsByTagName("row"):
		r=int(row.getAttribute("id"))
#		print "Row: ",r, "ir_index:", ir_index