memclk.tcl_NEW 24.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443
#
#  memclk.tcl
#
#   Ver1.0  Mar.01.2003  H.Terai
#
#
#################################
# MEMCLK (200MHz from PLL)      #
#################################
create_clock \
 -name MEMCLK \
 -period 4.9 \
 -waveform [ list 0.0 2.45 ] \
 [ get_pins pllx2/CLKOA ]

set_propagated_clock \
 [ get_clocks MEMCLK ]


# PLL Offset/Jitter ( ABPLSSCH Specification ) -------------------
####set offset_minus 0.060
####set offset_plus  0.120
####set jitter_minus 0.100
####set jitter_plus  0.100

# Disalble Timing Arc from lib -----------------------------------
set_disable_timing -from ATBI0 -to CLKOA analog/ABPLSSCH
set_disable_timing -from ATBI0 -to CLKOB analog/ABPLSSCH
set_disable_timing -from ATBI0 -to CLKOC analog/ABPLSSCH


# Get delay from PAD_SYSCLK to pllx2/RCLK ------------------------

   set in_to_pll_path_max \
     [ get_timing_paths \
          -from [get_ports PAD_SYSCLK] \
          -to [get_pins pllx2/RCLK] \
          -delay max_rise \
     ]

   set indelay_pll_max \
     [ get_attribute $in_to_pll_path_max arrival ]

   set in_to_pll_path_min \
     [ get_timing_paths \
          -from [get_ports PAD_SYSCLK] \
          -to [get_pins pllx2/RCLK] \
          -delay min_rise \
     ]

   set indelay_pll_min \
     [ get_attribute $in_to_pll_path_min arrival ]


# Get delay from pllx2/CLKOA to pllx2/CLKI -----------------------
# PLL adjusts phase of RCLK and CLKI -----------------------------

   set feedback_pll_path_max \
     [ get_timing_paths \
          -from [get_pins pllx2/CLKOA] \
          -to [get_pins pllx2/CLKI] \
          -delay max_rise \
     ]

   set pll_feedback_delay_max \
     [ get_attribute $feedback_pll_path_max arrival ]

   set_clock_latency -source -late \
     [ expr $indelay_pll_max - $pll_feedback_delay_max  ] \
     [ get_clocks MEMCLK ]



   set feedback_pll_path_min \
     [ get_timing_paths \
          -from [get_pins pllx2/CLKOA] \
          -to [get_pins pllx2/CLKI] \
          -delay min_rise \
     ]

   set pll_feedback_delay_min \
     [ get_attribute $feedback_pll_path_min arrival ]

   set_clock_latency -source -early \
     [ expr $indelay_pll_min - $pll_feedback_delay_min ] \
     [ get_clocks MEMCLK ]



#
#  ddr diff clock to pins;
#  memclk -> buf -> ( buf -> io -> pin, inv -> io -> pin );
#  tap off memclk tree only once to eliminate memclk tree skew;
#  dont_touch all involved cells and wires;
#  PAD_* and pad_* are already dont_touch above;
# 


   set memclk_latency_max 100000
   foreach_in_collection cur_path \
       [ get_timing_paths -nworst 10000 -max_paths 10000 \
         -from MEMCLK \
         -to   [ get_pins ddr_do*reg*/H02 ] \
         -delay max_rise \
       ] {
           set cur_delay [ get_attribute $cur_path arrival   ]
           set cur_end   [ get_attribute $cur_path endpoint  ]
           set cur_name  [ get_attribute $cur_end  full_name ]
           echo [ format "%s : %s" $cur_name $cur_delay ]
           if {$cur_delay < $memclk_latency_max} { set memclk_latency_max $cur_delay }

   }
   echo [ format "memclk_latency_max : %s" $memclk_latency_max ]


   set memclk_latency_min 0
   foreach_in_collection cur_path \
       [ get_timing_paths -nworst 10000 -max_paths 10000 \
         -from MEMCLK \
         -to   [ get_pins ddr_do*reg*/H02 ] \
         -delay min_rise \
       ] {
           set cur_delay [ get_attribute $cur_path arrival   ]
           set cur_end   [ get_attribute $cur_path endpoint  ]
           set cur_name  [ get_attribute $cur_end  full_name ]
           echo [ format "%s : %s" $cur_name $cur_delay ]
           if {$cur_delay > $memclk_latency_min} { set memclk_latency_min $cur_delay }

   }
   echo [ format "memclk_latency_min : %s" $memclk_latency_min ]


