|
Revision 93, 1.1 KB
(checked in by amirh, 19 months ago)
|
|
|
| Line | |
|---|
| 1 | import vhdltools |
|---|
| 2 | import win32com.client |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | def find_entity_source(ent,map): |
|---|
| 6 | if map.has_key(ent): |
|---|
| 7 | return map[ent] |
|---|
| 8 | else: |
|---|
| 9 | return "entity %s not in other source files" % ent |
|---|
| 10 | |
|---|
| 11 | def main(path): |
|---|
| 12 | print path |
|---|
| 13 | files = vhdltools.get_vhd_files(path) |
|---|
| 14 | result = vhdltools.analyze_files(files,vhdltools.entity_tuple) |
|---|
| 15 | Excel = win32com.client.Dispatch("Excel.Application") |
|---|
| 16 | Excel.Visible = True |
|---|
| 17 | |
|---|
| 18 | wb = Excel.Workbooks.Add() |
|---|
| 19 | sh = wb.Sheets[0] |
|---|
| 20 | sh.Range("A1:D1").Value = ["File Paths","Entity Declarations","Entity Instantiations","File Dependency"] |
|---|
| 21 | nr = len(result) |
|---|
| 22 | entity_to_file = {} |
|---|
| 23 | for r in result: |
|---|
| 24 | for ent in r[1][0]: |
|---|
| 25 | entity_to_file[ent] = r[0] |
|---|
| 26 | |
|---|
| 27 | sh.Range(sh.Cells(2,1),sh.Cells(1+nr,4)).Value = [(str(r[0]),str(r[1][0]),str(r[1][1]),str([find_entity_source(x,entity_to_file) for x in r[1][1]])) for r in result] |
|---|
| 28 | wb.SaveAs("DependencyReport") |
|---|
| 29 | |
|---|
| 30 | import sys |
|---|
| 31 | if __name__ == "__main__": |
|---|
| 32 | if len(sys.argv) > 1: |
|---|
| 33 | files = main(sys.argv[1]) |
|---|
| 34 | else: |
|---|
| 35 | files = main('.') |
|---|
| 36 | |
|---|