12
12
import os
13
13
import csv
14
14
15
- sys .path .insert (0 , os .path .dirname (os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))) )
15
+ sys .path .insert (0 , os .path .dirname (os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))))
16
16
17
17
from pyverilog .dataflow .dataflow import *
18
18
from pyverilog_toolbox .verify_tool .dataflow_facade import dataflow_facade , out_as_html
@@ -34,13 +34,13 @@ def getRegMaps(self):
34
34
write_map = self .reg_control .create_map ('write' )
35
35
read_map = self .reg_control .create_map ('read' )
36
36
37
- for tv ,tk ,bvi ,bit ,term_lsb in self .binds .walk_reg_each_bit ():
37
+ for tv , tk , bvi , bit , term_lsb in self .binds .walk_reg_each_bit ():
38
38
target_tree = self .makeTree (tk )
39
39
funcdict = splitter .split (target_tree )
40
40
funcdict = splitter .remove_reset_condition (funcdict )
41
- tree_list = self .binds .extract_all_dfxxx (target_tree , set ([]), bit - term_lsb , DFTerminal )
42
- write_map .check_new_reg (str (tv ), term_lsb , tree_list , funcdict , bit )
43
- read_map .check_new_reg (str (tv ), term_lsb , tree_list , funcdict , bit )
41
+ trees = self .binds .extract_all_dfxxx (target_tree , set ([]), bit - term_lsb , DFTerminal )
42
+ write_map .check_new_reg (str (tv ), term_lsb , trees , funcdict , bit )
43
+ read_map .check_new_reg (str (tv ), term_lsb , trees , funcdict , bit )
44
44
self .out_file = open (self .out_file_name , "w" )
45
45
write_map .output_csv (self .out_file )
46
46
read_map .output_csv (self .out_file )
@@ -53,10 +53,12 @@ def getRegMaps(self):
53
53
def csv2html (self , csv_file_name ):
54
54
""" [FUNCTIONS]
55
55
Convert csv file to html.
56
- Refer to http://www.ctroms.com/blog/code/python/2011/04/20/csv-to-html-table-with-python/ (by Chris Trombley)
56
+ Cited from
57
+ http://www.ctroms.com/blog/code/python/2011/04/20/csv-to-html-table-with-python/
58
+ (by Chris Trombley)
57
59
"""
58
60
reader = csv .reader (open (csv_file_name ))
59
- htmlfile = open (" log.html" , "w" )
61
+ htmlfile = open (' log.html' , 'w' )
60
62
rownum = 0
61
63
62
64
htmlfile .write ('<table rules="all">' )
@@ -98,15 +100,15 @@ def _read_setup_file(self, file_name):
98
100
word_list = readline .split (':' )
99
101
if len (word_list ) == 2 :
100
102
if word_list [0 ] == 'WRITE_FLAG' :
101
- write_flag = word_list [1 ].replace ('\n ' ,'' )
103
+ write_flag = word_list [1 ].replace ('\n ' , '' )
102
104
elif word_list [0 ] == 'READ_FLAG' :
103
- read_flag = word_list [1 ].replace ('\n ' ,'' )
105
+ read_flag = word_list [1 ].replace ('\n ' , '' )
104
106
elif word_list [0 ] == 'ADDRESS' :
105
- address = word_list [1 ].replace ('\n ' ,'' )
107
+ address = word_list [1 ].replace ('\n ' , '' )
106
108
elif word_list [0 ] == 'READ_DATA' :
107
- read_data = word_list [1 ].replace ('\n ' ,'' )
109
+ read_data = word_list [1 ].replace ('\n ' , '' )
108
110
elif word_list [0 ] == 'WRITE_DATA' :
109
- write_data = word_list [1 ].replace ('\n ' ,'' )
111
+ write_data = word_list [1 ].replace ('\n ' , '' )
110
112
setup_file .close ()
111
113
return write_flag , read_flag , address , write_data , read_data
112
114
@@ -115,6 +117,7 @@ def _read_setup_file(self, file_name):
115
117
return
116
118
117
119
class WriteMap (object ):
120
+
118
121
def __init__ (self , flag , address , data ):
119
122
self .flag = flag
120
123
self .address = address
@@ -130,12 +133,12 @@ def output_csv(self, file_handle):
130
133
file_handle .write (self .this_map_name )
131
134
self .calc_map_spec ()
132
135
file_handle .write ('ADD,' )
133
- for i in range (self .max_bit - 1 ,- 1 ,- 1 ):
136
+ for i in range (self .max_bit - 1 , - 1 , - 1 ):
134
137
file_handle .write (str (i ) + ',' )
135
- for address , reg in sorted (self .map .items (), key = lambda x :x [0 ]):
138
+ for address , reg in sorted (self .map .items (), key = lambda x : x [0 ]):
136
139
file_handle .write ('\n ' )
137
140
file_handle .write (str (address ) + ',' )
138
- for i in range (self .max_bit - 1 ,- 1 ,- 1 ):
141
+ for i in range (self .max_bit - 1 , - 1 , - 1 ):
139
142
if i in reg .keys ():
140
143
signal = reg [i ]
141
144
file_handle .write (signal [0 ] + '[' + str (signal [1 ]) + ']' + ',' )
0 commit comments