在當前數字電路實現中,clock gating 是節省動態功耗最有效且成本最低的辦法,所以一直以來業界都在想方設法進一步去挖掘,期望用這種低成本辦法進一步節省動態功耗,如XOR clock gating. 關於clock gating 驢曾碼過三篇短文《clock gating | 從ICG cell 在 library 中的定義說起》、《clock gating | Gating 的插入與驗證》、《clock gating | clock gating 的timing check》。
前幾天接觸了一個新概念,ODC-based Clock gating, 研讀了一些文章,有了個大致的概念,碼篇短文總結一下。下圖是綜合工具插clock gating 時,邏輯的映射,即將寄存器D-pin mux 的選擇信號用於Clock gating 的enable 信號,此處最關鍵的就是enable 信號的抽取,傳統做法是從RTL 語句中直接抽取。
所謂的ODC 即是:Observability Don’t Care 的首字母縮寫,以下圖為例,當A=0 時,不論B 如何變化,"AND 門"的輸出都是0,此時B 點即為Observability Don’t Care 點,所以如果可以將B 點源頭的寄存器gate 掉,那后續邏輯的無效翻轉都會被消除,從而節省了功耗。
以下圖為例,在傳統綜合流程中,為了保持邏輯一致性,如果在RTL 中只有寄存器dout 的描述中有 "if (vld_d2)", 那工具只會對dout 插gating, d_1, d_2 因為缺少enable 信號不會被gating, 但是d_1, d_2 都是Observability Don’t Care 點,如果可以gating 就能省更多功耗。
要想讓工具對這些ODC 點插gating 就需要在RTL 中把對應的enable 加上,如果在寫代碼時無法確定這些ODC 點,可以借助Joules 對RTL 進行分析。Joules 的 ODC-based Logic Gating 流程大致如下:
對於如下一段代碼,I_bus, T_bus, S_bus, Q_bus 因為沒有enable 信號,工具無法對其插入clock gating,但因為最后選擇邏輯的存在,I_bus, T_bus, S_bus, Q_bus 都是ODC 點。
在Joules 中用命令report_odc 和report_logic_gating 可以報出代碼中所有的ODC 點,及可用的『enable 信號』
根據Joules 的report 可將代碼修改為如下形式,如此,在綜合時工具就可以插入更多的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.