@@ -92,17 +92,36 @@ def execute_build():
92
92
with logtime (logging .DEBUG , "programming" ):
93
93
platform .toolchain_program (products , np .name )
94
94
95
+ yosys_report = np .path .build (subdir , f"{ np .name } .rpt" )
95
96
heading = re .compile (r"^\d+\.\d+\. Printing statistics\.$" , flags = re .MULTILINE )
96
97
next_heading = re .compile (r"^\d+\.\d+\. " , flags = re .MULTILINE )
97
- log_file_between (logging .INFO , np . path . build ( subdir , f" { np . name } .rpt" ) , heading , next_heading )
98
+ log_file_between (logging .INFO , yosys_report , heading , next_heading )
98
99
100
+ nextpnr_report = np .path .build (subdir , f"{ np .name } .tim" )
99
101
logger .info ("Device utilisation:" )
100
102
heading = re .compile (r"^Info: Device utilisation:$" , flags = re .MULTILINE )
101
103
next_heading = re .compile (r"^Info: Placed " , flags = re .MULTILINE )
102
- log_file_between (
103
- logging .INFO , np .path .build (subdir , f"{ np .name } .tim" ), heading , next_heading , prefix = "Info: "
104
- )
104
+ log_file_between (logging .INFO , nextpnr_report , heading , next_heading , prefix = "Info: " )
105
105
106
+ timing_report = None
107
+ max_freq = re .compile (r"^Info: Max frequency for clock '" , flags = re .MULTILINE )
108
+ slack_histo = re .compile (r"^Info: Slack histogram:" , flags = re .MULTILINE )
109
+ with open (nextpnr_report , "r" ) as f :
110
+ for line in f :
111
+ if max_freq .match (line ):
112
+ timing_report = [line ]
113
+ elif timing_report is not None :
114
+ timing_report .append (line )
115
+
116
+ if timing_report is None :
117
+ logger .warn ("Couldn't extract timing information from nextpnr log" )
118
+ else :
119
+ for line in timing_report :
120
+ if slack_histo .match (line ):
121
+ break
122
+ line = line .rstrip ()
123
+ line = line .removeprefix ("Info: " )
124
+ logger .log (logging .INFO , line )
106
125
107
126
def construct_top (np : Project , platform : Platform , ** kwargs ):
108
127
sig = inspect .signature (np .top )
0 commit comments