2
0

max80.sdc 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # -*- tcl -*-
  2. # Clock constraints
  3. # Input master clock for all PLLs
  4. create_clock -name "clock_48" -period 20.834ns [get_ports {clock_48}]
  5. create_clock -name "clock_16" -period 62.500ns [get_ports {clock_16}]
  6. derive_pll_clocks
  7. # RTC clock; asynchronous with all others
  8. create_clock -name "rtc_32khz" -period 30517.578ns [get_ports {rtc_32khz}]
  9. set_clock_groups -asynchronous -group {rtc_32khz}
  10. # Automatically calculate clock uncertainty to jitter and other effects.
  11. derive_clock_uncertainty
  12. # Don't report signaltap clock problems...
  13. set_false_path -to [get_registers sld_signaltap:*]
  14. # -------- PLL clock mappings --------
  15. set master_clk [get_clocks {pll2|*|clk[0]}]
  16. set sdram_clk [get_clocks {*|pll3|*|clk[0]}]
  17. set sdram_out_clk [get_clocks {*|pll3|*|clk[1]}]
  18. set sys_clk [get_clocks {*|pll3|*|clk[2]}]
  19. set flash_clk [get_clocks {*|pll3|*|clk[3]}]
  20. set usb_clk [get_clocks {*|pll3|*|clk[4]}]
  21. set hdmi_clk [get_clocks {*|pll4|*|clk[0]}]
  22. set vid_clk [get_clocks {*|pll4|*|clk[1]}]
  23. set main_clocks [get_clocks {pll*|*|clk[*] *|pll*|*|clk[*]}]
  24. # Reset isn't actually a clock, but Quartus thinks it is
  25. create_generated_clock -name rst_n \
  26. -source [get_nets {*|pll3|*|*clk[2]}] \
  27. [get_registers *|rst_n]
  28. create_generated_clock -name hard_rst_n \
  29. -source [get_nets {*|pll3|*|*clk[2]}] \
  30. [get_registers *|hard_rst_n]
  31. # Reset is asynchronous with everything as far as we are concerned.
  32. set_clock_groups -asynchronous \
  33. -group $main_clocks \
  34. -group [get_clocks {rst_n hard_rst_n}]
  35. # Anything that feeds into a synchronizer is by definition
  36. # asynchronous, but encode it as allowing multicycle of one
  37. # clock, to limit the possible skew (but it is of course not possible
  38. # to eliminate it...)
  39. set synchro_inputs [get_registers *|synchronizer:*|qreg0*]
  40. set_multicycle_path -from [all_clocks] -to $synchro_inputs \
  41. -start -setup 2
  42. set_multicycle_path -from [all_clocks] -to $synchro_inputs \
  43. -start -hold 1
  44. # -------- SDRAM I/O constraints --------
  45. set sr_data_out [remove_from_collection [get_ports sr_*] sr_clk]
  46. set sr_data_in [get_ports {sr_dq[*]}]
  47. set_max_skew -to $sr_data_out 0.100ns
  48. set_input_delay -clock $sdram_clk 0.500ns $sr_data_in
  49. #set_multicycle_path -from $sdram_clk -to $sdram_out_clk \
  50. # -start -setup 2
  51. #set_multicycle_path -from $sdram_clk -to $sdram_out_clk \
  52. # -start -hold 0
  53. # -------- SDRAM multicycle paths --------
  54. # sdram_mem_ready is deferred by one sys_clk
  55. set cpu_dram_rd [get_registers {*|dram_port:cpu_dram_port|rd[*]}]
  56. set_multicycle_path -from $cpu_dram_rd -to $sys_clk -start -setup 2
  57. set_multicycle_path -from $cpu_dram_rd -to $sys_clk -start -hold 1
  58. # -------- SPI ROM multicycle paths --------
  59. # CPU-writable registers
  60. set romcopy_datalen [get_registers \
  61. {*|spirom:*|datalen[*] *|spirom:*|cmdlen[*] *|spirom:*|spi_dual *|spirom:*|spi_more *|spirom:*|is_*}]
  62. set romcopy_romcmd [get_registers {*|spirom:*|romcmd[*]}]
  63. set romcopy_ramstart [get_registers {*|spirom:*|ramstart[*]}]
  64. set romcopy_go [get_registers {*|spirom:*|go_* *|spirom:*|irq}]
  65. set romcopy_cpuregs [add_to_collection $romcopy_datalen $romcopy_romcmd]
  66. set romcopy_cpuregs [add_to_collection $romcopy_cpuregs $romcopy_ramstart]
  67. set romcopy_cpuregs [add_to_collection $romcopy_cpuregs $romcopy_go]
  68. # CPU writes to the spirom registers are delayed by one ram_clk
  69. set_multicycle_path -from $sys_clk -to $romcopy_cpuregs -end -setup 2
  70. set_multicycle_path -from $sys_clk -to $romcopy_cpuregs -end -hold 1
  71. # go_spi is delayed by the synchronizer, so other bits in the ROMCOPY_DATALEN
  72. # register have some more time to settle.
  73. set_multicycle_path -from $romcopy_datalen -to $flash_clk -end -setup 2
  74. set_multicycle_path -from $romcopy_datalen -to $flash_clk -end -hold 1
  75. # A load of romcmd does not affect the SPI unit for a minimum of 3 target
  76. # clock cycles (in reality much more, since the CPU needs to
  77. # write datalen in order to start the transfer).
  78. set_multicycle_path -from $romcopy_romcmd -to $flash_clk -end -setup 3
  79. set_multicycle_path -from $romcopy_romcmd -to $flash_clk -end -hold 2
  80. # spi_active to spi_clk_en is a minimum of one clock cycle, which allows
  81. # an extra clock cycle before spi_out_shr needs to stop resetting
  82. set spi_active [get_registers {*|spirom:*|spi_active}]
  83. set spi_out_shr [get_registers {*|spirom:*|spi_out_shr[*]}]
  84. set_multicycle_path -from $spi_active -to $spi_out_shr -end -setup 2
  85. set_multicycle_path -from $spi_active -to $spi_out_shr -end -hold 1
  86. # Reading ROMCOPY_INPUT while a transaction is pending is not supported.
  87. # The CPU is supposed to wait for IRQ to get asserted; this is extremely
  88. # conservative.
  89. set romcopy_input [get_registers {*|spirom:*|spi_in_shr[*]}]
  90. set_multicycle_path -from $romcopy_input -to $sys_clk -end -setup 2
  91. set_multicycle_path -from $romcopy_input -to $sys_clk -end -hold 1
  92. # -------- CPU/fastmem multicycle paths --------
  93. # We never read and write in the same clock cycle, thus there is a multicycle
  94. # path from the write enable register to anything in the CPU itself
  95. set fast_mem_we [get_keepers {*|fast_mem:fast_mem|*porta_we_reg*}]
  96. set cpu_regs [get_keepers {*|picorv32:cpu|*}]
  97. set_multicycle_path -from $fast_mem_we -to $cpu_regs -start -setup 2
  98. set_multicycle_path -from $fast_mem_we -to $cpu_regs -start -hold 1
  99. # -------- Random number generator pins are asynchronous --------
  100. set_false_path -from [get_ports {rngio[*]}] -to [get_keepers *]