max80.sdc 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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_out_clk [get_clocks {pll|*|clk[0]}]
  15. set sdram_clk [get_clocks {pll|*|clk[4]}]
  16. set sys_clk [get_clocks {pll|*|clk[1]}]
  17. set vid_clk [get_clocks {pll|*|clk[2]}]
  18. set flash_clk [get_clocks {pll|*|clk[3]}]
  19. set main_clocks [get_clocks {pll|*}]
  20. # Reset isn't actually a clock, but Quartus thinks it is
  21. create_generated_clock -name rst_n \
  22. -source [get_nets {pll|*|*clk[1]}] \
  23. [get_registers rst_n]
  24. # Reset is asynchronous with everything as far as we are concerned.
  25. set_clock_groups -asynchronous \
  26. -group $main_clocks \
  27. -group [get_clocks rst_n]
  28. # Anything that feeds into a synchronizer is by definition
  29. # asynchronous, but encode it as allowing multicycle of one
  30. # clock, to limit the possible skew (but it is of course not possible
  31. # to eliminate it...)
  32. set synchro_inputs [get_registers *|synchronizer:*|qreg0*]
  33. set_multicycle_path -from [all_clocks] -to $synchro_inputs \
  34. -start -setup 2
  35. set_multicycle_path -from [all_clocks] -to $synchro_inputs \
  36. -start -hold 1
  37. # -------- SDRAM I/O constraints --------
  38. set sr_data_out [remove_from_collection [get_ports sr_*] sr_clk]
  39. set sr_data_in [get_ports sr_dq\[*\]]
  40. set_max_skew -to $sr_data_out 0.100ns
  41. set_input_delay -clock $sdram_clk 0.500ns $sr_data_in
  42. set_multicycle_path -from $sdram_clk -to $sdram_out_clk \
  43. -start -setup 2
  44. set_multicycle_path -from $sdram_clk -to $sdram_out_clk \
  45. -start -hold 0
  46. # -------- SDRAM multicycle paths (ready is retarded) --------
  47. set_multicycle_path -from [get_registers {dram_port:cpu_dram_port|rd[*]}] \
  48. -to $sys_clk -setup 2
  49. set_multicycle_path -from [get_registers {dram_port:cpu_dram_port|rd[*]}] \
  50. -to $sys_clk -hold 2
  51. # -------- SPI ROM multicycle paths --------
  52. # the load of the spi_data_ctr register happens no less than 2 target
  53. # clocks after datalen is loaded by the CPU
  54. set_multicycle_path -from [get_registers {spirom:*|datalen[*]}] \
  55. -to [get_registers {spirom:*|spi_data_ctr[*]}] -end -setup 2
  56. set_multicycle_path -from [get_registers {spirom:*|datalen[*]}] \
  57. -to [get_registers {spirom:*|spi_data_ctr[*]}] -end -hold 1
  58. # A load of romstart does not affect spi_cmd for a minimum of 3 target
  59. # clock cycles (in reality much more, since the CPU needs to
  60. # write datalen in order to start the transfer)
  61. set_multicycle_path -from [get_registers {spirom:*|romstart[*]}] \
  62. -to [get_registers {spirom:*|spi_cmd[*]}] -end -setup 3
  63. set_multicycle_path -from [get_registers {spirom:*|romstart[*]}] \
  64. -to [get_registers {spirom:*|spi_cmd[*]}] -end -hold 2
  65. # CS# going low to spi_clk_en is a minimum of one clock cycle, which allows
  66. # an extra clock cycle before spi_cmd needs to stop resetting
  67. set_multicycle_path -from [get_registers {spirom:*|spi_cs_n}] \
  68. -to [get_registers {spirom:*|spi_cmd[*]}] -end -setup 2
  69. set_multicycle_path -from [get_registers {spirom:*|spi_cs_n}] \
  70. -to [get_registers {spirom:*|spi_cmd[*]}] -end -hold 1
  71. # -------- CPU/fastmem multicycle paths --------
  72. # We never read and write in the same clock cycle, thus there is a multicycle
  73. # path from the write enable register to anything in the CPU itself
  74. set_multicycle_path -from [get_keepers {fast_mem:fast_mem|*porta_we_reg*}] \
  75. -to [get_keepers {picorv32:cpu|*}] -start -setup 2
  76. set_multicycle_path -from [get_keepers {fast_mem:fast_mem|*porta_we_reg*}] \
  77. -to [get_keepers {picorv32:cpu|*}] -start -hold 1