<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.verific.com/faq/index.php?action=history&amp;feed=atom&amp;title=Extract_clock_enable</id>
		<title>Extract clock enable - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://www.verific.com/faq/index.php?action=history&amp;feed=atom&amp;title=Extract_clock_enable"/>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Extract_clock_enable&amp;action=history"/>
		<updated>2026-05-02T14:04:57Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.3</generator>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Extract_clock_enable&amp;diff=344&amp;oldid=prev</id>
		<title>Hoa: Created page with &quot;Here is a small example which will extract clock-enables for every DFF in the design.  It uses both CheckDriverFrom() (to check if there is any potential clock-enable) as well...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Extract_clock_enable&amp;diff=344&amp;oldid=prev"/>
				<updated>2019-03-01T21:08:00Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Here is a small example which will extract clock-enables for every DFF in the design.  It uses both CheckDriverFrom() (to check if there is any potential clock-enable) as well...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Here is a small example which will extract clock-enables for every DFF in the design.&lt;br /&gt;
&lt;br /&gt;
It uses both CheckDriverFrom() (to check if there is any potential clock-enable) as well as ExtractCondition() to actually extract the clock-enables and reorganize the logic.&lt;br /&gt;
&lt;br /&gt;
Please note that this (clock-enable and set/reset extraction) is pretty dependent on the STRUCTURE of the logic.  We rely on MUX2's to be there, so that data and control flow is still clearly recognizable.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
MapIter mi ;&lt;br /&gt;
Instance *inst ;&lt;br /&gt;
&lt;br /&gt;
// Extract clock-enables. (this goes best without any optimization to the netlist)&lt;br /&gt;
FOREACH_INSTANCE_OF_NETLIST(this, mi, inst) {&lt;br /&gt;
    if (inst-&amp;gt;Type() != PRIM_DFFRS &amp;amp;&amp;amp; inst-&amp;gt;Type() != PRIM_DFF) continue ;&lt;br /&gt;
&lt;br /&gt;
    // Go to d-input :&lt;br /&gt;
    Net *d = inst-&amp;gt;GetInput() ;&lt;br /&gt;
    Net *q = inst-&amp;gt;GetOutput() ;&lt;br /&gt;
    if (!d) continue ;&lt;br /&gt;
&lt;br /&gt;
    Set check_list(POINTER_HASH) ;&lt;br /&gt;
    // Check clock-enable extraction :&lt;br /&gt;
    if (d-&amp;gt;CheckDriverFrom(q, check_list)) {&lt;br /&gt;
    // Go an extract the condition :&lt;br /&gt;
    Net *drive_cond = 0 ;&lt;br /&gt;
    Map drive_conditions(POINTER_HASH) ;&lt;br /&gt;
    Map return_values(POINTER_HASH) ;&lt;br /&gt;
    // FIX ME : We might not need to replicate the cone. Only if fanout is encountered...&lt;br /&gt;
    Net *new_d = d-&amp;gt;ExtractCondition(q, &amp;amp;drive_cond, 0/*don't need z-condition */, 1 /*replicate*/, drive_conditions, return_values) ;&lt;br /&gt;
    if (!drive_cond) continue ; // if no feedback condition was found after all, leave circuit as-is ?&lt;br /&gt;
&lt;br /&gt;
    // Create a MUX with feedback loop from q :&lt;br /&gt;
    new_d = inst-&amp;gt;Owner()-&amp;gt;Mux(q, new_d, drive_cond, inst-&amp;gt;Linefile()) ;&lt;br /&gt;
&lt;br /&gt;
    // Replace existing d input with this new one :&lt;br /&gt;
    Port *d_port = inst-&amp;gt;View()-&amp;gt;GetInput() ;&lt;br /&gt;
    inst-&amp;gt;Disconnect(d_port) ;&lt;br /&gt;
    inst-&amp;gt;Connect(d_port, new_d) ;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hoa</name></author>	</entry>

	</feed>