<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Lothar Miller - Kombinatorische Schleife</title>
    <link>http://www.lothar-miller.de/s9y/</link>
    <description>Elektronik und Musik</description>
    <dc:language>de</dc:language>
    <generator>Serendipity 1.3.1 - http://www.s9y.org/</generator>
    <pubDate>Tue, 23 Jun 2009 10:54:09 GMT</pubDate>

    <image>
        <url>http://www.lothar-miller.de/s9y/templates/bulletproof/img/s9y_banner_small.png</url>
        <title>RSS: Lothar Miller - Kombinatorische Schleife - Elektronik und Musik</title>
        <link>http://www.lothar-miller.de/s9y/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Kombinatorische Schleifen</title>
    <link>http://www.lothar-miller.de/s9y/archives/42-Kombinatorische-Schleifen.html</link>
            <category>Kombinatorische Schleife</category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/42-Kombinatorische-Schleifen.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=42</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.lothar-miller.de/s9y/rss.php?version=2.0&amp;type=comments&amp;cid=42</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
Eine &lt;b&gt;kombinatorische Schleife&lt;/b&gt; ist die Rückkopplung z.B. eines Zählerausgangs auf den Zählereingang. In der trivialsten und am leichtesten erkennbaren Form sieht das z.B. so aus:&lt;br /&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;pre&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;library&lt;/span&gt; &lt;span&gt;IEEE&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; &lt;span&gt;IEEE&lt;/span&gt;.&lt;span&gt;STD_LOGIC_1164&lt;/span&gt;.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; &lt;span&gt;IEEE&lt;/span&gt;.&lt;span&gt;NUMERIC_STD&lt;/span&gt;.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;entity&lt;/span&gt; &lt;span&gt;KS1&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;is&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;Port&lt;/span&gt; ( &lt;span&gt;onebit&lt;/span&gt; : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt;  &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;STD_LOGIC&lt;/span&gt;;&lt;br /&gt;           &lt;span&gt;dout&lt;/span&gt;   : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt;  &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;STD_LOGIC_VECTOR&lt;/span&gt; (&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;downto&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;0&lt;/span&gt;));&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span&gt;KS1&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; &lt;span&gt;Behavioral&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; &lt;span&gt;KS1&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;is&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; &lt;span&gt;counter&lt;/span&gt; : &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt; (&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;downto&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;0&lt;/span&gt;) := &lt;span style=&quot;background-color: rgb(255, 240, 240); color: rgb(221, 34, 0);&quot;&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;0000&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; &lt;span&gt;toggle&lt;/span&gt; : &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;0&#039;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;begin&lt;/span&gt;&lt;br /&gt;  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;process&lt;/span&gt; (&lt;span&gt;counter&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;begin&lt;/span&gt;&lt;br /&gt;     &lt;span&gt;counter&lt;/span&gt; &amp;lt;= &lt;span&gt;counter&lt;/span&gt;+&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;process&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;  &lt;span&gt;toggle&lt;/span&gt; &amp;lt;= &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;not&lt;/span&gt; &lt;span&gt;toggle&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;  &lt;span&gt;dout&lt;/span&gt;   &amp;lt;= &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(&lt;span&gt;counter&lt;/span&gt;);&lt;br /&gt;  &lt;span&gt;onebit&lt;/span&gt; &amp;lt;= &lt;span&gt;toggle&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span&gt;Behavioral&lt;/span&gt;;&lt;/pre&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;br /&gt;Bei der Synthese kommen ein paar Warnungen, die auf das Problem hindeuten:&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot; size=&quot;1&quot; color=&quot;#990000&quot;&gt;WARNING:Xst:2170 - Unit KS1 : the following signal(s) form a combinatorial loop: Madd_counter6.&lt;br /&gt;WARNING:Xst:2170 - Unit KS1 : the following signal(s) form a combinatorial loop: Madd_counter4.&lt;br /&gt;WARNING:Xst:2170 - Unit KS1 : the following signal(s) form a combinatorial loop: Madd_counter2.&lt;br /&gt;WARNING:Xst:2170 - Unit KS1 : the following signal(s) form a combinatorial loop: Madd_counter_cy&amp;lt;0&amp;gt;.&lt;br /&gt;WARNING:Xst:2170 - Unit KS1 : the following signal(s) form a combinatorial loop: onebit.&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Und das macht die Synthese dann daraus:&lt;br /&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 507px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:72 --&gt;&lt;img height=&quot;334&quot; width=&quot;507&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/CombinatorialLoop.gif&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Einfachste kombinatorische Schleifen&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;Theoretisch wäre das also ein Zähler, der mit maximaler Geschwindigkeit hochzählt, bzw. ein Inverter, der mit maximaler Geschwindigkeit vor sich hintoggelt. In der Praxis ist ein solcher Zähler allerdings eher ein Rauschgenerator, weil die Addition etliche Glitches hervorbringt, die wiederum den nächsten Zählerzustand beeinflussen. &lt;p&gt;Der rückgekoppelte Invertierer bringt auch ein eher analoges Signal hervor, das in der Praxis kaum verwendbar ist.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Sowas wird also niemand bewusst machen. Kombinatorische Schleifen entstehen allerdings oft unbeabsichtigt bei der Zwei-Prozess-Schreibweise einer FSM. &lt;br /&gt;&lt;br /&gt;Hier ein kleines, eher praxisnahes Beispiel: &lt;br /&gt;Ein Zustandsautomat mit 2 Zuständen (&lt;b&gt;&lt;i&gt;idle &lt;/i&gt;&lt;/b&gt;und &lt;b&gt;&lt;i&gt;work&lt;/i&gt;&lt;/b&gt;) soll im Zustand &lt;i&gt;&lt;b&gt;work &lt;/b&gt;&lt;/i&gt;auf 8 zählen. Das ist z.B. nötig für irgendeine Verzögerung. Nach Erreichen des Wertes 8 wird auf den nächsten Zustand umgeschaltet, hier wieder zurück auf &lt;b&gt;&lt;i&gt;idle&lt;/i&gt;&lt;/b&gt;. Getaktet wird der Folgezustand &lt;i&gt;&lt;b&gt;next_state&lt;/b&gt;&lt;/i&gt; auf den Zustand &lt;i&gt;&lt;b&gt;state &lt;/b&gt;&lt;/i&gt;abgebildet, aus dem im kombinatorischen Prozess wiederum der Folgezustand ermittelt wird.&lt;br /&gt;&lt;br /&gt;In der Kombinatorik werden also die Weiterschaltbedingungen zwischen &lt;b&gt;&lt;i&gt;idle &lt;/i&gt;&lt;/b&gt;und &lt;b&gt;&lt;i&gt;work&lt;/i&gt;&lt;/b&gt; ausgewertet und (jetzt kommts) weil dort schon &lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot; color=&quot;#990000&quot;&gt;case state is ... when work =&amp;gt;&lt;/font&gt; &lt;br /&gt;steht, der Einfachheit halber gleich noch der Zähler in den Zustand work eingebaut. Heraus kommt also sowas:&lt;br /&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;library&lt;/span&gt; &lt;span&gt;IEEE&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; &lt;span&gt;IEEE&lt;/span&gt;.&lt;span&gt;STD_LOGIC_1164&lt;/span&gt;.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; &lt;span&gt;IEEE&lt;/span&gt;.&lt;span&gt;NUMERIC_STD&lt;/span&gt;.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;entity&lt;/span&gt; &lt;span&gt;KS&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;is&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;Port&lt;/span&gt; ( &lt;span&gt;clk&lt;/span&gt; : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;in&lt;/span&gt;  &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;STD_LOGIC&lt;/span&gt;;&lt;br /&gt;           &lt;span&gt;dout&lt;/span&gt; : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt;  &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;STD_LOGIC_VECTOR&lt;/span&gt; (&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;downto&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;0&lt;/span&gt;));&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span&gt;KS&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; &lt;span&gt;Behavioral&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; &lt;span&gt;KS&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;is&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;type&lt;/span&gt; &lt;span&gt;state_t&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;is&lt;/span&gt; (&lt;span&gt;idle&lt;/span&gt;, &lt;span&gt;work&lt;/span&gt;);&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; &lt;span&gt;state&lt;/span&gt;, &lt;span&gt;next_state&lt;/span&gt; : &lt;span&gt;state_t&lt;/span&gt; := &lt;span&gt;idle&lt;/span&gt;; &lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; &lt;span&gt;counter&lt;/span&gt; : &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt; (&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;downto&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;0&lt;/span&gt;) := &lt;span style=&quot;background-color: rgb(255, 240, 240); color: rgb(221, 34, 0);&quot;&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;0000&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;begin&lt;/span&gt;&lt;br /&gt;   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;process&lt;/span&gt; (&lt;span&gt;clk&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;begin&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span&gt;rising_edge&lt;/span&gt;(&lt;span&gt;clk&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;br /&gt;         &lt;span&gt;state&lt;/span&gt;   &amp;lt;= &lt;span&gt;next_state&lt;/span&gt;;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt;;&lt;br /&gt;   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;process&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;process&lt;/span&gt; (&lt;span&gt;state&lt;/span&gt;,  &lt;span&gt;counter&lt;/span&gt;)&lt;br /&gt;   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;begin&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span&gt;state&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;is&lt;/span&gt; &lt;br /&gt;         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;when&lt;/span&gt; &lt;span&gt;idle&lt;/span&gt;  =&amp;gt; &lt;span&gt;next_state&lt;/span&gt; &amp;lt;= &lt;span&gt;work&lt;/span&gt;;&lt;br /&gt;                       &lt;span&gt;counter&lt;/span&gt; &amp;lt;= &lt;span style=&quot;background-color: rgb(255, 240, 240); color: rgb(221, 34, 0);&quot;&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;0000&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;;&lt;br /&gt;         &lt;br /&gt;         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;when&lt;/span&gt; &lt;span&gt;work&lt;/span&gt;  =&amp;gt; &lt;span&gt;counter&lt;/span&gt; &amp;lt;= &lt;span&gt;counter&lt;/span&gt;+&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;;&lt;br /&gt;                       &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;counter&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;br /&gt;                          &lt;span&gt;next_state&lt;/span&gt; &amp;lt;= &lt;span&gt;idle&lt;/span&gt;;&lt;br /&gt;                       &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;                          &lt;span&gt;next_state&lt;/span&gt; &amp;lt;= &lt;span&gt;work&lt;/span&gt;;&lt;br /&gt;                       &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt;;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;case&lt;/span&gt;;&lt;br /&gt;   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;process&lt;/span&gt;;&lt;br /&gt;   &lt;br /&gt;   &lt;span&gt;dout&lt;/span&gt; &amp;lt;= &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(&lt;span&gt;counter&lt;/span&gt;);&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span&gt;Behavioral&lt;/span&gt;;&lt;/pre&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;br /&gt;Bei der Synthese werde ich nun wieder freundlich mit einer Warnung auf meinen Fehler hingewiesen:&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot; size=&quot;1&quot; color=&quot;#990000&quot;&gt;WARNING:Xst:2170 - Unit KS : the following signal(s) form a combinatorial loop: Madd_counter_addsub00006, counter_addsub0000&amp;lt;3&amp;gt;.&lt;br /&gt;WARNING:Xst:2170 - Unit KS : the following signal(s) form a combinatorial loop: Madd_counter_addsub00004, counter_addsub0000&amp;lt;2&amp;gt;.&lt;br /&gt;WARNING:Xst:2170 - Unit KS : the following signal(s) form a combinatorial loop: counter_addsub0000&amp;lt;1&amp;gt;, Madd_counter_addsub00002.&lt;br /&gt;WARNING:Xst:2170 - Unit KS : the following signal(s) form a combinatorial loop: Madd_counter_addsub0000_cy&amp;lt;0&amp;gt;.&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Der Simulator sagt dann aber schon deutlicher, dass es so nicht geht:&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot; color=&quot;#0000ff&quot;&gt;# ** Error: (vsim-3601) Iteration limit reached at time 10 ns.&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Was ist passiert?&lt;br /&gt;Weil der Zähler in den kombinatorischen Prozess eingebaut wurde, und zum Glück die Sensitiv-Liste des Prozesses vollständig ist, wird bei der ersten steigenden Flanke von &lt;i&gt;&lt;b&gt;clk &lt;/b&gt;&lt;/i&gt;der Zustand &lt;i&gt;&lt;b&gt;work &lt;/b&gt;&lt;/i&gt;auf &lt;i&gt;&lt;b&gt;state&lt;/b&gt;&lt;b&gt;work &lt;/b&gt;&lt;/i&gt; übernommen. Im Zustand zählt der Zähler &lt;i&gt;&lt;b&gt;counter &lt;/b&gt;&lt;/i&gt;um eins hoch. Nach Abarbeiten des Prozesses wird erkannt, dass sich &lt;i&gt;&lt;b&gt;counter &lt;/b&gt;&lt;/i&gt;geändert hat. Bei Erreichen des Wertes 8 wird der Folgezustand &lt;i&gt;&lt;b&gt;idle &lt;/b&gt;&lt;/i&gt;auf &lt;i&gt;&lt;b&gt;next_state&lt;/b&gt;&lt;/i&gt; geschrieben. &lt;br /&gt;Allerdings hat sich in diesem Durchlauf &lt;i&gt;&lt;b&gt;counter &lt;/b&gt;&lt;/i&gt;wieder geändert, was eine sofortige Neuberechnung des kombinatorischen Prozesses nach sich zieht. Also wird wieder gerechnet &lt;i&gt;&lt;b&gt;counter &amp;lt;= counter+1;&lt;/b&gt;&lt;/i&gt; und das geht bis zum bitteren Ende so weiter...&lt;br /&gt;&lt;br /&gt;Wenn man sich das Syntheseergebnis im Schaltplan ansieht, erkennt man die kombinatorische Rückkopplung sofort wieder.&lt;br /&gt;&lt;!-- s9ymdb:71 --&gt;&lt;img class=&quot;serendipity_image_center&quot; style=&quot;border: 0px none ; padding-left: 5px; padding-right: 5px; width: 700px; height: 312px;&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/KombinatorischeSchleife.gif&quot; /&gt;&lt;br /&gt;Die Wahrscheinlichkeit, dass hier beim nächsten Takt richtig weitergemacht wird (also bei &lt;i&gt;&lt;b&gt;idle&lt;/b&gt;&lt;/i&gt;) liegt bestenfalls bei 1:16.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Interessant wird es, wenn das Hochzählen in die if-Abfrage verlagert wird:&lt;br /&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;pre&gt;         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;when&lt;/span&gt; &lt;span&gt;work&lt;/span&gt;  =&amp;gt; &lt;span&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;counter&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;br /&gt;                          &lt;span&gt;next_state&lt;/span&gt; &amp;lt;= &lt;span&gt;idle&lt;/span&gt;;&lt;br /&gt;                       &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;                          &lt;span&gt;counter&lt;/span&gt;    &amp;lt;= &lt;span&gt;counter&lt;/span&gt;+&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;;&lt;br /&gt;                          &lt;span&gt;next_state&lt;/span&gt; &amp;lt;= &lt;span&gt;work&lt;/span&gt;;&lt;br /&gt;                       &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt;;&lt;/pre&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;br /&gt;Dann wird in der Simulation mit jedem Takt zwischen den Zuständen &lt;i&gt;&lt;b&gt;idle &lt;/b&gt;&lt;/i&gt;und &lt;i&gt;&lt;b&gt;work &lt;/b&gt;&lt;/i&gt;hin- und hergeschaltet, allerdings tauchen die &lt;i&gt;&lt;b&gt;counter&lt;/b&gt;&lt;/i&gt;-Werte 1-7 niemals auf. Sie werden in der (theoretischen) Zeit 0 durchlaufen.&lt;br /&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 630px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:75 --&gt;&lt;img height=&quot;100&quot; width=&quot;630&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/KombSchleifeLatchSim.gif&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Der kombinatorische Zähler in der Simulation&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;In der Praxis versteckt sich die kombinatorsche Schleife jetzt wesentlich besser in einem Latch &lt;br /&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 630px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:74 --&gt;&lt;img height=&quot;562&quot; width=&quot;630&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/KombSchleifeLatch.gif&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Kombinatorischer gegateter Zähler&lt;/div&gt;&lt;/div&gt;und es gibt bei der Synthese nur noch die Warnung:&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot; size=&quot;2&quot; color=&quot;#990000&quot;&gt;WARNING:Xst:737 - Found 4-bit latch for signal &amp;lt;counter&amp;gt;&lt;/font&gt;&lt;br /&gt;Allerdings wird sich dieses Design in der Realität nicht so verhalten wie in der Simulation, &lt;br /&gt;weil hier Glitches und Laufzeitverzögerungen einen Strich durch die Rechnung machen werden.&lt;br /&gt;&lt;br /&gt;Wie Zähler in der Zwei-Prozess-Schreibweise richtig aussehen müssen, ist zu finden im Kapitel&lt;br /&gt;&lt;a href=&quot;http://www.lothar-miller.de/s9y/categories/37-FSM-Schreibweisen&quot; title=&quot;FSM-Schreibweisen&quot;&gt;Ein- oder Zwei-Prozess-Schreibweise von FSM&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Wie eine kombinatorische Schleife gewinnbringend angewendet werden kann, findet sich unter &lt;a href=&quot;http://www.lothar-miller.de/s9y/categories/29-Ringoszillator&quot; title=&quot;Ringoszillator&quot;&gt;Ringoszillator&lt;/a&gt;.
 
    </content:encoded>

    <pubDate>Tue, 23 Jun 2009 09:24:02 +0200</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/42-guid.html</guid>
    
</item>

</channel>
</rss>
