예제 #1
0
    def AddStatementGenerator(self, verbose=False):
        """ Tests the Add statement generator """
        for testCase in AddGeneratorTestCases:
            print("Testing Add generator with params {0}".format(testCase[0]))
            stmntGenerator = StatementGenerator.AddStatementGenerator(
                testCase[0])

            self.StatementTestCaseChecker(stmntGenerator, testCase, verbose)
예제 #2
0
    def PtrStatementGenerator(self, verbose=False):
        """ Tests the pointer chase statement generator """
        for testCase in PtrGeneratorTestCases:
            print("Testing pointer chase with params {0}".format(testCase[0]))
            stmntGenerator = StatementGenerator.PtrChaseStatementGenerator(
                testCase[0])

            self.StatementTestCaseChecker(stmntGenerator, testCase, verbose)
예제 #3
0
    def MulStatementGenerator(self, verbose=False):
        """ Tests the Mul statement generator """
        for testCase in MulGeneratorTestCases:
            print("Testing Mul generator with params {0}".format(testCase[0]))
            stmntGenerator = StatementGenerator.MulStatementGenerator(
                testCase[0])

            self.StatementTestCaseChecker(stmntGenerator, testCase, verbose)
예제 #4
0
    def FMAStatementGenerator(self, verbose=False):
        """ Tests the FMA statement generator """
        for testCase in FMAGeneratorTestCases:
            print("Testing FMA generator with params {0}".format(testCase[0]))
            stmntGenerator = StatementGenerator.FMAStatementGenerator(
                testCase[0])

            self.StatementTestCaseChecker(stmntGenerator, testCase, verbose)
예제 #5
0
    def RegOpGeneratorTest(self, verbose=False):
        """ Tests the memory operand generator """
        for testCase in RegOpGeneratorTestCases:
            print("Testing memOpGenerator with params {0}".format(testCase[0]))
            regGenerator = StatementGenerator.RegOpGenerator(testCase[0])

            #Run through the test cases
            for result in testCase[1]:
                retVal = regGenerator.getNextOp(True)
                if verbose:
                    if retVal != result:
                        print("Failure")
                    else:
                        print("Success")
                    print("Expecting {0} got {1}".format(result, retVal))
                elif retVal != result:
                    print("Failure expected {0} got {1}".format(
                        result, retVal))
                else:
                    print("Success")
            print("----------------------------------------------------")
예제 #6
0
    "secondOpType": "mem",
    "secondOpStartIdx": 0,
    "secondOpStride": 3,
    "thirdOpType": "mem",
    "thirdOpStartIdx": 2,
    "thirdOpStride": 3,
    "regOpNumIndices": 8,
    "memOpNumIndices": 6,
    "regOpName": "testData_",
    "memOpName": "inputArray"
}]

FMAGeneratorTestCases = [
    [{
        "firstOpGenerator":
        StatementGenerator.MemOpGenerator(StmtMemOps[0][0]),
        "secondOpGenerator":
        StatementGenerator.MemOpGenerator(StmtMemOps[0][1]),
        "thirdOpGenerator": StatementGenerator.MemOpGenerator(StmtMemOps[0][2])
    },
     [
         "inputArray[  0] = inputArray[  0] * inputArray[  1] + inputArray[  2];",
         "inputArray[  1] = inputArray[  1] * inputArray[  2] + inputArray[  3];",
         "inputArray[  2] = inputArray[  2] * inputArray[  3] + inputArray[  0];",
         "inputArray[  3] = inputArray[  3] * inputArray[  0] + inputArray[  1];",
         "inputArray[  0] = inputArray[  0] * inputArray[  1] + inputArray[  2];"
     ]],
    # Test memory operations on a non power of two stride
    [{
        "firstOpGenerator":
        StatementGenerator.MemOpGenerator(StmtMemOps[1][0]),
예제 #7
0
print("	Stride:                    {0:6}".format(stride))
print("	Number of Elements:        {0:6}".format(numElements))
print("    Number of Registers:       {0:6}".format(numRegsToUse))
print("	Operations per iteration:  {0:6}".format(operations))
#print ("	Chunks:                    {0:6}".format(numChunks   ))
print("    Pipeline stalls:           {0:6}".format(stalls))

firstOpGenerator = None
secondOpGenerator = None
thirdOpGenerator = None

# if destination is memory
if "_mem" in opTypes:
    firstOpGenerator = StatementGenerator.MemOpGenerator({
        "opName": "testArray",
        "startIndex": 0,
        "numIndex": numElements,
        "stride": stride
    })
else:
    firstOpGenerator = StatementGenerator.RegOpGenerator({
        "opName": "dest_",
        "startIndex": 0,
        "numIndex": numRegsToUse,
        "stride": stride
    })

# if source is memory
if "mem_" in opTypes:
    #secondOpGenerator = StatementGenerator.MemOpGenerator({"opName":"testArray","startIndex":(1 * stride),"numIndex":numElements,"stride":stride})
    thirdOpGenerator = StatementGenerator.MemOpGenerator({
        "opName":