<?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 - FSM</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>Thu, 09 Jul 2009 07:35:24 GMT</pubDate>

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

<item>
    <title>FSM debuggen</title>
    <link>http://www.lothar-miller.de/s9y/archives/49-FSM-debuggen.html</link>
            <category>FSM</category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/49-FSM-debuggen.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=49</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=49</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
&lt;p&gt;Wenn ich eine &lt;b&gt;State-Machine in der Hardware debuggen&lt;/b&gt; will, ist es oft sinnvoll, auf ein paar LEDs oder Ausgangspins am Logikanalyzer zu sehen, was gerade in der SM abgeht. Die manuelle Variante ist nun, dem Debugport die States in einem extra dafür gerschriebenen Prozess die Information zuzuordnen:&lt;/p&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;DebugFSM&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;state_as_vector&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;DebugFSM&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;DebugFSM&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;states&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;is&lt;/span&gt; (&lt;span&gt;s0&lt;/span&gt;,&lt;span&gt;s1&lt;/span&gt;,&lt;span&gt;s2&lt;/span&gt;,&lt;span&gt;s3&lt;/span&gt;,&lt;span&gt;s4&lt;/span&gt;,&lt;span&gt;s5&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;states&lt;/span&gt; := &lt;span&gt;s0&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 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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;until&lt;/span&gt; &lt;span&gt;rising_edge&lt;/span&gt;(&lt;span&gt;clk&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;s0&lt;/span&gt; =&amp;gt; &lt;span&gt;state&lt;/span&gt; &amp;lt;= &lt;span&gt;s1&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;s5&lt;/span&gt; =&amp;gt; &lt;span&gt;state&lt;/span&gt; &amp;lt;= &lt;span&gt;s0&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 style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;others&lt;/span&gt;  =&amp;gt; &lt;span&gt;state&lt;/span&gt; &amp;lt;= &lt;span&gt;s0&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 style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Kombinatorisches Zuweisen der States auf die Debug-Signale&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;state&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;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;s0&lt;/span&gt; =&amp;gt; &lt;span&gt;state_as_vector&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;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;when&lt;/span&gt; &lt;span&gt;s1&lt;/span&gt; =&amp;gt; &lt;span&gt;state_as_vector&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;0001&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;when&lt;/span&gt; &lt;span&gt;s2&lt;/span&gt; =&amp;gt; &lt;span&gt;state_as_vector&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;0010&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;when&lt;/span&gt; &lt;span&gt;s3&lt;/span&gt; =&amp;gt; &lt;span&gt;state_as_vector&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;0011&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;when&lt;/span&gt; &lt;span&gt;s4&lt;/span&gt; =&amp;gt; &lt;span&gt;state_as_vector&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;0100&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;when&lt;/span&gt; &lt;span&gt;s5&lt;/span&gt; =&amp;gt; &lt;span&gt;state_as_vector&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;0101&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;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 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;Wesentlich eleganter geht es allerdings, wenn das attribut &lt;b&gt;&#039;pos&lt;/b&gt; auf den Aufzählungstyp angewendet wird:&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;DebugFSM&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;state_as_vector&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;DebugFSM&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;DebugFSM&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;states&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;is&lt;/span&gt; (&lt;span&gt;s0&lt;/span&gt;,&lt;span&gt;s1&lt;/span&gt;,&lt;span&gt;s2&lt;/span&gt;,&lt;span&gt;s3&lt;/span&gt;,&lt;span&gt;s4&lt;/span&gt;,&lt;span&gt;s5&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;states&lt;/span&gt; := &lt;span&gt;s0&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 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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;until&lt;/span&gt; &lt;span&gt;rising_edge&lt;/span&gt;(&lt;span&gt;clk&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;s0&lt;/span&gt; =&amp;gt; &lt;span&gt;state&lt;/span&gt; &amp;lt;= &lt;span&gt;s1&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;s5&lt;/span&gt; =&amp;gt; &lt;span&gt;state&lt;/span&gt; &amp;lt;= &lt;span&gt;s0&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 style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;others&lt;/span&gt;  =&amp;gt; &lt;span&gt;state&lt;/span&gt; &amp;lt;= &lt;span&gt;s0&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 style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Zuweisen der States auf die Debug-Signale&lt;/span&gt;&lt;br /&gt;   &lt;span&gt;state_as_vector&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;to_unsigned&lt;/span&gt;(&lt;span&gt;states&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;p&lt;/span&gt;&lt;span&gt;os&lt;/span&gt;(&lt;span&gt;state&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;4&lt;/span&gt;));&lt;br /&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;p /&gt;&lt;p&gt;Da Zählung (Enumeration) des entsprechenden Zustandes links mit 0 beginnt, bestimmt die Position auch den Zahlenwert. Die beiden beschriebenen Beispiele verhalten sich also unabhängig von der tatsächlichen Implementation der Statemachine (Binär, One-Hot, Gray,...) gleich.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Wed, 08 Jul 2009 20:35:00 +0200</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/49-guid.html</guid>
    
</item>
<item>
    <title>Ein- oder Zwei-Prozess-Schreibweise für FSM</title>
    <link>http://www.lothar-miller.de/s9y/archives/43-Ein-oder-Zwei-Prozess-Schreibweise-fuer-FSM.html</link>
            <category>FSM</category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/43-Ein-oder-Zwei-Prozess-Schreibweise-fuer-FSM.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=43</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=43</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
Immer wieder kommt die Diskussion auf, ob denn jetzt die Ein- oder Zwei-Prozess-Darstellung von Zustandsautomaten einfacher zu verstehen und implementieren sei.&lt;br /&gt;&lt;br /&gt;Wenn man aus der schulmäßigen Logik herkommt, dann wird ein Automat auf eine Weiterschaltlogik (die den Folgezustand ermittelt) und einen Zustandsspeicher abgebildet.&lt;br /&gt;&lt;br /&gt;Es wird also eine Abbildung in zwei Prozesse nahegelegt: &lt;br /&gt;1) der eine Prozess übernimmt taktgesteuert den Folgezustand, der&lt;br /&gt;2) vom anderen Prozess aus den Eingangssignalen und/oder dem aktuellen Zustand ermittelt wird.&lt;br /&gt;&lt;br /&gt;Damit könnte ein einfacher Automat mit den Zuständen &lt;i&gt;&lt;b&gt;reset&lt;/b&gt;&lt;/i&gt;, &lt;i&gt;&lt;b&gt;idle&lt;/b&gt;&lt;/i&gt;, &lt;i&gt;&lt;b&gt;work &lt;/b&gt;&lt;/i&gt;und &lt;i&gt;&lt;b&gt;done &lt;/b&gt;&lt;/i&gt;so aussehen:&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;FSM&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;rst&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;start&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;stop&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;FSM&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;Verhalten&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; &lt;span&gt;FSM&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;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;reset&lt;/span&gt;, &lt;span&gt;idle&lt;/span&gt;, &lt;span&gt;work&lt;/span&gt;, &lt;span&gt;done&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&gt;next_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;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 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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;until&lt;/span&gt; &lt;span&gt;rising_edge&lt;/span&gt;(&lt;span&gt;clk&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&gt;counter&lt;/span&gt; &amp;lt;= &lt;span&gt;next_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 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;rst&lt;/span&gt;, &lt;span&gt;start&lt;/span&gt;, &lt;span&gt;stop&lt;/span&gt;, &lt;span&gt;delay&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;span&gt;&lt;br /&gt;      next_counter&lt;/span&gt; &amp;lt;= (&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;others&lt;/span&gt;=&amp;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;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;reset&lt;/span&gt; =&amp;gt; &lt;span&gt;next_state&lt;/span&gt;   &amp;lt;= &lt;span&gt;idle&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;idle&lt;/span&gt;  =&amp;gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;start&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;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;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 style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;stop&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;done&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&gt;next_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;br /&gt;         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;when&lt;/span&gt; &lt;span&gt;done&lt;/span&gt;  =&amp;gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;stop&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;0&#039;&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;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;if&lt;/span&gt; (&lt;span&gt;rst&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;reset&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&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;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span&gt;Verhalten&lt;/span&gt;;&lt;/pre&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;Aus dem Zustand &lt;i&gt;&lt;b&gt;idle &lt;/b&gt;&lt;/i&gt;kommend, wird mit dem Signal &lt;i&gt;&lt;b&gt;start &lt;/b&gt;&lt;/i&gt;der Zustand &lt;i&gt;&lt;b&gt;work &lt;/b&gt;&lt;/i&gt;angesprungen. Im Zustand &lt;i&gt;&lt;b&gt;work &lt;/b&gt;&lt;/i&gt;wird der Zähler solange hochgezählt, bis das Signal &lt;i&gt;&lt;b&gt;stop &lt;/b&gt;&lt;/i&gt;aktiv wird. Danach geht es über den Zustand &lt;i&gt;&lt;b&gt;done &lt;/b&gt;&lt;/i&gt;zurück nach &lt;i&gt;&lt;b&gt;idle&lt;/b&gt;&lt;/i&gt;. Wird der Eingang &lt;i&gt;&lt;b&gt;rst &lt;/b&gt;&lt;/i&gt;aktiv, so geht es ohne Umleitung in den Zustand &lt;i&gt;&lt;b&gt;reset&lt;/b&gt;&lt;/i&gt;. Parallel wird der Zähler &lt;i&gt;&lt;b&gt;counter &lt;/b&gt;&lt;/i&gt;concurrent auf &lt;i&gt;&lt;b&gt;dout &lt;/b&gt;&lt;/i&gt;ausgegeben.&lt;br /&gt;&lt;br /&gt;Weil ein Zähler auch nur eine FSM ist, muß für das Hochzählen von &lt;i&gt;&lt;b&gt;counter &lt;/b&gt;&lt;/i&gt;in der Kombinatorik der Folge-Zählerstand &lt;i&gt;&lt;b&gt;next_counter&lt;/b&gt;&lt;/i&gt; ermittelt werden. Dieser wird dann mit dem nächsten Takt auf &lt;i&gt;&lt;b&gt;counter &lt;/b&gt;&lt;/i&gt;übernommen.&lt;br /&gt;&lt;br /&gt;Bis hierher war es eigentlich noch übersichtlich. &lt;br /&gt;Jetzt möchte ich aber gerne das Hochzählen von &lt;i&gt;&lt;b&gt;counter &lt;/b&gt;&lt;/i&gt;im Zustand &lt;i&gt;&lt;b&gt;work &lt;/b&gt;&lt;/i&gt;etwas gemächlicher gestalten. Ein Verzögerungszähler für 10 Takte &lt;i&gt;&lt;b&gt;delay &lt;/b&gt;&lt;/i&gt;(von 0 bis 9) vor dem Hochzählen von &lt;i&gt;&lt;b&gt;counter&lt;/b&gt;&lt;/i&gt; muß her. &lt;br /&gt;Jetzt könnte ich das Spiel genauso wie mit &lt;i&gt;&lt;b&gt;counter &lt;/b&gt;&lt;/i&gt;und &lt;i&gt;&lt;b&gt;next_counter&lt;/b&gt;&lt;/i&gt; machen, aber diesmal bin ich zu faul und nehme den Verzögerungszähler &lt;i&gt;&lt;b&gt;delay &lt;/b&gt;&lt;/i&gt;einfach gleich in den getakteten Teil:&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;architecture&lt;/span&gt; &lt;span&gt;Verhalten&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; &lt;span&gt;FSM&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;reset&lt;/span&gt;, &lt;span&gt;idle&lt;/span&gt;, &lt;span&gt;work&lt;/span&gt;, &lt;span&gt;done&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;delay&lt;/span&gt; : &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;integer&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&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;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;to&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;9&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;signal&lt;/span&gt; &lt;span&gt;counter&lt;/span&gt;, &lt;span&gt;next_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;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 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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;until&lt;/span&gt; &lt;span&gt;rising_edge&lt;/span&gt;(&lt;span&gt;clk&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&gt;counter&lt;/span&gt; &amp;lt;= &lt;span&gt;next_counter&lt;/span&gt;;&lt;br /&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;state&lt;/span&gt;=&lt;span&gt;idle&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt; &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- in idle: Delay-Zähler zurücksetzen&lt;/span&gt;&lt;br /&gt;         &lt;span&gt;delay&lt;/span&gt; &amp;lt;= &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 style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt;;&lt;br /&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;state&lt;/span&gt;=&lt;span&gt;work&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt; &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- in work: hier wird gezählt&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;delay&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;9&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt;  &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- solange kleiner 9:&lt;/span&gt;&lt;br /&gt;            &lt;span&gt;delay&lt;/span&gt; &amp;lt;= &lt;span&gt;delay&lt;/span&gt;+&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;; &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- zählen&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;delay&lt;/span&gt; &amp;lt;= &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;0&lt;/span&gt;;       &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- sonst zurücksetzen&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;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;rst&lt;/span&gt;, &lt;span&gt;start&lt;/span&gt;, &lt;span&gt;stop&lt;/span&gt;, &lt;span&gt;delay&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;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;&lt;/span&gt;      &lt;span&gt;&lt;br /&gt;      next_counter&lt;/span&gt; &amp;lt;= (&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;others&lt;/span&gt;=&amp;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;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;reset&lt;/span&gt; =&amp;gt; &lt;span&gt;&lt;/span&gt;&lt;span&gt;next_state&lt;/span&gt;   &amp;lt;= &lt;span&gt;idle&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;idle&lt;/span&gt;  =&amp;gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;start&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;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;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 style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;delay&lt;/span&gt; = &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;9&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt;           &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- wenn das Delay abgelaufen ist:&lt;/span&gt;&lt;br /&gt;                          &lt;span&gt;next_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;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- counter um eins hochzählen&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;br /&gt;                       &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;stop&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;done&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;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;done&lt;/span&gt;  =&amp;gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;stop&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;0&#039;&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;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;if&lt;/span&gt; (&lt;span&gt;rst&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;reset&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&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;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span&gt;Verhalten&lt;/span&gt;;&lt;/pre&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;br /&gt;Fertig. Hurra, die Simulation zeigt, dass es geht:&lt;br /&gt;&lt;div style=&quot;width: 800px;&quot; class=&quot;serendipity_imageComment_center&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:76 --&gt;&lt;img height=&quot;152&quot; width=&quot;800&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/FSM.gif&quot; class=&quot;serendipity_image_center&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Simulation: &lt;b&gt;counter&lt;/b&gt; mit &lt;b&gt;delay&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;Aber wer sich den Code ein halbes Jahr später anschaut, wird den Kopf schütteln, und sich fragen, wie und was da wann wozu verwendet wird.&lt;br /&gt;&lt;br /&gt;Ich schreibe deshalb meine State-Machines nur noch in der Ein-Prozess-Darstellung. In dieser Darstellungsart wandert einfach nur die Weiterschaltlogik in den getakteten Teil. Das obige Beispiel sieht also 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;architecture&lt;/span&gt; &lt;span&gt;Verhalten&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; &lt;span&gt;FSM&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;reset&lt;/span&gt;, &lt;span&gt;idle&lt;/span&gt;, &lt;span&gt;work&lt;/span&gt;, &lt;span&gt;done&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;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;delay&lt;/span&gt; : &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;integer&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&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;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;to&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;9&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;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;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;begin&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 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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;until&lt;/span&gt; &lt;span&gt;rising_edge&lt;/span&gt;(&lt;span&gt;clk&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;reset&lt;/span&gt; =&amp;gt; &lt;span&gt;counter&lt;/span&gt; &amp;lt;= (&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;others&lt;/span&gt;=&amp;gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;0&#039;&lt;/span&gt;);&lt;br /&gt;                       &lt;span&gt;state&lt;/span&gt;   &amp;lt;= &lt;span&gt;idle&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;idle&lt;/span&gt;  =&amp;gt; &lt;span&gt;delay&lt;/span&gt;   &amp;lt;= &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;if&lt;/span&gt; (&lt;span&gt;start&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;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;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 style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;delay&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;9&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt;      &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- solange kleiner 9:&lt;/span&gt;&lt;br /&gt;                          &lt;span&gt;delay&lt;/span&gt; &amp;lt;= &lt;span&gt;delay&lt;/span&gt;+&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;;     &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- zählen&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;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- sonst:&lt;/span&gt;&lt;br /&gt;                          &lt;span&gt;delay&lt;/span&gt;   &amp;lt;= &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;0&lt;/span&gt;;         &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- zurücksetzen&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;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- und counter hochzählen&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;br /&gt;                       &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;stop&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;done&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;br /&gt;         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;when&lt;/span&gt; &lt;span&gt;done&lt;/span&gt;  =&amp;gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;stop&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;0&#039;&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;idle&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;if&lt;/span&gt; (&lt;span&gt;rst&lt;/span&gt;=&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;reset&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&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;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span&gt;Verhalten&lt;/span&gt;;&lt;/pre&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;Diese Ein-Prozess-Beschreibung ergibt genau das selbe Simulationsergebnis, sie hat aber deutliche Vorteile:&lt;br /&gt;1) Deutlich weniger Schreibaufwand und bessere Übersicht&lt;br /&gt;2) Ich brauche weniger Signale (next_counter, next_state)&lt;br /&gt;3) Das Ganze ist garantiert synchron&lt;br /&gt;4) Die Ausgangssignale sind registriert und damit synchron&lt;br /&gt;5) Es werden garantiert keine &lt;a href=&quot;http://www.lothar-miller.de/s9y/categories/36-Kombinatorische-Schleife&quot; title=&quot;Kombinatorische Schleife&quot;&gt;Kombinatorischen Schleifen&lt;/a&gt; erzeugt&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
 
    </content:encoded>

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

</channel>
</rss>
