天天看點

clock gating | ODC-based Clock Gating

在目前數字電路實作中,clock gating 是節省動态功耗最有效且成本最低的辦法,是以一直以來業界都在想方設法進一步去挖掘,期望用這種低成本辦法進一步節省動态功耗,如XOR clock gating. 關于clock gating 驢曾碼過三篇短文《clock gating | 從ICG cell 在 library 中的定義說起》、《clock gating | Gating 的插入與驗證》、《clock gating | clock gating 的timing check》。

clock gating | ODC-based Clock Gating

前幾天接觸了一個新概念,ODC-based Clock gating, 研讀了一些文章,有了個大緻的概念,碼篇短文總結一下。下圖是綜合工具插clock gating 時,邏輯的映射,即将寄存器D-pin mux 的選擇信号用于Clock gating 的enable 信号,此處最關鍵的就是enable 信号的抽取,傳統做法是從RTL 語句中直接抽取。

clock gating | ODC-based Clock Gating

所謂的ODC 即是:Observability Don’t Care 的首字母縮寫,以下圖為例,當A=0 時,不論B 如何變化,"AND 門"的輸出都是0,此時B 點即為Observability Don’t Care 點,是以如果可以将B 點源頭的寄存器gate 掉,那後續邏輯的無效翻轉都會被消除,進而節省了功耗。

clock gating | ODC-based Clock Gating

以下圖為例,在傳統綜合流程中,為了保持邏輯一緻性,如果在RTL 中隻有寄存器dout 的描述中有 "if (vld_d2)", 那工具隻會對dout 插gating, d_1, d_2 因為缺少enable 信号不會被gating, 但是d_1, d_2 都是Observability Don’t Care 點,如果可以gating 就能省更多功耗。

clock gating | ODC-based Clock Gating

要想讓工具對這些ODC 點插gating 就需要在RTL 中把對應的enable 加上,如果在寫代碼時無法确定這些ODC 點,可以借助Joules 對RTL 進行分析。Joules 的 ODC-based Logic Gating 流程大緻如下:

clock gating | ODC-based Clock Gating

對于如下一段代碼,I_bus, T_bus, S_bus, Q_bus 因為沒有enable 信号,工具無法對其插入clock gating,但因為最後選擇邏輯的存在,I_bus, T_bus, S_bus, Q_bus 都是ODC 點。

clock gating | ODC-based Clock Gating

在Joules 中用指令report_odc 和report_logic_gating 可以報出代碼中所有的ODC 點,及可用的『enable 信号』。

clock gating | ODC-based Clock Gating
clock gating | ODC-based Clock Gating

根據Joules 的report 可将代碼修改為如下形式,如此,在綜合時工具就可以插入更多的clock gating.

clock gating | ODC-based Clock Gating

在數字電路中 clock gating 從設計開始就需要考慮,在某文中讀到設計實作中要考慮的一些點,甚是認同,搬運至此:

  • Identify registers with low data activity, additional CGs would cost area.
  • Grouping registers and building an XOR tree, introduces a single CG for the group.
  • To guarantee power reduction, method should be based on placement information.
  • Timing and congestion are affected.
  • Activity driven clock gating: 1) Clock gating should be done if it helps improve overall power, based on switching activity; 2) There can exist more than one scenarios that need to be optimized; 3) Clock gating should not be done for high switching activity registers.
  • Placement-driven optimisation: Cloning/Merging of clock gates.
  • Observability Don’t Care: 1) Registers whose outputs are not observable, during a clock cycle, should be isolated; 2) Ability that can ‘observe’ a logic path beyond a clock-to-clock boundary; 3) De-Assert a data path if its forward stage is gated; 4) De-Assert forward stage, if the current stage is gated; 5) Apart from sequential power savings, combinational logic cones can also be gated.
  • Leakage/Static Power Impact: All clock gating techniques should comprehend total power.

驢說IC