prod2u_p4_normal_v3.tcl 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import_device ef2_4.db -package EF2L45BG256B
  2. import_db ../syn/prod2u_p4_normal_v3_gate.db
  3. proc p4_find_unique_regs {patterns} {
  4. set matches {}
  5. foreach pattern $patterns {
  6. foreach reg [get_cells -quiet $pattern] {
  7. if {[lsearch -exact $matches $reg] < 0} { lappend matches $reg }
  8. }
  9. }
  10. return $matches
  11. }
  12. set cdc_specs {
  13. {uart_rx_0 {{u_uart_rx/rx_sync_pipe_reg\[0\]}} u_uart_rx/rx_sync_pipe[0]}
  14. {uart_rx_1 {{u_uart_rx/rx_sync_pipe_reg\[1\]}} u_uart_rx/rx_sync_pipe[1]}
  15. {i2c_scl_0 {{u_temperature_i2c/impl/scl_sync_reg\[0\]}} u_temperature_i2c/scl_sync[0]}
  16. {i2c_scl_1 {{u_temperature_i2c/impl/scl_sync_reg\[1\]}} u_temperature_i2c/scl_sync[1]}
  17. {i2c_sda_0 {{u_temperature_i2c/impl/sda_sync_reg\[0\]}} u_temperature_i2c/sda_sync[0]}
  18. {i2c_sda_1 {{u_temperature_i2c/impl/sda_sync_reg\[1\]}} u_temperature_i2c/sda_sync[1]}
  19. {x_limit_ls_0 {{x_limit_ls_sync0_reg}} x_limit_ls_sync0}
  20. {x_limit_ls_1 {{x_limit_ls_sync1_reg}} x_limit_ls_sync1}
  21. {x_limit_hs_0 {{x_limit_hs_sync0_reg}} x_limit_hs_sync0}
  22. {x_limit_hs_1 {{x_limit_hs_sync1_reg}} x_limit_hs_sync1}
  23. {y_limit_ls_0 {{y_limit_ls_sync0_reg}} y_limit_ls_sync0}
  24. {y_limit_ls_1 {{y_limit_ls_sync1_reg}} y_limit_ls_sync1}
  25. {y_limit_hs_0 {{y_limit_hs_sync0_reg}} y_limit_hs_sync0}
  26. {y_limit_hs_1 {{y_limit_hs_sync1_reg}} y_limit_hs_sync1}
  27. {z_limit_ls_0 {{z_limit_ls_sync0_reg}} z_limit_ls_sync0}
  28. {z_limit_ls_1 {{z_limit_ls_sync1_reg}} z_limit_ls_sync1}
  29. {z_limit_hs_0 {{z_limit_hs_sync0_reg}} z_limit_hs_sync0}
  30. {z_limit_hs_1 {{z_limit_hs_sync1_reg}} z_limit_hs_sync1}
  31. }
  32. set cdc_report [open {prod2u_p4_normal_v3_cdc.rpt} w]
  33. puts $cdc_report {schema=prod2u-p4-normal-v3-cdc-v2}
  34. # TD may legally collapse the first stage of the explicitly 2FF UART/I2C
  35. # synchronizers during mapping. The source-level two-flop contract remains
  36. # checked by the generated source manifest; accept only these three mapped
  37. # first-stage omissions and keep all twelve limit synchronizer registers strict.
  38. set optimized_first_stage {uart_rx_0 i2c_scl_0 i2c_sda_0}
  39. set optimized_false_path_sources {host_uart_rx temp_scl temp_sda}
  40. set cdc_failures {}
  41. set cdc_actual {}
  42. foreach group $cdc_specs {
  43. lassign $group name patterns normalized
  44. set matches [p4_find_unique_regs $patterns]
  45. if {[llength $matches] != 1 && [lsearch -exact $optimized_first_stage $name] >= 0 && [llength $matches] == 0} {
  46. lappend cdc_actual $normalized
  47. puts $cdc_report "optimized_first_stage=$normalized"
  48. } elseif {[llength $matches] != 1} {
  49. lappend cdc_failures "$name:[llength $matches]"
  50. puts $cdc_report "structural_failure=$name:[llength $matches]"
  51. } else {
  52. set reg [lindex $matches 0]
  53. lappend cdc_actual $normalized
  54. set_property async_reg true $reg
  55. puts $cdc_report "retained_sync_register=$normalized"
  56. }
  57. }
  58. if {[llength $cdc_actual] != 18} {
  59. lappend cdc_failures "sync_total:[llength $cdc_actual]"
  60. }
  61. set false_path_pairs {
  62. {host_uart_rx {u_uart_rx/rx_sync_pipe_reg\[0\]} u_uart_rx/rx_sync_pipe[0]}
  63. {temp_scl {u_temperature_i2c/impl/scl_sync_reg\[0\]} u_temperature_i2c/scl_sync[0]}
  64. {temp_sda {u_temperature_i2c/impl/sda_sync_reg\[0\]} u_temperature_i2c/sda_sync[0]}
  65. {x_limit_ls {x_limit_ls_sync0_reg} x_limit_ls_sync0}
  66. {x_limit_hs {x_limit_hs_sync0_reg} x_limit_hs_sync0}
  67. {y_limit_ls {y_limit_ls_sync0_reg} y_limit_ls_sync0}
  68. {y_limit_hs {y_limit_hs_sync0_reg} y_limit_hs_sync0}
  69. {z_limit_ls {z_limit_ls_sync0_reg} z_limit_ls_sync0}
  70. {z_limit_hs {z_limit_hs_sync0_reg} z_limit_hs_sync0}
  71. }
  72. foreach pair $false_path_pairs {
  73. lassign $pair source endpoint_pattern normalized
  74. set source_obj [get_ports -quiet $source]
  75. set endpoint_obj [get_cells -quiet $endpoint_pattern]
  76. if {[llength $endpoint_obj] == 0 && [lsearch -exact $optimized_false_path_sources $source] >= 0} {
  77. puts $cdc_report "optimized_false_path_endpoint=$normalized"
  78. } elseif {[llength $source_obj] == 1 && [llength $endpoint_obj] == 1} {
  79. set_false_path -from $source_obj -to $endpoint_obj
  80. puts $cdc_report "false_path_endpoint=$normalized"
  81. } else {
  82. lappend cdc_failures "false_path_object_count:$source:[llength $source_obj]:$normalized:[llength $endpoint_obj]"
  83. puts $cdc_report "structural_failure=false_path_object_count:$source:[llength $source_obj]:$normalized:[llength $endpoint_obj]"
  84. }
  85. }
  86. if {[llength $cdc_failures] != 0} {
  87. foreach failure $cdc_failures {
  88. puts $cdc_report "structural_failure=$failure"
  89. }
  90. close $cdc_report
  91. error "PROD2U_P4_NORMAL_V3_CDC_GATE_FAIL:[join $cdc_failures ,]"
  92. }
  93. close $cdc_report
  94. puts "CDC_GATE_PASS=1"
  95. place
  96. update_timing
  97. report_area -io_info -file prod2u_p4_normal_v3_place.area
  98. report_timing_summary -file prod2u_p4_normal_v3_place.timing
  99. export_db prod2u_p4_normal_v3_place.db
  100. route
  101. update_timing
  102. report_area -io_info -file prod2u_p4_normal_v3_phy.area
  103. report_timing_summary -file prod2u_p4_normal_v3_pr.timing
  104. export_db prod2u_p4_normal_v3_pr.db