set_max_delay [ expr 1.3 + $memclk_latency_max ] -from MEMCLK -to [list PAD_MCLK0 PAD_MCLK1]
set_min_delay [ expr 1.1 + $memclk_latency_min ] -from MEMCLK -to [list PAD_MCLK0 PAD_MCLK1]


#/*
# * create virtual clock at DDR chip;
# * delayed by t[out] + board delay of 1/4 memclk;
# * set to uncertainty of memclk;
# */
create_clock -name DDRCLK -period 4.9 -waveform [list 2.25 4.5] 
set_clock_uncertainty 0.490 DDRCLK


#/*
# * ddr address/ctrl path;
# * single-data rate, outputs synchronous to MEMCLK;
# * remember that DDR sees delayed clock;
# */
set_output_delay 2.6 -clock DDRCLK -max [get_ports PAD_MBANK*]
set_output_delay 2.6 -clock DDRCLK -max [get_ports PAD_MADDR*]
set_output_delay 2.6 -clock DDRCLK -max [list PAD_MRAS PAD_MCAS PAD_MWE PAD_MCKE]


#/*
# * ddr output data path;
# * double-date rate, synchronous to MEMCLK;
# * remember that DDR sees delayed clock;
# * strobes have board delays to center data;
# */
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA0
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA1
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA2
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA3
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA4
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA5
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA6
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA7
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA8
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA9
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA10
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA11
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA12
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA13
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA14
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA15
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA16
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA17
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA18
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA19
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA20
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA21
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA22
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA23
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA24
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA25
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA26
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA27
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA28
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA29
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA30
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDATA31
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDQM0
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDQM1
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDQM2
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDQM3

set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDQS0
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDQS1
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDQS2
set_min_delay [ expr 1.2 + $memclk_latency_min ] -from MEMCLK -to PAD_MDQS3
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from ddr_wr_n_reg -to PAD_MDQS0
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from ddr_wr_n_reg -to PAD_MDQS1
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from ddr_wr_n_reg -to PAD_MDQS2
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from ddr_wr_n_reg -to PAD_MDQS3

set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_0_ ddr_do_n_reg_0_] -to PAD_MDATA0
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_1_ ddr_do_n_reg_1_] -to PAD_MDATA1
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_2_ ddr_do_n_reg_2_] -to PAD_MDATA2
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_3_ ddr_do_n_reg_3_] -to PAD_MDATA3
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_4_ ddr_do_n_reg_4_] -to PAD_MDATA4
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_5_ ddr_do_n_reg_5_] -to PAD_MDATA5
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_6_ ddr_do_n_reg_6_] -to PAD_MDATA6
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_7_ ddr_do_n_reg_7_] -to PAD_MDATA7
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_8_ ddr_do_n_reg_8_] -to PAD_MDATA8
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_9_ ddr_do_n_reg_9_] -to PAD_MDATA9
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_10_ ddr_do_n_reg_10_] -to PAD_MDATA10
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_11_ ddr_do_n_reg_11_] -to PAD_MDATA11
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_12_ ddr_do_n_reg_12_] -to PAD_MDATA12
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_13_ ddr_do_n_reg_13_] -to PAD_MDATA13
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_14_ ddr_do_n_reg_14_] -to PAD_MDATA14
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_15_ ddr_do_n_reg_15_] -to PAD_MDATA15
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_16_ ddr_do_n_reg_16_] -to PAD_MDATA16
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_17_ ddr_do_n_reg_17_] -to PAD_MDATA17
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_18_ ddr_do_n_reg_18_] -to PAD_MDATA18
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_19_ ddr_do_n_reg_19_] -to PAD_MDATA19
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_20_ ddr_do_n_reg_20_] -to PAD_MDATA20
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_21_ ddr_do_n_reg_21_] -to PAD_MDATA21
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_22_ ddr_do_n_reg_22_] -to PAD_MDATA22
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_23_ ddr_do_n_reg_23_] -to PAD_MDATA23
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_24_ ddr_do_n_reg_24_] -to PAD_MDATA24
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_25_ ddr_do_n_reg_25_] -to PAD_MDATA25
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_26_ ddr_do_n_reg_26_] -to PAD_MDATA26
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_27_ ddr_do_n_reg_27_] -to PAD_MDATA27
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_28_ ddr_do_n_reg_28_] -to PAD_MDATA28
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_29_ ddr_do_n_reg_29_] -to PAD_MDATA29
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_30_ ddr_do_n_reg_30_] -to PAD_MDATA30
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_do_p_reg_31_ ddr_do_n_reg_31_] -to PAD_MDATA31
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_dqm_p_reg_0_ ddr_dqm_n_reg_0_] -to PAD_MDQM0
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_dqm_p_reg_1_ ddr_dqm_n_reg_1_] -to PAD_MDQM1
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_dqm_p_reg_2_ ddr_dqm_n_reg_2_] -to PAD_MDQM2
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from [list ddr_dqm_p_reg_3_ ddr_dqm_n_reg_3_] -to PAD_MDQM3

