
你已经了解逻辑综合的过程
本次课内容:
网表中的标准单元是可制造的, 具备各种物理属性
面积评估:
.lib文件已经给出了标准单元的面积属性
性能评估: 主要通过频率来衡量, 即电路每秒最多能工作多少次

回顾数字电路的状态机模型:
评估电路的性能 = 通过评估电路中组合逻辑的延迟, 来推算电路的最高工作频率
电路中的组合逻辑有很多
电路的工作频率受限于电路中延迟最长的一条组合逻辑路径
关键路径(critical path)
寻找电路中的关键路径:
上述方法基于网表和标准单元库的延迟信息, 不涉及电路的工作过程
yosys-sta项目中采用iSTA工具来开展STA工作
当前得到的时序报告并不能完全反映芯片流片时的频率
虽然逻辑延迟虽然不能代表最终的延迟信息, 但也给出了频率的上限
对于处理器来说, 频率并不是衡量其性能的唯一因素
实质性的工作
处理器的本分工作是执行程序
执行程序的效率
我们将在B阶段进一步讨论IPC的测量和优化方法
功耗分三类:

动态功耗 = 内部功耗 + 翻转功耗

yosys-sta评估电路中所有标准单元的功耗之和
0: 等效电容还和走线的拓扑和长度相关基本上不需要了
事实上, 当以下不等式成立时, FPGA在时间方面的优势才能体现出来:
\[T_{FPGA.syn} + T_{FPGA.impl} + T_{FPGA.run} < T_{Sim.comp} + T_{Sim.run}\]
什么样的RTL代码转换成什么样的标准单元, 需要考虑RTL综合的语义
手册的1.1节介绍了RTL综合的一些概述
1.1 Scope
This standard defines a set of modeling rules for writing Verilog® HDL descriptions
for synthesis. Adherence to these rules guarantees the interoperability of Verilog
HDL descriptions between register-transfer level synthesis tools that comply to this
standard. The standard defines how the semantics of Verilog HDL are used, for
example, to describe level- and edge-sensitive logic. It also describes the syntax
of the language with reference to what shall be supported and what shall not be
supported for interoperability.1.1 Scope
This standard defines a set of modeling rules for writing Verilog® HDL descriptions
for synthesis. Adherence to these rules guarantees the interoperability of Verilog
HDL descriptions between register-transfer level synthesis tools that comply to this
standard. The standard defines how the semantics of Verilog HDL are used, for
example, to describe level- and edge-sensitive logic. It also describes the syntax
of the language with reference to what shall be supported and what shall not be
supported for interoperability.Use of this standard will enhance the portability of Verilog-HDL-based designs
across synthesis tools conforming to this standard. In addition, it will minimize
the potential for functional mismatch that may occur between the RTL model and the
synthesized netlist.
我们关注的内容:
第5.1节介绍了对组合逻辑建模的方式
Combinational logic shall be modeled using a continuous assignment or a net
declaration assignment or an always statement.组合逻辑可以通过连续赋值,
线网声明赋值或always语句进行建模
采用连续赋值和线网声明赋值方式时, 所描述的组合逻辑电路和运算符有关
+和-运算符将综合出加法器*将综合出阵列乘法器/和%将综合出阵列除法器
~运算符将综合出数量与位宽相同的非门
a的位宽为4,则~a将会综合出4个非门&, |,
^和^~(或~^)将综合出数量与位宽相同的2输入门电路,
分别对应与门, 或门, 异或门和同或门&,
|和^将分别综合出一个输入端口数量与操作数位宽相同的门电路,
分别对应与门, 或门和异或门
a的位宽为4,则&a将会综合出一个4输入的与门~&,
~|和~^各自综合出的电路,
分别等价于在&,
|和^综合出的与门,
或门和异或门之后再添加一个非门
|a为1’b1,
当且仅当a的真值不为零a && b -> (|a) & (|b)a || b -> (|a) | (|b)!a -> ~(|a)(a == b) -> ~(|(a ^ b))(a != b) -> |(a ^ b)
a的位宽为wa,移位位数为b,wa和b皆为常量
(a >> b) ->
{{b{1’b0}}, a[wa-1:b]}(a << b) -> {a, {b{1’b0}}}
always对组合逻辑进行建模回到手册第5.1节
When using an always statement, the event list shall not contain an edge event
(posedge or negedge). The event list does not affect the synthesized netlist.
However, it may be necessary to include in the event list all the variables read in
the always statement to avoid mismatches between simulation and synthesized logic.always语句时,
事件列表不能包含边沿事件(posedge或negedge)always语句中被读取的所有变量包含在事件列表中,
从而避免仿真和综合结果不一致
always对组合逻辑进行建模(2)The event list for a combinational logic model shall not contain the reserved words
posedge or negedge. Not all variables that appear in the right hand side of an
assignment are required to appear in the event list. For example, a variable does not
have to appear in the event list of an always statement if it is assigned a value
with a blocking assignment before being used in subsequent expressions within the
same always statement.posedge和negedgealways语句中的阻塞赋值语句进行赋值
RTFM查看示例
第5.2节介绍了对时序逻辑建模的方式
An edge-sensitive storage device shall be modeled for a variable that is assigned a
value in an always statement that has exactly one edge event in the event list. The
edge event specified shall represent the clock edge condition under which the storage
device stores the value.always语句中对一个变量赋值来进行的,
这个always语句的事件列表只有一个边沿事件
Nonblocking procedural assignments should be used for variables that model
edge-sensitive storage devices. Nonblocking assignments are recommended to avoid
Verilog simulation race conditions.Blocking procedural assignments may be used for variables that are temporarily
assigned and used within an always statement.对于临时赋值并在同一条always语句中使用的变量,
可以使用阻塞赋值
RTFM查看示例
if-else语句的可综合语义规则1: 对于只更新单个寄存器变量的嵌套if-else语句,
其功能等价于嵌套的条件运算符
always @(posedge clk)
if (cond1) val <= expr1;
else if (cond2) val <= expr2;
// ...
else if (condn) val <= exprn;
else val <= expr_last;上述代码所描述的电路等价于:
条件运算符会综合出选择器
if-else语句的可综合语义(2)规则2: 对于只更新单个寄存器变量的多个并列的if语句,
其功能可用嵌套的if-else语句来表示
if-else语句的可综合语义(3)规则3:
对于更新多个寄存器变量的if-else语句,其功能等价于按照变量将always语句分开编写
case语句的可综合语义假设expr0, expr1, …,
exprn中均不含x和z
在芯片设计的流程中, 仿真和综合都是必须的步骤
手册的附录B(Functional mismatches)描述了一些不一致的场景
0或1作为触发器b的输入更多的场景
`ifdefcasexcasezx赋值语句
手册包含详细的解释和示例, 建议RTFM仔细阅读
always对组合逻辑和时序逻辑进行建模