示例#1
0
 def test_badkey(self):
     '''Bad key should throw syntax error'''
     fin = StringIO.StringIO("CLBLM_L_X10Y102.SLICEM_X0.SRUSEDMUX 2")
     fout = StringIO.StringIO()
     try:
         fasm2frame.run(fin, fout)
         self.fail("Expected syntax error")
     except fasm2frame.FASMSyntaxError:
         pass
示例#2
0
 def test_opkey_enum(self):
     '''Optional key with enumerated value should produce syntax error'''
     # CLBLM_L.SLICEM_X0.AMUX.O6 !30_06 !30_07 !30_08 30_11
     fin = StringIO.StringIO("CLBLM_L_X10Y102.SLICEM_X0.AMUX.O6")
     fout = StringIO.StringIO()
     try:
         fasm2frame.run(fin, fout)
         self.fail("Expected syntax error")
     except fasm2frame.FASMSyntaxError:
         pass
示例#3
0
    def bitread_frm_equals(self, frm_fn, bitread_fn):
        fout = StringIO.StringIO()
        fasm2frame.run(open(frm_fn, 'r'), fout)

        # Build a list of output used bits
        bits_out = frm2bits(fout.getvalue())

        # Build a list of reference used bits
        bits_ref = bitread2bits(open(bitread_fn, 'r').read())

        # Now check for equivilence vs reference design
        self.assertEquals(len(bits_ref), len(bits_out))
        self.assertEquals(bits_ref, bits_out)
示例#4
0
    def test_sparse(self):
        '''Verify sparse equivilent to normal encoding'''
        frm_fn = 'test_data/lut_int.fasm'

        fout_sparse = StringIO.StringIO()
        fasm2frame.run(open(frm_fn, 'r'), fout_sparse, sparse=True)
        fout_sparse_txt = fout_sparse.getvalue()
        bits_sparse = frm2bits(fout_sparse_txt)

        fout_full = StringIO.StringIO()
        fasm2frame.run(open(frm_fn, 'r'), fout_full, sparse=False)
        fout_full_txt = fout_full.getvalue()
        bits_full = frm2bits(fout_full_txt)

        # Now check for equivilence vs reference design
        self.assertEquals(len(bits_sparse), len(bits_full))
        self.assertEquals(bits_sparse, bits_full)

        # Verify the full ROI is way bigger description
        # It will still be decent size though since even sparse occupies all columns in that area
        self.assertGreaterEqual(len(fout_full_txt), len(fout_sparse_txt) * 4)
示例#5
0
 def test_opkey_01_1(self):
     fin = StringIO.StringIO("CLBLM_L_X10Y102.SLICEM_X0.SRUSEDMUX 1")
     fout = StringIO.StringIO()
     fasm2frame.run(fin, fout)
示例#6
0
 def test_opkey_01_default(self):
     '''Optional key with binary omitted value should produce valid result'''
     fin = StringIO.StringIO("CLBLM_L_X10Y102.SLICEM_X0.SRUSEDMUX")
     fout = StringIO.StringIO()
     fasm2frame.run(fin, fout)
示例#7
0
 def test_lut(self):
     '''Simple smoke test on just the LUTs'''
     fout = StringIO.StringIO()
     fasm2frame.run(open('test_data/lut.fasm', 'r'), fout)