set_min_delay [ expr 1.4 + $memclk_latency_min ] -from ddr_moe_reg_0_ -to [list PAD_MDATA0 PAD_MDATA1 PAD_MDATA2 PAD_MDATA3 PAD_MDQS0]
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from ddr_moe_reg_1_ -to [list PAD_MDATA4 PAD_MDATA5 PAD_MDATA6 PAD_MDATA7]
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from ddr_moe_reg_2_ -to [list PAD_MDATA8 PAD_MDATA9 PAD_MDATA10 PAD_MDATA11 PAD_MDQS1]
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from ddr_moe_reg_3_ -to [list PAD_MDATA12 PAD_MDATA13 PAD_MDATA14 PAD_MDATA15]
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from ddr_moe_reg_4_ -to [list PAD_MDATA16 PAD_MDATA17 PAD_MDATA18 PAD_MDATA19 PAD_MDQS2]
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from ddr_moe_reg_5_ -to [list PAD_MDATA20 PAD_MDATA21 PAD_MDATA22 PAD_MDATA23]
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from ddr_moe_reg_6_ -to [list PAD_MDATA24 PAD_MDATA25 PAD_MDATA26 PAD_MDATA27 PAD_MDQS3]
set_min_delay [ expr 1.4 + $memclk_latency_min ] -from ddr_moe_reg_7_ -to [list PAD_MDATA28 PAD_MDATA29 PAD_MDATA30 PAD_MDATA31]

#/*
# * max delays;
# */
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA0
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA1
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA2
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA3
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA4
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA5
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA6
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA7
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA8
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA9
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA10
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA11
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA12
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA13
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA14
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA15
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA16
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA17
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA18
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA19
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA20
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA21
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA22
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA23
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA24
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA25
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA26
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA27
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA28
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA29
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA30
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDATA31
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDQM0
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDQM1
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDQM2
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDQM3

set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDQS0
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDQS1
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDQS2
set_max_delay [ expr 1.4 + $memclk_latency_max ] -from MEMCLK -to PAD_MDQS3
set_max_delay [ expr 2.0 + $memclk_latency_max ] -from ddr_wr_n_reg -to PAD_MDQS0
set_max_delay [ expr 2.0 + $memclk_latency_max ] -from ddr_wr_n_reg -to PAD_MDQS1
set_max_delay [ expr 2.0 + $memclk_latency_max ] -from ddr_wr_n_reg -to PAD_MDQS2
set_max_delay [ expr 2.0 + $memclk_latency_max ] -from ddr_wr_n_reg -to PAD_MDQS3

