forked from debjyoti0891/arche
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_lutdag.py
63 lines (49 loc) · 1.79 KB
/
test_lutdag.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import unittest
import os
from archetech.spirit.lutdag import LutGraph
import shutil
class BaseLUTTest(unittest.TestCase):
def setUp(self):
# Create test directory
self.benchdir = "./tests/genfiles/"
print("Creating test directory: {}".format(self.benchdir))
if not os.path.exists(self.benchdir):
os.makedirs(self.benchdir)
def partitioning(self):
k_list = [2, 3, 4]
for k in k_list:
lG = self.graph.genLutGraph(k)
self.assertIsNotNone(lG, "LUT graph should be generated")
def tearDown(self):
# remove generated files
print("Removing test directory: {}".format(self.benchdir))
shutil.rmtree(self.benchdir)
class TestSmallLUT(BaseLUTTest):
def test_load(self):
debug = True
benchfile = "./tests/fixtures/b1.blif"
self.graph = LutGraph(self.benchdir, benchfile, debug)
self.partitioning()
class TestLargeLUT(BaseLUTTest):
def test_load(self):
debug = False
benchfile = "./tests/fixtures/c6288.blif"
self.graph = LutGraph(self.benchdir, benchfile, debug)
self.partitioning()
class TestInvalidLUT(BaseLUTTest):
def test_partitioning(self):
benchfile = "./tests/fixtures/C7552.blif"
print("Testing with a blif file with invalid identifiers ")
self.graph = LutGraph(self.benchdir, benchfile, False)
k_list = [2, 3, 4]
for k in k_list:
lG = self.graph.genLutGraph(k)
self.assertIsNone(lG)
class TestPerformanceLUT(BaseLUTTest):
def test_load(self):
debug = False
benchfile = "./tests/fixtures/c6288.blif"
self.graph = LutGraph(self.benchdir, benchfile, debug)
self.partitioning()
if __name__ == "__main__":
unittest.main()