prod2u_p4_normal_v3.tcl 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import_device ef2_4.db -package EF2L45BG256B
  2. set_param rtl directive:async_reg on
  3. set_param place async_reg on
  4. analyze -file {src/rtl/uart_rx_8n1.v}
  5. analyze -file {src/rtl/uart_tx_8n1.v}
  6. analyze -file {src/rtl/binary921_crc16.v}
  7. analyze -file {src/rtl/binary921_frame_tx.v}
  8. analyze -file {src/rtl/prod2u_por.v}
  9. analyze -file {src/rtl/prod2u_p4_us_tick.v}
  10. analyze -file {src/rtl/prod2u_p4_normal_v3_rx.v}
  11. analyze -file {src/rtl/prod2u_p4_normal_v3_output_state.v}
  12. analyze -file {src/rtl/prod2u_p4_normal_v3_watchdog.v}
  13. analyze -file {src/rtl/prod2u_p4_axis_executor.v}
  14. analyze -file {src/rtl/prod2u_p4_motor_hub.v}
  15. analyze -file {src/rtl/prod2u_p4_response_scheduler.v}
  16. analyze -file {src/rtl/prod2u_p4_i2c_stop_start_read.v}
  17. analyze -file {src/rtl/prod2u_p4_temperature_read.v}
  18. analyze -file {src/rtl/prod2u_p4_temperature_store.v}
  19. analyze -file {src/rtl/prod2u_p4_temperature_short_tx.v}
  20. analyze -file {src/rtl/prod2u_p4_normal_v3_tx.v}
  21. analyze -file {src/rtl/prod2u_p4_pwm_outputs.v}
  22. analyze -file {src/rtl/prod2u_p4_normal_v3_core.v}
  23. analyze -file {src/top/prod2u_p4_normal_v3_top.v}
  24. elaborate -top {prod2u_p4_normal_v3_top}
  25. read_adc {constraints/prod2u_p4_normal_v3.adc}
  26. read_sdc {constraints/prod2u_p4_normal_v3.sdc}
  27. optimize_rtl
  28. proc p4_find_unique_regs {patterns} {
  29. set matches {}
  30. foreach pattern $patterns {
  31. foreach reg [get_regs -quiet $pattern] {
  32. if {[lsearch -exact $matches $reg] < 0} {
  33. lappend matches $reg
  34. }
  35. }
  36. }
  37. return $matches
  38. }
  39. set cdc_groups {
  40. u_uart_rx/rx_sync_pipe[0] {{u_uart_rx/rx_sync_pipe[0]} {*/u_uart_rx/rx_sync_pipe[0]}}
  41. u_uart_rx/rx_sync_pipe[1] {{u_uart_rx/rx_sync_pipe[1]} {*/u_uart_rx/rx_sync_pipe[1]}}
  42. u_temperature_i2c/scl_sync[0] {{u_temperature_i2c/scl_sync[0]} {*/u_temperature_i2c/scl_sync[0]}}
  43. u_temperature_i2c/scl_sync[1] {{u_temperature_i2c/scl_sync[1]} {*/u_temperature_i2c/scl_sync[1]}}
  44. u_temperature_i2c/sda_sync[0] {{u_temperature_i2c/sda_sync[0]} {*/u_temperature_i2c/sda_sync[0]}}
  45. u_temperature_i2c/sda_sync[1] {{u_temperature_i2c/sda_sync[1]} {*/u_temperature_i2c/sda_sync[1]}}
  46. }
  47. set cdc_report [open {prod2u_p4_normal_v3_cdc.rpt} w]
  48. puts $cdc_report {schema=prod2u-p4-normal-v3-cdc-v2}
  49. set cdc_failures {}
  50. set cdc_regs {}
  51. array set cdc_actual_by_normalized {}
  52. foreach {normalized patterns} $cdc_groups {
  53. set matches [p4_find_unique_regs $patterns]
  54. if {[llength $matches] != 1} {
  55. set reason "retained_sync_register_count:$normalized:[llength $matches]"
  56. lappend cdc_failures $reason
  57. puts $cdc_report "structural_failure=$reason"
  58. } else {
  59. set reg [lindex $matches 0]
  60. set cdc_actual_by_normalized($normalized) $reg
  61. lappend cdc_regs $reg
  62. puts $cdc_report "retained_sync_register=$normalized"
  63. }
  64. }
  65. if {[llength $cdc_regs] != 6} {
  66. set reason "retained_sync_register_total:[llength $cdc_regs]"
  67. lappend cdc_failures $reason
  68. puts $cdc_report "structural_failure=$reason"
  69. }
  70. if {[llength $cdc_regs] > 0} {
  71. set_property async_reg true $cdc_regs
  72. }
  73. set cdc_input_pairs {
  74. host_uart_rx u_uart_rx/rx_sync_pipe[0]
  75. temp_scl u_temperature_i2c/scl_sync[0]
  76. temp_sda u_temperature_i2c/sda_sync[0]
  77. }
  78. set cdc_false_path_pairs {}
  79. foreach {source_port normalized} $cdc_input_pairs {
  80. set source_matches [get_ports -quiet $source_port]
  81. if {[llength $source_matches] != 1} {
  82. set reason "asynchronous_input_port_count:$source_port:[llength $source_matches]"
  83. lappend cdc_failures $reason
  84. puts $cdc_report "structural_failure=$reason"
  85. continue
  86. }
  87. set source [lindex $source_matches 0]
  88. if {[info exists cdc_actual_by_normalized($normalized)]} {
  89. set endpoint $cdc_actual_by_normalized($normalized)
  90. lappend cdc_false_path_pairs [list $source $endpoint]
  91. puts $cdc_report "false_path_endpoint=$normalized"
  92. } else {
  93. set reason "first_stage_endpoint_count:$source_port:$normalized:0"
  94. lappend cdc_failures $reason
  95. puts $cdc_report "structural_failure=$reason"
  96. }
  97. }
  98. close $cdc_report
  99. if {[llength $cdc_failures] == 0} {
  100. puts {CDC_GATE_PASS=1}
  101. } else {
  102. puts "CDC_GATE_FAIL=[llength $cdc_failures]"
  103. error "PROD2U_P4_NORMAL_V3_CDC_GATE_FAIL:[join $cdc_failures ,]"
  104. }
  105. report_area -file prod2u_p4_normal_v3_rtl.area
  106. export_db prod2u_p4_normal_v3_rtl.db
  107. set_param gate opt_area high
  108. set_param gate pack_effort high
  109. optimize_gate prod2u_p4_normal_v3_gate.area
  110. set phase_groups {
  111. x {{u_core/u_motors/u_x_axis/motion_phase*} {*/u_core/u_motors/u_x_axis/motion_phase*}}
  112. y {{u_core/u_motors/u_y_axis/motion_phase*} {*/u_core/u_motors/u_y_axis/motion_phase*}}
  113. }
  114. set fsm_report [open {prod2u_p4_normal_v3_fsm_encoding.rpt} w]
  115. puts $fsm_report {schema=prod2u-p4-normal-v3-fsm-encoding-v2}
  116. set fsm_failures {}
  117. foreach {axis patterns} $phase_groups {
  118. set matches {}
  119. set normalized_matches {}
  120. set phase_regexp [format {(u_core/u_motors/u_%s_axis/motion_phase\[[0-1]\])$} $axis]
  121. foreach candidate [p4_find_unique_regs $patterns] {
  122. if {[regexp $phase_regexp $candidate -> normalized]} {
  123. lappend matches $candidate
  124. if {[lsearch -exact $normalized_matches $normalized] < 0} {
  125. lappend normalized_matches $normalized
  126. }
  127. }
  128. }
  129. if {[llength $matches] != 2 || [llength $normalized_matches] != 2} {
  130. puts $fsm_report "motion_phase=${axis}:[llength $matches]:unknown"
  131. set reason "motion_phase_register_count:$axis:[llength $matches]:normalized:[llength $normalized_matches]"
  132. lappend fsm_failures $reason
  133. puts $fsm_report "structural_failure=$reason"
  134. } else {
  135. puts $fsm_report "motion_phase=${axis}:[llength $matches]:sequential"
  136. }
  137. }
  138. close $fsm_report
  139. if {[llength $fsm_failures] == 0} {
  140. puts {FSM_ENCODING_GATE_PASS=sequential}
  141. } else {
  142. puts "FSM_ENCODING_GATE_FAIL=[llength $fsm_failures]"
  143. error "PROD2U_P4_NORMAL_V3_FSM_ENCODING_GATE_FAIL:[join $fsm_failures ,]"
  144. }
  145. report_area -io_info -file prod2u_p4_normal_v3_gate.area
  146. report_qor -step gate -file prod2u_p4_normal_v3_gate.qor
  147. legalize_phy_inst
  148. export_db prod2u_p4_normal_v3_gate.db
  149. foreach cdc_false_path_pair $cdc_false_path_pairs {
  150. lassign $cdc_false_path_pair source endpoint
  151. set_false_path -from $source -to $endpoint
  152. }
  153. update_timing
  154. report_timing_summary -file prod2u_p4_normal_v3_gate.timing