set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_0_ ddr_do_n_reg_0_] -to PAD_MDATA0
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_1_ ddr_do_n_reg_1_] -to PAD_MDATA1
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_2_ ddr_do_n_reg_2_] -to PAD_MDATA2
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_3_ ddr_do_n_reg_3_] -to PAD_MDATA3
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_4_ ddr_do_n_reg_4_] -to PAD_MDATA4
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_5_ ddr_do_n_reg_5_] -to PAD_MDATA5
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_6_ ddr_do_n_reg_6_] -to PAD_MDATA6
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_7_ ddr_do_n_reg_7_] -to PAD_MDATA7
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_8_ ddr_do_n_reg_8_] -to PAD_MDATA8
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_9_ ddr_do_n_reg_9_] -to PAD_MDATA9
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_10_ ddr_do_n_reg_10_] -to PAD_MDATA10
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_11_ ddr_do_n_reg_11_] -to PAD_MDATA11
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_12_ ddr_do_n_reg_12_] -to PAD_MDATA12
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_13_ ddr_do_n_reg_13_] -to PAD_MDATA13
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_14_ ddr_do_n_reg_14_] -to PAD_MDATA14
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_15_ ddr_do_n_reg_15_] -to PAD_MDATA15
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_16_ ddr_do_n_reg_16_] -to PAD_MDATA16
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_17_ ddr_do_n_reg_17_] -to PAD_MDATA17
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_18_ ddr_do_n_reg_18_] -to PAD_MDATA18
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_19_ ddr_do_n_reg_19_] -to PAD_MDATA19
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_20_ ddr_do_n_reg_20_] -to PAD_MDATA20
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_21_ ddr_do_n_reg_21_] -to PAD_MDATA21
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_22_ ddr_do_n_reg_22_] -to PAD_MDATA22
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_23_ ddr_do_n_reg_23_] -to PAD_MDATA23
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_24_ ddr_do_n_reg_24_] -to PAD_MDATA24
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_25_ ddr_do_n_reg_25_] -to PAD_MDATA25
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_26_ ddr_do_n_reg_26_] -to PAD_MDATA26
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_27_ ddr_do_n_reg_27_] -to PAD_MDATA27
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_28_ ddr_do_n_reg_28_] -to PAD_MDATA28
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_29_ ddr_do_n_reg_29_] -to PAD_MDATA29
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_30_ ddr_do_n_reg_30_] -to PAD_MDATA30
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_do_p_reg_31_ ddr_do_n_reg_31_] -to PAD_MDATA31
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_dqm_p_reg_0_ ddr_dqm_n_reg_0_] -to PAD_MDQM0
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_dqm_p_reg_1_ ddr_dqm_n_reg_1_] -to PAD_MDQM1
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_dqm_p_reg_2_ ddr_dqm_n_reg_2_] -to PAD_MDQM2
set_max_delay [ expr 1.6 + $memclk_latency_max ] -from [list ddr_dqm_p_reg_3_ ddr_dqm_n_reg_3_] -to PAD_MDQM3

set_max_delay [ expr 1.8 + $memclk_latency_max ] -from ddr_moe_reg_0_ -to [list PAD_MDATA0 PAD_MDATA1 PAD_MDATA2 PAD_MDATA3 PAD_MDQS0]
set_max_delay [ expr 1.8 + $memclk_latency_max ] -from ddr_moe_reg_1_ -to [list PAD_MDATA4 PAD_MDATA5 PAD_MDATA6 PAD_MDATA7]
set_max_delay [ expr 1.8 + $memclk_latency_max ] -from ddr_moe_reg_2_ -to [list PAD_MDATA8 PAD_MDATA9 PAD_MDATA10 PAD_MDATA11 PAD_MDQS1]
set_max_delay [ expr 1.8 + $memclk_latency_max ] -from ddr_moe_reg_3_ -to [list PAD_MDATA12 PAD_MDATA13 PAD_MDATA14 PAD_MDATA15]
set_max_delay [ expr 1.8 + $memclk_latency_max ] -from ddr_moe_reg_4_ -to [list PAD_MDATA16 PAD_MDATA17 PAD_MDATA18 PAD_MDATA19 PAD_MDQS2]
set_max_delay [ expr 1.8 + $memclk_latency_max ] -from ddr_moe_reg_5_ -to [list PAD_MDATA20 PAD_MDATA21 PAD_MDATA22 PAD_MDATA23]
set_max_delay [ expr 1.8 + $memclk_latency_max ] -from ddr_moe_reg_6_ -to [list PAD_MDATA24 PAD_MDATA25 PAD_MDATA26 PAD_MDATA27 PAD_MDQS3]
set_max_delay [ expr 1.8 + $memclk_latency_max ] -from ddr_moe_reg_7_ -to [list PAD_MDATA28 PAD_MDATA29 PAD_MDATA30 PAD_MDATA31]


