OpenCores
URL https://opencores.org/ocsvn/spacewiresystemc/spacewiresystemc/trunk

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [altera_work/] [spw_fifo_ulight/] [ulight_fifo/] [synthesis/] [submodules/] [hps_sdram_p0_report_timing.tcl] - Blame information for rev 40

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 32 redbear
# (C) 2001-2017 Intel Corporation. All rights reserved.
2
# Your use of Intel Corporation's design tools, logic functions and other 
3
# software and tools, and its AMPP partner logic functions, and any output 
4 40 redbear
# files from any of the foregoing (including device programming or simulation 
5 32 redbear
# files), and any associated documentation or information are expressly subject 
6
# to the terms and conditions of the Intel Program License Subscription 
7 40 redbear
# Agreement, Intel FPGA IP License Agreement, or other applicable 
8 32 redbear
# license agreement, including, without limitation, that your use is for the 
9
# sole purpose of programming logic devices manufactured by Intel and sold by 
10
# Intel or its authorized distributors.  Please refer to the applicable 
11
# agreement for further details.
12
 
13
 
14
####################################################################
15
#
16
# THIS IS AN AUTO-GENERATED FILE!
17
# -------------------------------
18
# If you modify this files, all your changes will be lost if you
19
# regenerate the core!
20
#
21
# FILE DESCRIPTION
22
# ----------------
23
# This file contains the routines to generate the UniPHY memory
24
# interface timing report at the end of the compile flow.
25
#
26
# These routines are only meant to be used in this specific context.
27
# Trying to using them in a different context can have unexpected
28
# results.
29
#############################################################
30
# This report_timing script performs the timing analysis for
31
# all memory interfaces in the design.  In particular, this
32
# script will loop over all memory interface cores and
33
# instances and will timing analyze a range of paths that
34
# are applicable for each instance.  These include the
35
# timing analysis for the read capture, write, PHY
36
# address/command, and resynchronization paths among others.
37
#
38
# In performing the above timing analysis, the script
39
# calls procedures that are found in a separate file (report_timing_core.tcl)
40
# that has all the details of the timing analysis, and this
41
# file only serves as the top-level timing analysis flow.
42
#
43
# To reduce data lookups in all the procuedures that perform
44
# the individual timing analysis, data that is needed for
45
# multiple procedures is lookup up in this file and passed
46
# to the various parameters.  These data include both values
47
# that are applicable over all operating conditions, and those
48
# that are applicable to only one operating condition.
49
#
50
# In addition to the data that is looked up, the script
51
# and the underlying procedures use various other data
52
# that are stored in TCL sets and include the following:
53
#
54
#   t(.)     : Holds the memory timing parameters
55
#   board(.) : Holds the board skews and propagation delays
56
#   SSN(.)   : Holds the SSN pushout and pullin delays
57
#   IP(.)    : Holds the configuration of the memory interface
58
#              that was generated
59
#   ISI(.)   : Holds any intersymbol interference when the
60
#              memory interface is generated in a multirank
61
#              topology
62
#   MP(.)    : Holds some process variation data for the memory
63
#              See below for more information
64
#   pins(.)  : Holds the pin names for the memory interface
65
#
66
#############################################################
67
 
68
set script_dir [file dirname [info script]]
69
 
70
#############################################################
71
# Memory Specification Process Variation Information
72
#############################################################
73
 
74
# The percentage of the JEDEC specification that is due
75
# to process variation 
76
 
77
set MP(DQSQ) 0.65
78
set MP(QH_time) 0.55
79
set MP(IS) 0.70
80
set MP(IH) 0.6
81
set MP(DS) 0.60
82
set MP(DH) 0.50
83
set MP(DSS) 0.60
84
set MP(DSH) 0.60
85
set MP(DQSS) 0.5
86
set MP(WLH) 0.60
87
set MP(WLS) 0.70
88
set MP(DQSCK) 0.5
89
set MP(DQSCK_T) 0.15
90
 
91
#############################################################
92
# Initialize the environment
93
#############################################################
94
 
95
global quartus
96
if { ![info exists quartus(nameofexecutable)] || $quartus(nameofexecutable) != "quartus_sta" } {
97
        post_message -type error "This script must be run from quartus_sta"
98
        return 1
99
}
100
 
