Esempio n. 1
0
    def do_sacmap(self, args):
        ''' Maps a netlist to a crossbar using MAGIC instructions '''
        if args.file == None:
            print('Error: Benchmark must be specified using --file option')
            return
        if args.R is None or args.C is None:
            print('Error: crossbar dimensions must be specified')
            return
        if args.k is None:
            args.k = 2

        print('Mapping with crossbar dimension {}x{}'.format(args.R, args.C))
        newObj = SACMapper(args.file, args.dir, self.__logFile, self.debug)
        cycles = newObj.mapBenchmark(args.R, args.C, args.k)
        if cycles is None:
            print('Mapping failed')
            return

        i = args.file.rfind('/')
        if i >= 0:
            benchfile = args.file[i + 1:]
        else:
            benchfile = args.file
        outfile = 'Cr_{}_{}_k{}_{}.v'.format(args.R, args.C, args.k, benchfile)
        res,out = verifyOutput(
            args.file, \
            args.dir+outfile,
            args.dir
        )

        if res is not True:
            print('Output file is not identical to input netlist')
            logging.debug(' verification failed for {} and {}'.\
                format(args.file, args.dir+outfile))
Esempio n. 2
0
 def test_sac_cm82a_k2(self):
     benchfile = "./tests/fixtures/cm82a_k2.v"
     newObj = SACMapper(benchfile,self.benchdir,'logs.txt', False, True)
     newObj.mapBenchmark(64, 64, 0, True)
     res,out = verifyOutput(benchfile, \
         'tests/genfiles/Cr_64_64_k0_cm82a_k2.v.v', self.benchdir)
     if not res:
         print(out)
     self.assertEqual(res, True, "Generated file is not functionally same")
Esempio n. 3
0
 def test_sac_cm82a(self):
     benchfile = "./tests/fixtures/cm82a.blif"
     newObj = SACMapper(benchfile, self.benchdir, 'logs.txt', True, True)
     newObj.mapBenchmark(8, 8, 2)
     res,out = verifyOutput(benchfile, \
         'tests/genfiles/Cr_8_8_k2_cm82a.blif.v', self.benchdir)
     if not res:
         print(out)
     self.assertEqual(res, True, "Generated file is not functionally same")
Esempio n. 4
0
 def test_sac_c6288(self):
     benchfile = "./tests/fixtures/C6288.blif"
     for spacing in [2, 4]:
         newObj = SACMapper(benchfile, self.benchdir, 'logs.txt', False,
                            True)
         newObj.mapBenchmark(64, 64, 5, False, spacing)
         res,out = verifyOutput(benchfile, \
             'tests/genfiles/Cr_64_64_k5_C6288.blif.v', self.benchdir)
         if not res:
             print(out)
         self.assertEqual(res, True,
                          "Generated file is not functionally same")
Esempio n. 5
0
 def sac_generic(self, R, C, k, benchfile, benchfile_dir):
     newObj = SACMapper(benchfile_dir + benchfile, self.benchdir,
                        'logs.txt', True, True)
     newObj.mapBenchmark(R, C, k)
     outfile = 'Cr_{}_{}_k{}_{}.v'.format(R, C, k, benchfile)
     res,out = verifyOutput(
         benchfile_dir+benchfile, \
         self.benchdir+outfile,
         self.benchdir
     )
     file_out = '{} and {} are different. \n'.format(benchfile_dir+benchfile,self.benchdir+outfile)+\
                 'Verification failed'
     self.assertEqual(res, True, file_out)
Esempio n. 6
0
 def test_verify_negative(self):
     res, out = verifyOutput('./tests/fixtures/b1.blif',
                             './tests/fixtures/cm151a.blif', self.benchdir)
     self.assertEqual(res, False)
Esempio n. 7
0
 def test_verify_positive(self):
     res, out = verifyOutput('./tests/fixtures/b1.blif',
                             './tests/fixtures/b1.blif', self.benchdir)
     self.assertEqual(res, True)
Esempio n. 8
0
    benchmark = sys.argv[1]
    bench_dir = sys.argv[2]
    R = int(sys.argv[3])
    C = int(sys.argv[4])
    k = int(sys.argv[5])
    logfile = sys.argv[6]

    if len(sys.argv) == 8:
        spacing = int(sys.argv[7])
    else:
        spacing = 0

    logging.basicConfig(filename=logfile, level=logging.DEBUG)
    newObj = SACMapper(benchmark, bench_dir, logfile, False, True)
    newObj.mapBenchmark(R, C, k, False, spacing)
    i = benchmark.rfind('/')
    if i >= 0:
        benchfile = benchmark[i + 1:]
    else:
        benchfile = benchmark
    outfile = 'Cr_{}_{}_k{}_{}.v'.format(R, C, k, benchfile)
    res,out = verifyOutput(
        benchmark, \
        bench_dir+outfile,
        bench_dir
    )

    if res is not True:
        print('Output file is not identical to input netlist')
        logging.debug(' verification failed for {} and {}'.\
            format(benchmark, bench_dir+outfile))