{"id":12711,"date":"2017-01-05T07:00:41","date_gmt":"2017-01-05T14:00:41","guid":{"rendered":"https:\/\/blogs.mentor.com\/verificationhorizons\/?p=12711"},"modified":"2026-03-27T08:49:30","modified_gmt":"2026-03-27T12:49:30","slug":"how-to-connect-your-testbench-to-your-low-power-upf-models","status":"publish","type":"post","link":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/2017\/01\/05\/how-to-connect-your-testbench-to-your-low-power-upf-models\/","title":{"rendered":"How To Connect Your Testbench to Your Low Power UPF Models"},"content":{"rendered":"<p>Face facts: power supply nets are now effectively functional nets, but they are typically not defined in the design\u2019s RTL. But proper connection and behaviors of power nets and logic \u2013 power down, retention, recovery, etc. \u2013 must be verified like any other DUT element. As such, the question is how can D&amp;V engineers link their testbench code to the IEEE 1801 Unified Power Format (UPF) files that describe the design\u2019s low power structures and behaviors, so verification of all that low power \u201cstuff\u201d can be included in the verification plan?<\/p>\n<p><a href=\"https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/54\/2017\/01\/substation_energy_flow.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-12714\" src=\"https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/54\/2017\/01\/substation_energy_flow.jpg\" alt=\"A real power distribution setup\" width=\"300\" height=\"152\" \/><\/a><\/p>\n<p>Fortunately, the answer is relatively straightforward.\u00a0 In a nutshell, the top level UPF supply ports and supply nets provide hooks for the design, libraries, and annotated testbenches through the UPF <strong>connect_supply_net<\/strong> and <strong>connect_supply_set<\/strong> commands \u2013 these define the complete power network connectivity. Additionally, the top level UPF supply ports and supply nets are collectively known as supply pads or supply pins (e.g. VDD, VSS etc.), where the UPF low power standard recommends how supply pads may be referenced in the testbenches and extended to manipulate power network connectivity in a testbench simulation. Hence it becomes possible to control power \u2018On\u2019 and \u2018Off\u2019 for any power domain in the design through the supply pad referenced in the testbench.<\/p>\n<p>All the necessary HDL testbench connections are done through importing UPF packages available under the power-aware simulation tool distribution environment. Even better: the IEEE 1801 LRM provides standard UPF packages for Verilog, SystemVerilog, and VHDL testbenches to import the appropriate UPF packages to manipulate the supply pads of the design under verification. The following are syntax examples for UPF packages to be imported or used in different HDL variants.<br \/>\n<u>Example of UPF package setup for Verilog or SystemVerilog testbench<\/u><\/p>\n<p><code><strong>import UPF::*;<br \/>\nmodule testbench;<br \/>\n...<br \/>\nendmodule<\/strong><\/code><\/p>\n<p>Note: UPF packages can be imported within or outside of the <strong>module-endmodule<\/strong> declaration.<\/p>\n<p><u>Example UPF package setup for a VHDL testbench<\/u><\/p>\n<p><code><strong>library ieee;<br \/>\nuse ieee.UPF.all;<\/strong><\/code><\/p>\n<p><code><strong>entity dut is<br \/>\n...<br \/>\nend entity;<\/strong><\/code><\/p>\n<p><code><strong>architecture arch of dut is<\/strong><\/code><\/p>\n<p><code><strong>begin<br \/>\n...<br \/>\nend arch;<\/strong><\/code><\/p>\n<p>The \u201c<strong>import UPF::*<\/strong>\u201d package and \u201c<strong>use ieee.UPF.all;<\/strong>\u201d library actually embeds the functions that are used to utilize and drive the design supply pads directly from the testbench. Thus, once these packages are referenced in the testbench, the simulator automatically searches for them from the simulator installation locations and makes the built-in functions of these packages available to utilize in the simulation environment. The following examples explain these functions, namely <strong>supply_on<\/strong> and <strong>supply_off<\/strong> with their detailed arguments.<\/p>\n<p><u>Example functions for Verilog and SystemVerilog testbenches to drive supply pads<\/u><\/p>\n<p><code><strong>supply_on( string pad_name, real value = 1.0, string file_info = \"\");<\/strong><\/code><\/p>\n<p><code><strong>supply_off( string pad_name, string file_info = \"\" );<\/strong><\/code><\/p>\n<p>Note: Questa Power Aware Simulator (PA SIM) users do not have to deal with the third argument, <strong>string file_info = &#8220;&#8221;<\/strong> \u2013 Questa will automatically take care of this.<\/p>\n<p><u>Example functions for a VHDL testbench driving supply pads<\/u><\/p>\n<p><code><strong>supply_on ( pad_name : IN string ; value : IN real ) return boolean;<\/strong><\/code><\/p>\n<p><code><strong>supply_off ( pad_name : IN string ) return boolean;<\/strong><\/code><\/p>\n<p>Regardless of the language used, the <strong>pad_name<\/strong> must be a string constant, and a valid top level UPF supply port must be passed to this argument along with a \u201cnon-zero\u201d real value to denote power \u201cOn\u201d, or \u201cempty\u201d to denote power \u201cOff\u201d. Questa PA-SIM will obtain the top module design name from the UPF <strong>set_scope<\/strong> commands defined below.<\/p>\n<p>Now that the basic package binding and initial wiring is setup, how do you actually control the design supply pad through a testbench?\u00a0 This is where the aforementioned UPF <strong>connect_supply_net<\/strong> or <strong>connect_supply_set<\/strong> and <strong>set_scope<\/strong> commands come in, as per the following code examples.<\/p>\n<p><u>Example <strong>UPF<\/strong> with <\/u><strong><u>connect_supply_net<\/u><\/strong><u> for utilizing supply pads from the testbench<\/u><\/p>\n<p><code><strong>set_scope cpu_top<br \/>\ncreate_power_domain PD_top<br \/>\n......<\/strong><\/code><\/p>\n<p><code><strong># IMPLEMENTATION UPF Snippet<br \/>\n# Create top level power domain supply ports<br \/>\ncreate_supply_port VDD_A -<em>domain<\/em> PD_top<br \/>\ncreate_supply_port VDD_B -domain PD_top<br \/>\ncreate_supply_port VSS -domain PD_top<\/strong><\/code><\/p>\n<p><code><strong># Create supply nets<br \/>\ncreate_supply_net VDD_A -<em>domain<\/em> PD_top<br \/>\ncreate_supply_net VDD_B -<em>domain<\/em> PD_top<br \/>\ncreate_supply_net VSS -<em>domain<\/em> PD_top<\/strong><\/code><\/p>\n<p><code><strong># Connect top level power domain supply ports to supply nets<br \/>\n<em>connect_supply_net<\/em> VDD_A -<em>ports<\/em> VDD_A<br \/>\n<em>connect_supply_net<\/em> VDD_B -<em>ports<\/em> VDD_B<br \/>\n<em>connect_supply_net<\/em> VSS -<em>ports<\/em> VSS<\/strong><\/code><\/p>\n<p>Next, the UPF <strong>connect_supply_net<\/strong> specified supply ports VDD_A, VDD_B, VSS, etc. can be directly driven from the testbench as shown in the following code example.<\/p>\n<p><code><strong>import UPF::*;<br \/>\nmodule testbench;<br \/>\n...<br \/>\nreg VDD_A, VDD_B, VSS;<br \/>\nreg ISO_ctrl;<br \/>\n...<br \/>\ninitial begin<br \/>\n#100<br \/>\nISO_ctrl = 1\u2019b1;<br \/>\nsupply_on (VDD_A, 1.10); \/\/ Values represent voltage &amp; non zero value<\/strong><\/code><\/p>\n<p><code><strong>\/\/ (1.10) signifies Power On<\/strong><\/code><\/p>\n<p><code><strong>supply_on (VSS, 0.0); \/\/ UPF LRM Specifies Ground VSS On at 0.0<br \/>\n...<br \/>\n#200<br \/>\nsupply_on (VDD_B, 1.10);<br \/>\n...<br \/>\n#400<br \/>\nsupply_off (VDD_A); \u00a0 \/\/ empty real value argument indicates Power Off<\/strong><\/code><\/p>\n<p><code><strong>...<br \/>\nend<br \/>\nendmodule<\/strong><\/code><\/p>\n<p>That\u2019s all there is to it!<\/p>\n<p>As you can glean from the examples, it is pretty easy to design a voltage regulator or a power management unit in the testbench through the functions <strong>supply_on<\/strong> and <strong>supply_off<\/strong> to mimic a real chip\u2019s power operations. Of course there are many more functions available under these UPF packages, but hopefully this article is enough to get you started.<\/p>\n<p>Joe Hupcey III<br \/>\nProgyna Khondkar<br \/>\nfor the Questa Low Power Design &amp; Verification product team<\/p>\n<p><strong>Related posts:<\/strong><\/p>\n<p>Part 11: The 2016 Wilson Research Group Functional Verification Study on ASIC\/IC Low Power Trends<\/p>\n<p>3 Things About UPF 3.0 You Need to Know Now<\/p>\n<p>Whitepaper: Advanced Verification of Low Power Designs<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Face facts: power supply nets are now effectively functional nets, but they are typically not defined in the design\u2019s RTL&#8230;.<\/p>\n","protected":false},"author":71594,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spanish_translation":"","french_translation":"","german_translation":"","italian_translation":"","polish_translation":"","japanese_translation":"","chinese_translation":"","footnotes":""},"categories":[1],"tags":[577,664,751,758,785,831,833],"industry":[],"product":[],"coauthors":[],"class_list":["post-12711","post","type-post","status-publish","format-standard","hentry","category-news","tag-low-power","tag-questa-pa-sim","tag-systemverilog","tag-testbench","tag-upf","tag-verilog","tag-vhdl"],"_links":{"self":[{"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/posts\/12711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/users\/71594"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/comments?post=12711"}],"version-history":[{"count":1,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/posts\/12711\/revisions"}],"predecessor-version":[{"id":17591,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/posts\/12711\/revisions\/17591"}],"wp:attachment":[{"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/media?parent=12711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/categories?post=12711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/tags?post=12711"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/industry?post=12711"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/product?post=12711"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/coauthors?post=12711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}