101
if { ! [ is_project_open ] } {
102
        if { [ llength $quartus(args) ] > 0 } {
103
                set project_name [lindex $quartus(args) 0]
104
                project_open -revision [ get_current_revision $project_name ] $project_name
105
        } else {
106
                post_message -type error "Missing project_name argument"
107
                return 1
108
        }
109
}
110
 
111
#############################################################
112
# Some useful functions
113
#############################################################
114
source "$script_dir/hps_sdram_p0_timing.tcl"
115
source "$script_dir/hps_sdram_p0_pin_map.tcl"
116
source "$script_dir/hps_sdram_p0_report_timing_core.tcl"
117
 
118
set family [get_family_string]
119
set family [string tolower $family]
120
if {$family == "arria ii gx"} {
121
        set family "arria ii"
122
}
123
if {$family == "stratix iv gx"} {
124
        set family "stratix iv"
125
}
126
if {$family == "stratix v gx"} {
127
        set family "stratix v"
128
}
129
if {$family == "stratix v gt"} {
130
        set family "stratix v"
131
}
132
if {$family == "hardcopy iv gx"} {
133
        set family "hardcopy iv"
134
}
135
 
136
 
137
#############################################################
138
# Load the timing netlist
139
#############################################################
140
 
141
if { ! [ timing_netlist_exist ] } {
142
        create_timing_netlist
143
}
144
 
145
set opcs [ list "" ]
146
 
147
set signoff_mode $::quartus(ipc_mode)
148
if { [string match "*Analyzer GUI" [get_current_timequest_report_folder]]} {
149
        read_sdc
150
        update_timing_netlist
151
        set script_dir [file dirname [info script]]
152
        source "$script_dir/hps_sdram_p0_timing.tcl"
153
        source "$script_dir/hps_sdram_p0_pin_map.tcl"
154
        source "$script_dir/hps_sdram_p0_report_timing_core.tcl"
155
}
156
 
157
load_package atoms
158
read_atom_netlist
159
 
160
load_package report
161
load_report
162
if { ! [timing_netlist_exist] } {
163
        post_message -type error "Timing Netlist has not been created. Run the 'Update Timing Netlist' task first."
164
        return
165
}
166
 
167
package require ::quartus::ioo
168
package require ::quartus::sin
169
initialize_ioo
170
 
171
#############################################################
172
# This is the main timing analysis function
173
#   It performs the timing analysis over all of the
174
#   various Memory Interface instances and timing corners
175
#############################################################
176
 
177
set mem_if_memtype "ddr3"
178
 
179
if [ info exists ddr_db ] {
180
        unset ddr_db
181
}
182
 
183
###############################################
184
# This is the main call to the netlist traversal routines
185
# that will automatically find all pins and registers required
186
# to timing analyze the Core.
187
hps_sdram_p0_initialize_ddr_db ddr_db
188
 
189
set old_active_clocks [get_active_clocks]
190
set_active_clocks [all_clocks]
191
 
