root/XilinxTools/xst_logparse.py

Revision 20, 1.1 KB (checked in by amirh, 2 years ago)
Line 
1arch = "virtex5"
2command = "run"
3logfile = open('logfile','r')
4lines = logfile.readlines()
5logfile.close()
6
7expecting_attr = True
8expecting_desc = False
9expecting_opts = False
10buf = ""
11attr = ""
12descr = ""
13opts = ()
14Description = {}
15Options = {}
16for line in lines:
17    if expecting_attr:
18        attr = line.split(":")[0].lstrip('-').rstrip(' ')
19        descr = line.split(":")[1].lstrip(' ').rstrip('\r\n')
20        Description[attr] = descr
21        expecting_attr = False
22        expecting_opts = True
23    elif expecting_opts:
24        Options[attr] = [option.lstrip('\t ').rstrip('\r\n ') for option in line.split('/')]
25        expecting_attr = True
26        expecting_opts = False
27
28import win32com.client
29Excel = win32com.client.Dispatch("Excel.Applcation")
30XST_Settings = Excel.Workbooks.Add()
31Row = 0
32
33for attr in Options.iterkeys():
34        XST_Settings.Sheets(1).Cells(Row,1).Value = attr
35        XST_Settings.Sheets(1).Cells(Row,2).Value = Description[attr]
36        XST_Settings.Sheets(1).Cells(Row,3).Value = repr(Options[attr])
37        Row = Row + 1
38
39XST_Settings.SaveAs('XST_%s_%s.xlsx'%(arch,command))
Note: See TracBrowser for help on using the browser.