x393  1.0
FPGAcodeforElphelNC393camera
x393_timing.tcl
Go to the documentation of this file.
1 #################################################################################
2 # Filename: x393_timing.tcl
3 # Date:2016-03-28
4 # Author: Andrey Filippov
5 # Description: Timing constraints (selected by HISPI parameter in system_defines.vh)
6 #
7 # Copyright (c) 2016 Elphel, Inc.
8 # x393_timing.tcl is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # x393_timing.tcl is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/> .
20 #
21 # Additional permission under GNU GPL version 3 section 7:
22 # If you modify this Program, or any covered work, by linking or combining it
23 # with independent modules provided by the FPGA vendor only (this permission
24 # does not extend to any 3-rd party modules, "soft cores" or macros) under
25 # different license terms solely for the purpose of generating binary "bitstream"
26 # files and/or simulating the code, the copyright holders of this Program give
27 # you the right to distribute the covered work without those independent modules
28 # as long as the source code for them is available from the FPGA vendor free of
29 # charge, and there is no dependence on any encrypted modules for simulating of
30 # the combined code. This permission applies to you if the distributed code
31 # contains all the components and scripts required to completely simulate it
32 # with at least one of the Free Software programs.
33 #################################################################################
34 cd ~/vdt/x393
35 set infile [open "system_defines.vh" r]
36 set HISPI 0
37 while { [gets $infile line] >= 0 } {
38  if { [regexp {(.*)`define(\s*)HISPI} $line matched prematch] } {
39  if {[regexp "//" $prematch] != 0} { continue}
40  set HISPI 1
41  break
42  }
43 }
44 close $infile
45 if { $HISPI} {
46  puts "using HISPI sensors"
47 } else {
48  puts "using parallel sensors"
49 }
50 
51 
52 create_clock -name axi_aclk -period 20 [get_nets -hierarchical *axi_aclk]
53 
54 create_generated_clock -name ddr3_sdclk [get_nets -hierarchical sdclk_pre]
55 create_generated_clock -name ddr3_clk [get_nets -hierarchical clk_pre]
56 create_generated_clock -name ddr3_clk_div [get_nets -hierarchical clk_div_pre]
57 create_generated_clock -name ddr3_mclk [get_nets -hierarchical mclk_pre]
58 create_generated_clock -name ddr3_clk_ref [get_nets clocks393_i/dly_ref_clk_pre]
59 create_generated_clock -name axihp_clk [get_nets clocks393_i/hclk_pre]
60 create_generated_clock -name xclk [get_nets clocks393_i/xclk_pre]
61 #clock for inter - camera synchronization and event logger
62 create_generated_clock -name sclk [get_nets clocks393_i/sync_clk_pre]
63 create_clock -name ffclk0 -period 41.667 [get_ports {ffclk0p}]
64 
65 #Generated clocks are assumed to be tied to clkin1 (not 2), so until external ffclk0 is constrained, derivative clocks are not generated
66 create_generated_clock -name pclk [get_nets clocks393_i/dual_clock_pclk_i/clk1x_pre]
67 if ($HISPI) {
68  set_property CLOCK_DEDICATED_ROUTE FALSE [get_nets sensors393_i/sensor_channel_block\[0\].sensor_channel_i/sens_10398_i/sens_hispi12l4_i/sens_hispi_clock_i/clk_in]
69  set_property CLOCK_DEDICATED_ROUTE FALSE [get_nets sensors393_i/sensor_channel_block\[1\].sensor_channel_i/sens_10398_i/sens_hispi12l4_i/sens_hispi_clock_i/clk_in]
70  set_property CLOCK_DEDICATED_ROUTE FALSE [get_nets sensors393_i/sensor_channel_block\[2\].sensor_channel_i/sens_10398_i/sens_hispi12l4_i/sens_hispi_clock_i/clk_in]
71  set_property CLOCK_DEDICATED_ROUTE FALSE [get_nets sensors393_i/sensor_channel_block\[3\].sensor_channel_i/sens_10398_i/sens_hispi12l4_i/sens_hispi_clock_i/clk_in]
72 
73 } else {
74  #Sensor-synchronous clocks
75  create_generated_clock -name iclk0 [get_nets sensors393_i/sensor_channel_block\[0\].sensor_channel_i/sens_parallel12_i/ipclk_pre]
76  create_generated_clock -name iclk2x0 [get_nets sensors393_i/sensor_channel_block\[0\].sensor_channel_i/sens_parallel12_i/ipclk2x_pre]
77 
78  create_generated_clock -name iclk1 [get_nets sensors393_i/sensor_channel_block\[1\].sensor_channel_i/sens_parallel12_i/ipclk_pre]
79  create_generated_clock -name iclk2x1 [get_nets sensors393_i/sensor_channel_block\[1\].sensor_channel_i/sens_parallel12_i/ipclk2x_pre]
80 
81  create_generated_clock -name iclk2 [get_nets sensors393_i/sensor_channel_block\[2\].sensor_channel_i/sens_parallel12_i/ipclk_pre]
82  create_generated_clock -name iclk2x2 [get_nets sensors393_i/sensor_channel_block\[2\].sensor_channel_i/sens_parallel12_i/ipclk2x_pre]
83 
84  create_generated_clock -name iclk3 [get_nets sensors393_i/sensor_channel_block\[3\].sensor_channel_i/sens_parallel12_i/ipclk_pre]
85  create_generated_clock -name iclk2x3 [get_nets sensors393_i/sensor_channel_block\[3\].sensor_channel_i/sens_parallel12_i/ipclk2x_pre]
86 
87  set_clock_groups -name sensor0_clocks_iclk_pclk2x -asynchronous -group {iclk0 iclk2x0}
88  set_clock_groups -name sensor1_clocks_iclk_pclk2x -asynchronous -group {iclk1 iclk2x1}
89  set_clock_groups -name sensor2_clocks_iclk_pclk2x -asynchronous -group {iclk2 iclk2x2}
90  set_clock_groups -name sensor3_clocks_iclk_pclk2x -asynchronous -group {iclk3 iclk2x3}
91 }
92 
93 set_clock_groups -name compressor_clocks_xclk_xclk2x -asynchronous -group {xclk }
94 set_clock_groups -name sensor_clocks_pclk_pclk2x -asynchronous -group {pclk}
95 set_clock_groups -name sync_logger_clocks_sclk -asynchronous -group {sclk }
96 
97 # do not check timing between axi_aclk and other clocks. Code should provide correct asynchronous crossing of the clock boundary.
98 set_clock_groups -name ps_async_clock -asynchronous -group {axi_aclk}
99 set_clock_groups -name ps_async_clock_axihp -asynchronous -group {axihp_clk}
100 
101 set_clock_groups -name external_clock_ffclk0 -asynchronous -group {ffclk0}