192
# If multiple instances of this core are present in the
193
# design they will all be analyzed through the
194
# following loop
195
set instances [ array names ddr_db ]
196
set inst_id 0
197
foreach inst $instances {
198
        if { [ info exists pins ] } {
199
                # Clean-up stale content
200
                unset pins
201
        }
202
        array set pins $ddr_db($inst)
203
 
204
        set inst_controller [regsub {p0$} $inst "c0"]
205
 
206
        ####################################################
207
        #                                                  #
208
        # Transfer the pin names to a more readable scheme #
209
        #                                                  #
210
        ####################################################
211
        set dqs_pins $pins(dqs_pins)
212
        set dqsn_pins $pins(dqsn_pins)
213
        set q_groups [ list ]
214
        foreach dq_group $pins(q_groups) {
215
                set dq_group $dq_group
216
                lappend q_groups $dq_group
217
        }
218
        set all_dq_pins [ join [ join $q_groups ] ]
219
 
220
        set ck_pins $pins(ck_pins)
221
        set ckn_pins $pins(ckn_pins)
222
        set add_pins $pins(add_pins)
223
        set ba_pins $pins(ba_pins)
224
        set cmd_pins $pins(cmd_pins)
225
        set ac_pins [ concat $add_pins $ba_pins $cmd_pins ]
226
        set dm_pins $pins(dm_pins)
227
        set all_dq_dm_pins [ concat $all_dq_pins $dm_pins ]
228
 
229
 
230
        #################################################################################
231
        # Find some design values and parameters that will used during the timing analysis
232
        # that do not change accross the operating conditions
233
        set period $t(CK)
234
 
235
        # Get the number of PLL steps
236
        set pll_steps "UNDEFINED"
237
 
238
        # Package skew
239
        [catch {get_max_package_skew} max_package_skew]
240
        if { ($max_package_skew == "") } {
241
                set max_package_skew 0
242
        } else {
243
                set max_package_skew [expr $max_package_skew / 1000.0]
244
        }
245
 
246
        # DLL length
247
        # Arria V DLL Length is always 8
248
        set dll_length 8
249
 
250
        # DQS_phase offset
251
        set dqs_phase [ hps_sdram_p0_get_dqs_phase $dqs_pins ]
252
 
253
        set fitter_run [hps_sdram_p0_get_io_interface_type [lindex [lindex $pins(q_groups) 0] 0]]
254
        if {$fitter_run == ""} {
255
                post_message -type critical_warning "Fitter (quartus_fit) failed or was not run. Run the Fitter (quartus_fit) successfully before running ReportDDR"
256
                continue
257
        }
258
 
259
        # Get the interface type (HPAD or VPAD)
260
        set interface_type [hps_sdram_p0_get_io_interface_type $all_dq_pins]
261
 
262
        # Treat the VHPAD interface as the same as a HPAD interface
263
        if {($interface_type == "VHPAD") || ($interface_type == "HYBRID")} {
264
                set interface_type "HPAD"
265
        }
266
 
267
        # Get the IO standard which helps us determine the Memory type
268
        set io_std [hps_sdram_p0_get_io_standard [lindex $dqs_pins 0]]
269
 
270
        if {$interface_type == "" || $interface_type == "UNKNOWN" || $io_std == "" || $io_std == "UNKNOWN"} {
271
                set result 0
272
        }
273
 
274
        # Get some of the FPGA jitter and DCD specs
275
        # When not specified all jitter values are peak-to-peak jitters in ns
276
        set tJITper [expr [get_micro_node_delay -micro MEM_CK_PERIOD_JITTER -parameters [list IO PHY_SHORT] -period $period]/1000.0]
277
        set tJITdty [expr [get_micro_node_delay -micro MEM_CK_DC_JITTER -parameters [list IO PHY_SHORT]]/1000.0]
278
        # DCD value that is looked up is in %, and thus needs to be divided by 100
279
        set tDCD [expr [get_micro_node_delay -micro MEM_CK_DCD -parameters [list IO PHY_SHORT]]/100.0]
280
        # This is the peak-to-peak jitter on the whole DQ-DQS read capture path
281
        set DQSpathjitter [expr [get_micro_node_delay -micro DQDQS_JITTER -parameters [list IO] -in_fitter]/1000.0]
282
        # This is the proportion of the DQ-DQS read capture path jitter that applies to setup (looed up value is in %, and thus needs to be divided by 100)
283
        set DQSpathjitter_setup_prop [expr [get_micro_node_delay -micro DQDQS_JITTER_DIVISION -parameters [list IO] -in_fitter]/100.0]
284
 
285
        set fname ""
286
        set fbasename ""
287
        if {[llength $instances] <= 1} {
288
                set fbasename "${::GLOBAL_hps_sdram_p0_corename}"
289
        } else {
290
                set fbasename "${::GLOBAL_hps_sdram_p0_corename}_${inst_id}"
291
        }
292
 
293
        set fname "${fbasename}_summary.csv"
294
 
295
        #################################################################################
296
        # Now loop the timing analysis over the various operating conditions
297
        set summary [list]
298
        foreach opc $opcs {
299
                if {$opc != "" } {
300
                        set_operating_conditions $opc
301
                        update_timing_netlist
302
                }
303
                set opcname [get_operating_conditions_info [get_operating_conditions] -display_name]
304
                set opcname [string trim $opcname]
305
 
306
                set model_corner [hps_sdram_p0_get_model_corner]
307
                initialize_sin -model [lindex $model_corner 0] -corner [lindex $model_corner 1]
308
 
309
                global assumptions_cache
310
                set in_gui [regexp "TimeQuest Timing Analyzer GUI" [get_current_timequest_report_folder]]
311
                if {!$in_gui && [array exists assumptions_cache] &&  [info exists assumptions_cache(${::GLOBAL_hps_sdram_p0_corename}-$inst)] } {
312
                        set assumptions_valid $assumptions_cache(${::GLOBAL_hps_sdram_p0_corename}-$inst)
313
                        if {!$assumptions_valid} {
314
                                post_message -type critical_warning "Read Capture and Write timing analyses may not be valid due to violated timing model assumptions"
315
                                post_message -type critical_warning "See violated timing model assumptions in previous timing analysis above"
316
                        }
317
                } else {
318
                        set assumptions_valid [hps_sdram_p0_verify_flexible_timing_assumptions $inst pins $mem_if_memtype]
319
                        set assumptions_cache(${::GLOBAL_hps_sdram_p0_corename}-$inst) $assumptions_valid
320
                }
321
 
322
                #######################################
323
                # Determine parameters and values that are valid only for this operating condition
324
 
325
                set total_max_scale_factor [get_float_table_node_delay -src {SCALE_FACTOR} -dst {TOTAL_SCALE_FACTOR} -parameters {IO}]
326
                set total_min_scale_factor [get_float_table_node_delay -src {SCALE_FACTOR} -dst {TOTAL_SCALE_FACTOR} -parameters {IO MIN}]
327
                set scale_factors(total) [expr $total_max_scale_factor - $total_min_scale_factor]
328
 
329
                set odv_max_scale_factor [get_float_table_node_delay -src {SCALE_FACTOR} -dst {ODV_SCALE_FACTOR} -parameters {IO}]
330
                set odv_min_scale_factor [get_float_table_node_delay -src {SCALE_FACTOR} -dst {ODV_SCALE_FACTOR} -parameters {IO MIN}]
331
                set scale_factors(odv) [expr $odv_max_scale_factor - $odv_min_scale_factor]
332
 
333
                set eol_max_scale_factor [get_float_table_node_delay -src {SCALE_FACTOR} -dst {EOL_SCALE_FACTOR} -parameters {IO}]
334
                set eol_min_scale_factor [get_float_table_node_delay -src {SCALE_FACTOR} -dst {EOL_SCALE_FACTOR} -parameters {IO MIN}]
335
                set scale_factors(eol) [expr $eol_max_scale_factor - $eol_min_scale_factor]
336
 
337
                set emif_max_scale_factor [get_float_table_node_delay -src {SCALE_FACTOR} -dst {MEM_INTERFACE_SCALE_FACTOR} -parameters {IO}]
338
                set emif_min_scale_factor [get_float_table_node_delay -src {SCALE_FACTOR} -dst {MEM_INTERFACE_SCALE_FACTOR} -parameters {IO MIN}]
339
                set scale_factors(emif) [expr $emif_max_scale_factor - $emif_min_scale_factor]
340
 
341
                #######################################
342
                # Write Analysis
343
 
344
                hps_sdram_p0_perform_flexible_write_launch_timing_analysis $opcs $opcname $inst $family scale_factors $interface_type $max_package_skew $dll_length $period pins t summary MP IP board
345
 
346
                #######################################
347
                # Read Analysis
348
 
349
                hps_sdram_p0_perform_flexible_read_capture_timing_analysis $opcs $opcname $inst $family scale_factors $io_std $interface_type $max_package_skew $dqs_phase $period $all_dq_pins pins t summary MP IP board fpga
350
 
351
                #######################################
352
                # PHY and Address/command Analyses
353
 
354
                hps_sdram_p0_perform_ac_analyses  $opcs $opcname $inst scale_factors pins t summary IP
355
                hps_sdram_p0_perform_phy_analyses $opcs $opcname $inst $inst_controller pins t summary IP
356
 
357
 
358
                #######################################
359
                # Bus Turnaround Time Analysis
360
                hps_sdram_p0_perform_flexible_bus_turnaround_time_analysis $opcs $opcname $inst $family $period $dll_length $interface_type $tJITper $tJITdty $tDCD $pll_steps pins t summary MP IP SSN board ISI
361
 
362
 
363
                #######################################
364
                # Postamble analysis
365
                hps_sdram_p0_perform_flexible_postamble_timing_analysis $opcs $opcname $inst scale_factors $family $period $dll_length $interface_type $tJITper $tJITdty $tDCD $DQSpathjitter pins t summary MP IP SSN board ISI
366
 
367
        }
368
 
369
        #################################################
370
        # Now perform analysis of some of the calibrated paths that consider
371
        # Worst-case conditions 
372
 
373
        set opcname "All Conditions"
374
 
375
        #######################################
376
        # Print out the Summary Panel for this instance 
377
 
378
        set summary [lsort -command hps_sdram_p0_sort_proc $summary]
379
 
380
        set f -1
381
        if { [hps_sdram_p0_get_operating_conditions_number] == 0 } {
382
                set f [open $fname w]
383
 
384
                puts $f "Core: ${::GLOBAL_hps_sdram_p0_corename} - Instance: $inst"
385
                puts $f "Path, Setup Margin, Hold Margin"
386
        } else {
387
                set f [open $fname a]
388
        }
389
 
390
 
391
 
392
 
393
        post_message -type info "Core: ${::GLOBAL_hps_sdram_p0_corename} - Instance: $inst"
394
        post_message -type info "                                                         setup  hold"
395
        set panel_name "$inst"
396
        set root_folder_name [get_current_timequest_report_folder]
397
        if { ! [string match "${root_folder_name}*" $panel_name] } {
398
                set panel_name "${root_folder_name}||$panel_name"
399
        }
400
        # Create the root if it doesn't yet exist
401
        if {[get_report_panel_id $root_folder_name] == -1} {
402
                set panel_id [create_report_panel -folder $root_folder_name]
403
        }
404
        # Delete any pre-existing summary panel
405
        set panel_id [get_report_panel_id $panel_name]
406
        if {$panel_id != -1} {
407
                delete_report_panel -id $panel_id
408
        }
409
 
410
        # Create summary panel
411
        set total_failures 0
412
        set rows [list]
413
        lappend rows "add_row_to_table -id \$panel_id \[list \"Path\" \"Operating Condition\" \"Setup Slack\" \"Hold Slack\"\]"
414
        foreach summary_line $summary {
415
                foreach {corner order path su hold num_su num_hold} $summary_line { }
416
                if {($num_su == 0) || ([string trim $su] == "")} {
417
                        set su "--"
418
                }
419
                if {($num_hold == 0) || ([string trim $hold] == "")} {
420
                        set hold "--"
421
                }
422
 
423
 
424
                if { ($su != "--" && $su < 0) || ($hold != "--" && $hold < 0) } {
425
                        incr total_failures
426
                        set type warning
427
                        set offset 50
428
                } else {
429
                        set type info
430
                        set offset 53
431
                }
432
                if {$su != "--"} {
433
                        set su [ hps_sdram_p0_round_3dp $su]
434
                }
435
                if {$hold != "--"} {
436
                        set hold [ hps_sdram_p0_round_3dp $hold]
437
                }
438
                post_message -type $type [format "%-${offset}s | %6s %6s" $path $su $hold]
439
                puts $f [format "\"%s\",%s,%s" $path $su $hold]
440
                set fg_colours [list black black]
441
                if { $su != "--" && $su < 0 } {
442
                        lappend fg_colours red
443
                } else {
444
                        lappend fg_colours black
445
                }
446
 
447
                if { $hold != "" && $hold < 0 } {
448
                        lappend fg_colours red
449
                } else {
450
                        lappend fg_colours black
451
                }
452
                lappend rows "add_row_to_table -id \$panel_id -fcolors \"$fg_colours\" \[list \"$path\" \"$corner\" \"$su\" \"$hold\"\]"
453
        }
454
        close $f
455
        if {$total_failures > 0} {
456
                post_message -type critical_warning "DDR Timing requirements not met"
457
                set panel_id [create_report_panel -table $panel_name -color red]
458
        } else {
459
                set panel_id [create_report_panel -table $panel_name]
460
        }
461
        foreach row $rows {
462
                eval $row
463
        }
464
 
465
        write_timing_report
466
 
467
 
468
        incr inst_id
469
}
470
 
471
set_active_clocks $old_active_clocks
472
uninitialize_sin
473
uninitialize_ioo

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.