max80.sdc 4.4 KB

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