#
# ddr input data path;
# double-date rate, synchronous to strobes;
# remember that DDR drives strobe like a data pin;
# delay on board centers strobes with regards to data;
#
# strobe clocks at bb;
# use clock uncertainty to describe tDQSCK (data/strobe jitter);
# clock phase is chosen to minimize ddr_mdin -> mdin paths;
# strobe-reversal on means inverted strobe clocks;
#
# create two virtual clocks to describe strobes;
# external virtual flop is clocked on both edges;
# must make opposite edges false paths;
#

#------------------------------------------------------


#=========================================================
#  Create clock : MDQS
#=========================================================

   create_clock \
   -name  MDQS \
   -period 4.9 \
   -waveform [ list 0.0 2.45 ] \
   [ get_ports PAD_MDQS* ]

#=========================================================
#  Set clock latency : MDQS (slow)
#
#  pllx2/CLKOA --> PAD_MCLK1/0   : mclk0_max
#  PAD_MCLK1/0 --> Memory-LSI    : 1.15 nS
#  Memory-LSI latency            : 1.00 nS (* temporary *)
#  Memory-LSI  --> PAD_MDQS3-0   : 1.25 nS
# --------------------------------------------------------
#  amount                        : mclk0_max + 3.40 nS
#=========================================================

   set mclk0_max_path \
     [ get_timing_paths \
          -from [ get_pins  pllx2/CLKOA ] \
          -to   [ get_ports PAD_MCLK0   ] \
          -delay max_fall \
     ]
   set mclk0_max [ get_attribute $mclk0_max_path arrival ]
   echo [ format "mclk0_max : %s" $mclk0_max ]
   set_clock_latency -source \
     [ expr $mclk0_max + 3.40 ] \
     [ get_clocks MDQS ]

#=========================================================
#  Set input delay for PAD_MDATA31-0 (slow)
#
#  pllx2/CLKOA --> PAD_MCLK1/0   : mclk0_max
#  PAD_MCLK1/0 --> Memory-LSI    : 1.15 nS
#  Memory-LSI latency            : 1.00 nS (* temporary *)
#  Memory-LSI  --> PAD_MDATA31-0 : 0.90 nS
# --------------------------------------------------------
#  amount                        : mclk0_max + 3.05 nS
#=========================================================

   set_input_delay [ expr $mclk0_max + 3.05 ] \
    -clock MDQS -max [get_ports PAD_MDATA*]

#=========================================================
#  Output Report 
#=========================================================

   reset_path     -from MDQS -to [get_cells ddr_mdin_n*]
   set_false_path -from MDQS -to [get_cells ddr_mdin_n*]
   reset_path     -from [get_cells ddr_mdin_p*] -to [get_cells mdin_p_reg*]
   set_false_path -from [get_cells ddr_mdin_p*] -to [get_cells mdin_p_reg*]
   report_timing  -max_paths 1000 -nworst 10 \
                  -from MDQS -to [ get_pins ddr_mdin_p*/* ]  > ddr_MDQS_MEMCLK_p.rep
   report_timing  -max_paths 1000 -nworst 10 \
                  -from MDQS -to [ get_pins mdin_n_reg*/* ] >> ddr_MDQS_MEMCLK_p.rep

   reset_path     -from MDQS -to [get_cells ddr_mdin_p*]
   set_false_path -from MDQS -to [get_cells ddr_mdin_p*]
   reset_path     -from [get_cells ddr_mdin_n*] -to [get_cells mdin_n_reg*]
   set_false_path -from [get_cells ddr_mdin_n*] -to [get_cells mdin_n_reg*]
   report_timing  -max_paths 1000 -nworst 10 \
                  -from MDQS -to [ get_pins ddr_mdin_n*/* ]  > ddr_MDQS_MEMCLK_n.rep
   report_timing  -max_paths 1000 -nworst 10 \
                  -from MDQS -to [ get_pins mdin_p_reg*/* ] >> ddr_MDQS_MEMCLK_n.rep

   reset_path     -from MDQS -to [get_cells ddr_mdin_n*]
   reset_path     -from [get_cells ddr_mdin_p*] -to [get_cells mdin_p_reg*]
   reset_path     -from MDQS -to [get_cells ddr_mdin_p*]
   reset_path     -from [get_cells ddr_mdin_n*] -to [get_cells mdin_n_reg*]