国产FPGA高云GW1N-4系列开发板测评之——软件篇3
<p style="text-indent:31.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">下面是时序约束部分:</span></span></span></span></span></span></span></span></p><p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt"> FPGA</span></span></span></span></span><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">设计中最主要的目的是实现设计满足时序要求,就是没有违例,然后才是功耗资源等等的优化,可见时序约束对设计来说的总要性了。</span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt"> 时序分析的基本概率就不累述了,主要是基于静态时序分析,接下来我们来学习高云云源软件提供的时序编辑器,和时序约束的过程。</span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt"> 我还是基于之前物理约束篇中提到的示例工程counter,打开工程,启动时序约束编辑工具如图:</span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left"></p>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">时序约束同样有两种方式可以,一种就是通过时序约束工具按照顺序以图形界面的方式产生,另外一种还是直接编辑生成的时序约束文件.SDC文件。</span></span></span></span></span></span></span></span><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">下面来学习约束流程:</span></span></span></span></span></span></span></span></p>
<ol>
<li align="left" style="margin-left:8px; text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">时钟约束:</span></span></span></span></span></span></span></span></li>
</ol>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">(1)</span></span></span></span></span><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">通过单击Constrains菜单栏或在Timing Constraints窗口中选中Clock后直接在其后的约束列表框中右键,或者在网表框中找到需要约束为时钟的port,右键添加clock(主时钟约束)。(2)直接在SDC文件中添加约束,高云时序约束语法规范参考的标准也是SDC(Synopsys Design Constraint)可以说是一样的,时钟约束如下:</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">①</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">create_clock[-name<clock_name>]-period <period_value>[-waveform <edge_list>]<objects>[-add]</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">这条约束是最重要的时序约束,一般的设计都会有这条约束,还有一点值得注意的是从这条约束中可以看出一个端口可以约束多个时钟,时序分析工具会将第一个时钟当做源时钟后面的时钟为目的时钟生成报告如下图:</span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left"></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">②</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">create_generated_clock [-name <clock name>]-source <master pin>[-edges <edge list>][-edge_shift <shift list>][-divide_by <factor>][-multiply_by<factor>][-duty_cycle<percent>][-add][-invert][-master_clock <clock>][-phase <phase>][-offset <offset>]<objects></span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">这条约束一般情况下用的少,因为工具会自动根据主时钟添加衍生时钟。</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">③</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">set_clock_latency -source [-rise | -fall][-late | -early]<delay>[-clock <clock list>]<object list></span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">这条约束是设置时钟信号到达器件时钟端口之前的延时,所以要在明确具体的延时情况下设置,一般来讲延时是非常小的基本忽略不计。</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">④</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">set_clock_uncertainty[-from <from clock>][-rise_from <rise from clock>][-fall_from <-fall from clock>][-to <to clock>][-rise_to <rise to clock>][-fall_to <fall to clock>][-setup | -hold]<uncertainty value></span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">这条约束是设置时钟不确定量,帮助工具更好分析系统的性能,可以预估系统工作的稳定性。</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">⑤</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">set_clock_groups[-asynchronous | -Exclusive][-group <clock name>] </span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">为了使用这条命我们在工程中在添加一路时钟</span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">这条约束主要是用来约束异步时钟(当然也可以约束同步时钟),在多时钟路径的工程里这条约束用的比较多,避免工具对异步时钟进行相关时序分析。</span></span></span></span></span></span></span></span></p>
<ol>
<li style="margin-left:8px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">I/O</span></span></span></span></span><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">延时约束</span></span></span></span></span></span></span></span></li>
</ol>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">(1)</span></span></span></span></span><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">通过单击Constrains菜单栏或在Timing Constraints窗口中选中I/O Delay后直接在其后的约束列表框中右键。(2)直接在SDC文件中添加约束,高云时序约束语法规范参考的标准也是SDC(Synopsys Design Constraint)可以说是一样的,IO约束如下:</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">set_input_delay-clockclock_name[-clock_fall][-rise][-fall][-max][-min]</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt"><delay_value><port_list></span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">set_output_delay-clockclock_name[-clock_fall][-rise][-fall][-max][-min][-add_delay]<delay_value><port_list></span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">这两条约束是设置数据延时的,在明确数据与时钟到达存在过早或过晚的关系时设置,保证数据输入或输出的正确锁存。</span></span></span></span></span></span></span></span></p>
<ol>
<li style="margin-left:8px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">时序路径约束</span></span></span></span></span></span></span></span></li>
</ol>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">(1)</span></span></span></span></span><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">通过单击Constrains菜单栏或在Timing Constraints窗口中选中Path后直接在其后的约束列表框中右键。(2)直接在SDC文件中添加约束,高云时序约束语法规范参考的标准也是SDC(Synopsys Design Constraint)可以说是一样的,时序路径约束如下:</span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">set_false_path [-from <from list>][-to <to list>][-through <through list>][-setup][-hold]</span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left"> </p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">set_max_delay</span></span></span></span></span><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">(set_min_delay)[-from <from list>][-to <to list>][-through <through_list>]<delay value>set_min_delay[-from <from list>][-to <to list>][-through <through_list>]</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">set_multicycle_path[-setup|-hold][-start|-end][-from <from_list>][-to <to list>][-through <through_list>]<path multiplier></span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">这几条约束中set_false_path约束跟设置异步时钟组有异曲同工之用,只是时钟组优先级高一些,一条命令可以涵盖的范围跟广一些,set_max/min_delay限定某些路径上的延时,用于改善局部时序路径,慎用往往牵一发动全身。set_multicycle_path是执行多周期分析的约束,较少使用。</span></span></span></span></span></span></span></span></p>
<ol>
<li style="margin-left:8px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">工作条件约束</span></span></span></span></span></span></span></span></li>
</ol>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">(1)</span></span></span></span></span><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">通过单击Constrains菜单栏或在Timing Constraints窗口中选中Path后直接在其后的约束列表框中右键。(2)直接在SDC文件中添加约束,高云时序约束语法规范参考的标准也是SDC(Synopsys Design Constraint)可以说是一样的,工作条件约束如下:</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">set_operation_conditions[-grade <c|i|a>][-model <slow|fast>][-speed <speed>][-setup][-hold][-max][-min][-max_min]</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">这条约束就是设置芯片工作条件,芯片的速度温度等级知道的情况下这条命令的作用一目了然。</span></span></span></span></span></span></span></span></p>
<ol>
<li style="margin-left:8px; text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">时序报告的约束</span></span></span></span></span></span></span></span></li>
</ol>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">(1)</span></span></span></span></span><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">通过单击Constrains菜单栏或在Timing Constraints窗口中选中Report后直接在其后的约束列表框中右键。(2)直接在SDC文件中添加约束,高云时序约束语法规范参考的标准也是SDC(Synopsys Design Constraint)可以说是一样的,时序报告的约束我就不累述了,参考SUG940,这部分约束主要涉及时序报告的内容,不影响系统,用户根据需要添加即可,时序报告要能看懂,下面我们做一个小实验来看看时序报告怎样反应时序违例情况。</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">首先我约束时钟到200M如下:</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">可以看到报告的路径三有三条路径setpu裕量变为负值,就是数据需求时间小于了数据到达时间,可以看到最大时钟能跑179.584MHz,一般要小于这个值。</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:等线"><span style="text-justify:inter-ideograph"><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:宋体"><span style="color:#444444"><span style="letter-spacing:.75pt">这里我还有一点发现,时序约束编辑器要加一个刷新键就好了更物理约束编辑器一样,这样我如果在约束文件中编辑好可以在工具中重新加载一下,不然我还得关掉编辑器重新打开,有点不方便。</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"></p>
<p style="text-align:justify"> </p>
页:
[1]