低功耗技术---UPF&CPF
UPF的全称是统一功耗格式(Unified Power Format),其主要是由 Synopsys 推出的专门用于描述电路电源功耗意图(power intent)的一种语言标准,它是 Tcl 语言的扩展,并且现在已经成为 IEEE-1801 标准且被三大EDA厂商(Synopsy 、Cadence、Mentor)支持。
芯片设计粗略分为三个部分:功能、时序和电源,它们分别对应RTL(functional behavior)、SDC和UPF(power behavior)三种设计文件。前端工程师对RTL和SDC是非常熟悉的,但是UPF(SNPS叫UPF,Cadence叫CPF)更多地是跟后端相关。
UPF的作用是基于工具命令语言(tcl)把功耗设计意图(power intent)传递给EDA工具,从而帮助实现物理设计。
RTL只能实现功能设计,对于功耗设计意图则需要通过UPF实现。UPF 和 RTL 中给出不同设计信息的对比如下所示:
Power intent 用于描述芯片工作的『电特性』,包括工作电压、电压的开关、芯片的 power state(such as run/standby/retention/shutdown)、低功耗cell插入的策略等
UPF in Design Flow
UPF标准本身包含了大量的用于描述电源网络的 Tcl 命令,直接使用这些命令可以很方便的创建电源域和功耗控制的特殊单元等,用 UPF 编写的统一功耗格式文件不仅可以在 RTL 级,同时还可以被后端工具使用,这在一定意义上保证了整个芯片设计过程中功耗流程的一致性,在后端工具进行处理之后也会生成相应的 UPF 文件,此时前端工具可以使用该 UPF 文件对网表进行 Power 仿真分析。
前端(Design)
目前数字芯片低功耗设计主要是用 Verilog/VHDL 对电路进行描述,同时使用UPF文件对设计的功耗意图进行描述,最初的 UPF 文件标记为UPF0,我们可以使用 UPF0 对 RTL 进行动态/静态功耗验证。
使用 MVSIM 或者 VCS-native mode 对 RTL+UPF0 进行功耗验证,MVSIM 工具是 Synopsys 公司推出的基于 UPF 流程的低功耗动态验证工具。
此前,对与芯片回来后才可以对功耗管理机制等进行验证,一旦出现问题,进行修改代价十分发。
MVSIM 工具允许在 RTL 阶段结合 UPF 文件即可对芯片的功耗管理机制进行功能验证,从而尽量在设计早期阶段发现问题,MVSIM 工具是一款协同仿真器(Co-Simulator),它可以与当下流行的功能仿真器如 VCS/NC 协同仿真,达到对低功耗设计的动态验证目的,应用该工具在 RTL 阶段可以发现大多数的功耗管理、功耗控制等相应的问题。
中端(Syn)
在Synopsis推荐的UPF流程中禁止在RTL阶段手动例化隔离单元(Isolationcell)和电平转换单元(Level Shift cell)。因为在逻辑综合阶段,综合工具DC会根据功耗意图文件 UPF0 自动插入这些单元。
在逻辑综合过程中,综合工具 DC 会读入 RTL文件和 UPF0 文件,然后综合出门级网表并且产生更新后的功耗意图文件 UPF1,在 UPF1 文件中不仅包含了 UPF0 文件的信息,同时还显示的给出了综合后特殊单元的 supply net 的连接关系。
逻辑综合后可以使用 MVSIM 工具或者VCS-native 模式对插入了特殊单元的网表进行仿真。
后端
在物理实现阶段,ICC 工具读入 DC 综合后的网表和 UPF1 后在进行 Place&Routing,ICC 工具可以产生带电源引脚和不带电源引脚的网表文件,与逻辑综合相同的是,ICC 工具也可以产生 P&R 之后更新了的功耗意图文件 UPF2,此时带有 PG 引脚连接关系的网表就可以认为是低功耗架构芯片的全部实现,因为此时网表中不单单有 PowerSwitch 等,同时还有其必要的电源网络布线。
一般情况下,Low Power cells(isolation cells, level shifters…) 在逻辑综合阶段插入,power and ground (PG) net 在物理设计阶段插入。
Definitions
一些专业名词的定义。
HighConn : The side of a port connection that is higher in the design hierarchy; the actual signal associated with a formal port definition.
LowConn : The side of a port connection that is lower in the design hierarchy; the formal port definition.
sink : A receiver; the HighConn of an input port or inout port of an instance; or the LowConn of an output port or inout port of an instance.
source : A driver; the LowConn of an input port or inout port of an instance; or the HighConn of an output port or inout port of an instance.
Power Domain
对于一款芯片来说,其是由许多模块、子系统集成之后才会发挥它的功能,不同模块之间的工作速度和性能要求不同,此时就需要将这些模块根据实际需要工作在不同的时钟频率和工作电压下。对于暂时不需要工作的模块,可以使用通过降低时钟频率或关掉时钟已达到减少时钟翻转带来的动态功耗(DynamicPower),亦或者通过切断电源来降低静态功耗(Leakage)。
因此,可以将工作在同一电压下的模块归为一个组,即 Power Domain(电源域)的概念。
关于 Power Domain 的定义:UPF power domain is a collection of instances that are treated as a group for power-management purposes. Power domain defines the group of instances that shares the common set of power supply requirements.
每一个电源域可以简单理解为供电逻辑的划分,在该逻辑划分中既包含了设计的物理实体(module)同时也包含了电源线间的连接关系。
在基于UPF标准的低功耗设计过程中,必须存在至少一个电源域,并且顶层的电源域必须在进行任何与电源相关的分析或者综合之前预先定义出来,同时还需要将电源域定义在层次化模块之上。
需要注意的是设计中的任何逻辑只能属于一个电源域,设计过程中也可以嵌套的定义电源域,如下所示:
形象化一点的理解,PD就是共用一个电源(包括VDD和VSS)的一堆电路,而且这堆电路的边界往往是根据 RTL Hierarchy 的 boundary 来定义的。
UPF 示例
首先我们需要定义一个顶层的电源域,在定义顶层电源域时不需要指定哪些模块被包含在该电源域中,定义顶层电源域的UPF命令为:
create_power_domain PD_TOP
然后我们在 PD_TOP 电源域中嵌套定义一个名为 PD1 的电源域并且同时指定模块实例 u_cpu_core 位于 PD1 电源域中,其对应的 UPF 命令为:
create_power_domain PD1 -elements {
u_cpu_core}
完整语法:
Scope
在IEEE1801中,电源域被定义的那个逻辑层次称之为电源域的 scope。比如一个设计的逻辑层次是 aaa/bbb/,且将电源域 PD 定义到了 aaa/bbb/ 上,则称 aaa/bbb/ 为电源域 PD 的 scope。【这里的逻辑层次指的是从 RTL Design 来看】
UPF 中的 set_scope
命令用于设定 current scope,其完整语法描述如下所示:
【UPF是 Tcl 命令,所以会有返回值,也兼容于不同的 EDA 工具】
简单来说,scope 就是 upf 相关命令的作用范围。set_scope
从 RTL Design 的角度指定 power domain 的作用范围,create_power_domain
则定义位于该 power domain 内的一系列实例。【比如 RTL 的 aaa/bbb/ 层级下,可能有多个 power domain。这个时候,可以先用 set_scope
指定作用范围,然后使用 create_power_domain
在该范围下定义不同的 power dimain】
换个角度理解,在Linux系统下,我们可以使用“cd dir/”进行工作目录的切换,同样地,scope可以认为是"工作目录切换"。
Examples1
给定 RTL Design 的层次化结构如下:
如果 current design top instancce 是 /top, current scope 是 /top/mid,那么
set_scope bot # changes current scope to /top/mid/bot (child of current scope)
set_scope . # leaves current scope unchanged as /top/mid (current scope)
set_scope .. # changes current scope to /top (parent of current scope)
set_scope / # changes current scope to /top (current design top instance)
如果 current design top instancce 是 /top/mid, current scope 也是 /top/mid,那么
set_scope bot # changes current scope to /top/mid/bot
set_scope . # leaves current scope unchanged as /top/mid
set_scope .. # results in an error
set_scope / # changes current scope to /top/mid (current design top instance)
如果 current design top instancce 是 /top, current scope 也是 /top/mid,那么
set_scope mid/bot # changes current scope to /top/mid/bot
set_scope . # leaves current scope unchanged as /top
set_scope .. # results in an error
set_scope / # changes current scope to /top (current design top instance)
Notes:
-
set_scope
后面可以用相对路径,也可以用绝对路径; -
set_scope
的使用和 current design top 相关。在 UPF 中,可以使用set_design_top
来设定 current design top module,其完整描述如下:
Supply Ports, Supply Nets, Supply Set
每个 scope 都有一组 supply nets 和 ports 在特定的层次结构上。
Supply Nets:在给定的电源区域内承载电源电压或接地的导体,跨越多个电压域的 net 被定义为“reused"。可以类比 RTL 里面的 wire,用来定义一根电源线,而且只在声明它的PD中有效。
Supply Ports:设计层次结构的两个相邻层次之间、层次结构的父块和子块之间的电源连接点。可以类比 RTL 里面的port,在电路中它们对应的是电源pin。
Supply Port 是一个逻辑概念(Logic Source),在 Physical 上并没有真正的 Pin 端口。主要用于连接给 power/ground 供电,以及连接不同 scope 下相同的 supply net。
Supply Nets 通过 Supply Ports 从设计层次结构的一个层次跨越到下一个层次。
Supply Set:supply nets的抽象集合(即并非实际存在,方便在 upf 中使用),一般就是一根 vdd 一根 gnd 的 net 。它是 domain-independent 的,在 supply set 中的 power 和ground 可以被任意在该scope中定义的power domain使用。
UPF Command for Supply Network
create_supply_port
如果使用 -domain
选项,会在其指定的 power domain 所在的 scope 定义一个 supply port,否则会在 current scope 定义一个 supply port。
Supply ports are loads, sources, or both, as follows:
create_supply_net
如果没有使用 -domian
指定 power domain,那么会在 current scope 创建 supply net。在 current scope 或者 below this scope 中创建的任何 power domain 都可以是使用该 supply net。
如果指定了 power domain,那么会在该 domain 所在的 scope 中创建 supply net。 supply net 可以被所指定的 domian 中的单元使用,所有插入到该 domian 中的 cells 也可以使用。
每一个声明的 supply net 都必须要连接到 supply port 上。
connect_supply_net
create_supply_set
This command defines a supply set as a collection of supply nets each of which serve a specific function for the set.
func_name 包括:power、ground、nwell、pwell、deepnwell and deeppwell。【就是给具体谁供电】
每一个 power domain 都要绑定一个 Supply Set 作为其 Primary Supply Set,即为该 Power Domain 内的所有 Stand Cells PG 供电的 Supply Set。
create_pwoer_domian
的 -supply
用于绑定Supply Set ,如下所示:
supply_set_handle 相当于是绑定的 supply_set 的名称,一个 power_domain 可以有多个 supply_set。
UPF 内部有三个自带的 supply_set_handle 关键字,用于定义特定的 cells 的电源,如下所示:
PD.primary :means primary supply set of power domain PD.
PD.default_isolation :means default supply set for isolation cells located in domain PD.
PD.default_retention :means default supply set for retention cells located in domain PD.
multi upf
什么是单 UPF 和多 UPF 呢?
对于只有一个UPF设计文件的设计来说,UPF文件是定义在顶层的 scope 中的,此时所有的 UPF对象(如Power_switch、Isolation、Level-shifter等)都只存在于顶层中,子电源域不需要定义 supply port,在不同电源域之间使用 -reuse 来共享 supply net。
对于多 UPF 设计来说,UPF文件的的描述则更加模块化,整个设计是由顶层 RTL+顶层的 UPF 文件和子模块 RTL+子模块对应的 UPF 文件共同描述的,子模块 UPF 文件必须从顶层 UPF 文件进行装载,
在 UPF 中,使用 load_upf
命令来加载其他的 upf 文件。
load_upf core.upf -scope u_cpu_core
# or
set_scope u_cpu_core
load_upf core.upf
Example
Examples1
如下图所示,该电路中存在 2 个 power domain 和 2 个 power net。
Power Domian