{"id":560,"date":"2015-03-10T20:53:02","date_gmt":"2015-03-11T04:53:02","guid":{"rendered":"http:\/\/www.beyond-circuits.com\/wordpress\/?page_id=560"},"modified":"2016-08-12T14:45:06","modified_gmt":"2016-08-12T22:45:06","slug":"tutorial16","status":"publish","type":"page","link":"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial16\/","title":{"rendered":"Tutorial16: Static timing"},"content":{"rendered":"<p>When the synthesis and implementation tools run, they need to understand the <em>timing<\/em> of the design. At a minimum, this means the clock frequency that the design runs at. In most designs there will be more than one clock, so each clock needs to be specified, and the relationship between the clocks needs to be described. In addition, the timing information on input pins and output pins also needs to be communicated. This information is communicated in the form of <em>timing constraints<\/em> in an XDC file.<\/p>\n<h1>Getting Started<\/h1>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig1.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-562 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig1-300x163.png\" alt=\"tut16afig1\" width=\"300\" height=\"163\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig1-300x163.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig1-1024x556.png 1024w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig1-500x272.png 500w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig1.png 1329w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Go ahead and edit the stopwatch design from <a title=\"Tutorial 14 \u2013 Building an ARM FPGA\" href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial14\/\">tutorial 14<\/a>.\u00a0Run synthesis and open the synthesized design. Click on the <em>Edit Timing Constraints<\/em> flow in the <em>Flow Navigator<\/em>. This should bring up the Timing Constraints window, where you can view and edit timing constraints. The screen\u00a0should look like the figure to the right.<\/p>\n<p>You should see four timing constraints. Three of them will have little lock symbols next to them. The ones with the lock are generated by the IP Integrator when we built the ARM subsystem. You can see that one is the following:<\/p>\n<pre>create_clock -period 10.000 -name clk_fpga_0 [get_pins {PS7_i\/FCLKCLK[0]}]\r\n<\/pre>\n<p>This creates a clock constraint on the AXI logic outside the processor subsystem. Coincidentally, this happens to be the same period as the external clock we use on the <em>clk<\/em> input. In fact, we could make our lives much simpler if we removed the clock input altogether and just used the clock from the processor to run our stopwatch logic. But if we did that, we couldn&#8217;t talk about all kinds of interesting issues in this tutorial.<\/p>\n<p>Notice that we also see the clock constraint on the <em>clk\u00a0<\/em>input pin\u00a0that we put in our XDC file:<\/p>\n<pre>create_clock -period 10.000 [get_ports clk]<\/pre>\n<h2>\u00a0Running a timing report<\/h2>\n<p>Now, click on the <em>Report Timing Summary<\/em> flow in the <em>Synthesized Design<\/em>. This will bring up a <em>Report Timing Summary<\/em> dialog. Use the <img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-563 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig2-300x57.png\" alt=\"tut16afig2\" width=\"300\" height=\"57\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig2-300x57.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig2-1024x195.png 1024w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig2-500x95.png 500w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig2.png 1296w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/>default results name and click <strong><em>OK<\/em><\/strong>. You should see a timing summary panel open up that looks something like the figure to the right. You&#8217;ll probably\u00a0see some items in red. These are where timing failures exist. <a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig3.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-564 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig3-300x214.png\" alt=\"tut16afig3\" width=\"300\" height=\"214\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig3-300x214.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig3-1024x731.png 1024w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig3-420x300.png 420w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig3.png 1081w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Drill in to the Inter-Clock Paths entry. You&#8217;ll\u00a0see there are hold time violations on signals passing from the <em>clk_fpga_0<\/em> clock to the <em>clk<\/em> clock domain. In my design, there are seven failing paths and the total <em>hold slack<\/em> is -12.838ns. If you click on the red <em>Hold<\/em> line, you&#8217;ll see the seven failing paths to the right. Double-click on the first line to\u00a0bring up detailed information about that path. It should look something like the figure to the right.<\/p>\n<h2>Interpreting the results<\/h2>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig4.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-565 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig4-300x131.png\" alt=\"tut16afig4\" width=\"300\" height=\"131\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig4-300x131.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig4-500x218.png 500w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig4.png 770w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>What does this information mean? Well, first of all, this is a hold time violation. Consider the figure to the right. The timing tool thinks that the two clocks are identical, since they are both 100MHz, and because they both rise 0ns into the period. It looks at the delay in the clock tree going to the source flip-flop of 0.851ns. Then it looks at the delay through the logic to the destination flip-flop of 1.841ns. It then sees a delay of 3.675ns on the clock tree of the destination flip-flop. The timing tool will\u00a0see this situation as a hold error, since when both clocks rise, the data clocked in to the source flip flop will actually race through the logic and arrive into the destination flip-flop too soon. The source flip-flop has not held the data stable for long enough.<\/p>\n<h2>Thinking about the problem<\/h2>\n<p>What does this error mean? First of all, the tool is wildly wrong about its assumptions. While both clocks are 100MHz, they don&#8217;t come\u00a0from the same oscillator. This means they are not <em>harmonically related<\/em>. In lay terms, this means that they are really not exactly 100MHz, but are off a tiny amount, in different amounts. This means there really isn&#8217;t any timing relationship between the clocks. What does this mean for our design? This path is data from the processor which is going to be displayed on the seven segment display\u2013 which a human will look at. This data doesn&#8217;t change very often, and if it is wrong for 10ns when it does, nobody will notice.<\/p>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig5.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-567 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig5-300x168.png\" alt=\"tut16afig5\" width=\"300\" height=\"168\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig5-300x168.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig5-1024x575.png 1024w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig5-500x281.png 500w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig5.png 1341w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Another report which is good to run now helps you visualize the situation. Go ahead and click on the <em>Report Clock Interaction<\/em> flow. This should bring up a panel like the one\u00a0shown to the right. The panel\u00a0shows the status of paths, depending on source clock and destination clock. The green shows that both\u00a0paths fully within each of the two clock domains are <em>Timed<\/em>. This means they are checked and everything looks good. Paths between clock domains are checked, but there are still problems. This is what we&#8217;re going to need to fix.<\/p>\n<h2>Resolving the problem<\/h2>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig6.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-568 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig6-300x150.png\" alt=\"tut16afig6\" width=\"300\" height=\"150\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig6-300x150.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig6-500x250.png 500w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig6.png 770w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>There are two ways we can go about resolving this problem. First,\u00a0we can tell the synthesis tool that the clocks are <em>asynchronous<\/em>. You can go into the <em>Edit Timing Constraints<\/em> flow and create a clock group. Add both clocks to the group, then specify that the clocks are asynchronous to each other. This would look like the figure to the right. You can even see the XDC command to specify this relationship:<\/p>\n<pre>set_clock_groups -asynchronous -group [get_clocks clk] -group [get_clocks clk_fpga_0]<\/pre>\n<p>The problem with this approach is that it works too well. It basically tells the timing tool, &#8220;hey, anything going between these clock domains is hopeless, so don&#8217;t bother looking at it&#8221;. This may be true, but perhaps\u00a0we should be more explicit about what should be ignored.<\/p>\n<p>The second solution is to\u00a0create a <em>false path<\/em>. The false path tells the timing analyzer to ignore this timing path because we don&#8217;t care what happens here.<\/p>\n<p>Go back to the <em>Timing Constraints<\/em> editor and select the <em>Set False Path<\/em> entry under <em>Exceptions<\/em>. Click the green plus button to create a new false path. We will need to specify a source for the false path and a endpoint for the path. We will be using wildcards to help simplify the constraint, which will reduce the total number of constraints. Click the<strong><em> &#8230;<\/em><\/strong> button to the right of the <em>From<\/em> line. For the pattern enter <em>*slv_reg0_reg[*]\/C<\/em>, check the <em>Search hierarchical<\/em> box, then click the <strong><em>Find<\/em><\/strong> button. Specify the clock pin on the flip-flop as the source point for the false path. You should see the 32 source points show up in the <em>Find results<\/em> window. Click <strong><em>OK<\/em><\/strong>. Now, click the<strong><em> &#8230;<\/em><\/strong> button next to the <em>To<\/em> line and check the <em>Search hierarchical<\/em> box. Search for <em>*ssd_reg[*]\/D<\/em> and click <strong><em>Find<\/em><\/strong>. You should see the seven ssd registers appear. Then click <em>OK<\/em>.<\/p>\n<p>You should see a XDC command that looks like this:<\/p>\n<pre>set_false_path -from [get_pins {*slv_reg0_reg[*]\/C} -hierarchical] -to [get_pins {*ssd_reg[*]\/D} -hierarchical]<\/pre>\n<p>Go ahead and click <strong><em>OK<\/em><\/strong>. Now go to the file menu and save the constraints. You can rerun synthesis or, since we just changed the constraints, you can just force the synthesis to be up to date. If you update the timing summary, you should see the hold violations go away. Also, you should rerun the <em>Report Clock Interaction<\/em> flow. You should now see that the data from the <em>fpga_clk_0<\/em> domain to the <em>clk<\/em> domain is all blue (<em>User Ignored Paths<\/em>).<\/p>\n<h2>Implement the design<\/h2>\n<p>So far we&#8217;ve been running the timing reports on just the synthesized design. All of the numbers in the report are just gross estimates. There has not yet been any placement or routing of the design. Go ahead and implement the design. We&#8217;re then going to run some reports with more accurate numbers.<\/p>\n<h1>Analyzing the implemented design<\/h1>\n<p>Open up the implemented design and run a <em>Report Timing Summary<\/em>. You should see no red entries, which indicates that we have passed our timing checks. To the left of the timing summary window, you will see a hierarchical list of paths within the design. Notice that the last one is <em>Unconstrained Paths<\/em>. Go ahead and drill down into that list. You will see three sub-categories, <em>clk to NONE<\/em>, <em>clk_fpga_0 to NONE<\/em>, and <em>NONE to clk<\/em>. <a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig7.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-572 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig7-300x186.png\" alt=\"tut16afig7\" width=\"300\" height=\"186\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig7-300x186.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig7-484x300.png 484w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig7.png 869w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>This is basically a list of things that we have overlooked. Paths that have not been constrained. These are freebies to the place and route tool, but do we care about these paths? The first list <em>clk to NONE<\/em>\u00a0are the <em>ssd<\/em> output pins. These come from the <em>clk<\/em> clock and go off chip. If you click on <em>Setup<\/em> you will see a list of the longest paths in this category. In my design the longest path is from <em>ssd_reg[4]<\/em> to <em>ssd[4]<\/em>. The total delay on the path is 9.067ns. If you double click that path, you will see a detailed description of what is on the path. Mine is shown in the figure to the right.<\/p>\n<p>The path is broken into two parts. The first is the clock insertion path. You can see the clock come on the chip and go through the input buffer (the <em>IBUF<\/em>) go through some wiring, and then go through a global buffer (<em>BUFG<\/em>) and then through more wiring. The total time for that is 5.415ns. The next section is through the flip-flop and off the chip. It takes 0.518ns to go through the flip-flop (<em>FDRE<\/em>) and then 4.955ns of wiring delay, and then 3.595ns to go through the output buffer (<em>OBUF<\/em>). The grand total on this delay is a whopping 14.483ns.<\/p>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig8.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-573 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig8-300x297.png\" alt=\"tut16afig8\" width=\"300\" height=\"297\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig8-300x297.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig8-150x150.png 150w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig8-304x300.png 304w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig8.png 691w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Go ahead and click on the <em>Device<\/em> tab above the timing path summary. You will see a floorplan of the chip and the path we are looking at will be highlighted. Here is what my design looks like. Notice that that path goes all the way across the chip. Now in our case this is an SSD that a person is looking at. 15ns may seem like a long time on the FPGA world, but a person will not be able to tell the difference if it was even a million times that long. But suppose we do care. If this signal was going to another chip this might be an issue.<\/p>\n<h2>Constraining the output<\/h2>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig9.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-578 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig9-300x236.png\" alt=\"tut16afig9\" width=\"300\" height=\"236\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig9-300x236.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig9-381x300.png 381w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig9.png 626w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Let&#8217;s go back to the <em>Edit Timing Constraints<\/em> flow under the <em>Implementation<\/em> flow. We are going to set an output delay on the <em>ssd<\/em> output. Click on the <em>Set Output Delay<\/em> line. Then, click the green plus sign to create a new constraint. Fill in the constraint as shown in the figure to the right. This specifies that we only want at most 2ns of output delay on the path. Your command should look like this:<\/p>\n<pre>set_output_delay -clock [get_clocks clk] 2.0 [get_ports {ssd[*]}]<\/pre>\n<p>Click <strong><em>Apply<\/em><\/strong>, then save the constraints. Go ahead and rerun the implementation. This will synthesize and place and route with the new output constraints.<\/p>\n<p>The value you use for the set_output_delay command is a little backwards from what you might expect. You should think of the number as meaning the amount of delay outside the chip that the signal needs to go through before being clocked into a flip-flop outside the chip on the same clock.<\/p>\n<h2>The new results<\/h2>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig10.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-579 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig10-300x247.png\" alt=\"tut16afig10\" width=\"300\" height=\"247\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig10-300x247.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig10-364x300.png 364w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig10.png 864w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>After the implementation completes, you will notice that the new design failed timing. Go ahead and run a <em>Report Timing Summary<\/em> again to see what happened. If you look at the path you will see that the net delay between the flip-flop and the output buffer is greatly reduced from 5.4ns to 1.5ns.<\/p>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig11.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-580 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig11-300x297.png\" alt=\"tut16afig11\" width=\"300\" height=\"297\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig11-300x297.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig11-150x150.png 150w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig11-303x300.png 303w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig11.png 693w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Let&#8217;s look at the layout. Select the Device tab again and you will see the path highlighted in the new implementation. As you can see from the figure, the path is now much shorter. The place and route tool has taken in the constraint information and changed its strategy for meeting our constraints. But still, the clock insertion delay is really causing us grief.<\/p>\n<p>In a design where our output timings mattered, we could use a PLL to remove the insertion delay of the clock. But that is really overkill in this situation.<\/p>\n<h2>Specifying a maximum delay<\/h2>\n<p>Go ahead and remove the set_output_delay constraint on the <em>ssd<\/em> output. Then create a <em>Set Maximum Delay<\/em> constraint. You will find that under the <em>Exceptions<\/em> category. The <em>From<\/em> point should be the <em>clk<\/em> net and the To point should be the <em>ssd[*]<\/em> ports. The final constraint should look like this.<\/p>\n<pre>set_max_delay -from [get_clocks clk] -to [get_ports {ssd[*]}] 8.0<\/pre>\n<p>Click the <strong><em>Apply<\/em><\/strong> button, then click the link to <em>rerun<\/em> the static timing. Notice that you can change timing constraints and then simply rerun the static timing tool. This will reanalyze the design but the new constraints will not have any effect on the implementation of the design. Once you reimplement, the constraints are viewed as goals by the synthesis and place and route algorithms.<\/p>\n<p>You will see that the paths are still failing. In effect, we really haven&#8217;t changed anything. The <em>set_max_delay<\/em> value of 8 is pretty much the same as the <em>set_output_delay<\/em> value of 2 when the clock is 10ns. Notice however that you can edit the constraint in a spreadsheet mode after it is created. Just select the set_max_delay constraint and you will see above that you can make changes to the value and other properties. In particular, we want to check the <em>Data Path Only<\/em> option. Go ahead and check this and also change the delay value to 6. Your constraint should now look like this.<\/p>\n<pre>set_max_delay -datapath_only -from [get_clocks clk] -to [get_ports {ssd[*]}] 6.0<\/pre>\n<p>Click <strong><em>Apply<\/em><\/strong> again and rerun the timing analysis. You should now see the static timing pass. The <em>set_max_delay<\/em> constraint is now not considering the clock insertion delay but only the delay from the flip-flop to off chip.<\/p>\n<p>Look through the other unconstrained paths and add <em>set_max_delay<\/em> constraints for the other outputs. I added constraints for <em>ssdcat<\/em> and for <em>led[*]<\/em>. Note that since the LED outputs are driven from the ARM directly they use a different clock. Notice how the <em>ssdcat<\/em> output meets timing, but the LED\u00a0outputs do not. I suspect that the logic for the ssdcat output got grouped with the other <em>ssd<\/em> logic so it happens to meet timing now. The LED logic however doesn&#8217;t. If you resynthesize and reimplement the design, the LED output should now meet timing.<\/p>\n<h2>Input delays<\/h2>\n<p>We still have more unconstrained paths.\u00a0If we look through those we see that we don&#8217;t have constraints on our input switches and buttons. Go ahead and add set_max_delay constraints there of 2.5ns. Here are the constraints that I have:<\/p>\n<pre>set_max_delay -from [get_ports {btn[*]}] 2.500\r\nset_max_delay -from [get_ports {switch[*]}] 2.500\r\nset_max_delay -from [get_ports enc_a] 2.500\r\nset_max_delay -from [get_ports enc_b] 2.500\r\nset_max_delay -from [get_ports enc_btn] 2.500\r\nset_max_delay -from [get_ports enc_sw] 2.500<\/pre>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig12.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-585 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig12-300x297.png\" alt=\"tut16afig12\" width=\"300\" height=\"297\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig12-300x297.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig12-150x150.png 150w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig12-303x300.png 303w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/03\/tut16afig12.png 688w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Notice how I only have the start of the path specified. This is enough to identify these paths. Save the constraints and reimplement the design. After completing the place and route, the design now meets timing. I have included the new floorplan for the design. Notice how we are starting to see logic move to different locations in the chip? My floorplan is shown to the right and you can see the path for <em>btn[3]<\/em> highlighted. The path\u00a0is now quite short, and the synchronization flip-flop is located near the IO pin.<\/p>\n<h1>Investigating more unconstrained paths<\/h1>\n<p>Let&#8217;s continue through our list of other unconstrained paths. In the <em>NONE to clk_fpga_0<\/em> category we see some from <em>switch_out_reg<\/em> in the debounce logic to the slave register in the AXI register block. Add a max_delay of 5ns on those paths. Rerun the timing. Notice that each time you run the timing, it only reports the 10 longest paths in each category. So it looks like we are starting to play whack-a-mole with constraints. If you click on the <em>Report Timing Summary<\/em> flow to rerun timing, it will bring up a panel where you can set options for the timing run. You can see under <em>Path Limits<\/em> where you can set the <em>Maximum number of paths per clock or path group<\/em>. Change that to 100 and rerun the timing. Now we can see more of the paths in one report.<\/p>\n<p>There are also some paths from the encoder and from the timer counter to the AXI registers. Now these paths don&#8217;t come from asynchronous user inputs, so we should not dismiss them so easily<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When the synthesis and implementation tools run, they need to understand the timing of the design. At a minimum, this means the clock frequency that the design runs at. In most designs there will be more than one clock, so &hellip; <a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial16\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":226,"menu_order":16,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-560","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages\/560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/comments?post=560"}],"version-history":[{"count":16,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages\/560\/revisions"}],"predecessor-version":[{"id":1042,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages\/560\/revisions\/1042"}],"up":[{"embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages\/226"}],"wp:attachment":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/media?parent=560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}