<?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 - Encoder</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>Sat, 06 Nov 2010 19:51:22 GMT</pubDate>

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

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

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
&lt;p&gt;Um aus einem &lt;b&gt;Drehgebersignal (Quadratursignal) &lt;/b&gt;mit den A und B Spuren ein &lt;b&gt;Postitionssignal &lt;/b&gt;zu machen, bedient man sich am einfachsten eines Zustandsautomaten, der aus jedem Wechsel des Graycodes einen Zählschritt erzeugt.&lt;br /&gt;Der von Drehgebern und Drehencodern ausgegebene &lt;b&gt;Gray-Code&lt;/b&gt; hat den angenehmen Effekt, dass sich pro Zählschritt nur 1 Bit ändert. Damit ergibt sich folgende Zählweise&lt;/p&gt;&lt;p&gt;&lt;table height=&quot;95&quot; width=&quot;100&quot; cellspacing=&quot;1&quot; cellpadding=&quot;1&quot; border=&quot;1&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align=&quot;center&quot; style=&quot;width: 50%;&quot;&gt;0&lt;/td&gt;&lt;td align=&quot;center&quot; style=&quot;width: 50%;&quot;&gt;00&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;center&quot; style=&quot;width: 50%;&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot; style=&quot;width: 50%;&quot;&gt;01&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;center&quot; style=&quot;width: 50%;&quot;&gt;2&lt;/td&gt;&lt;td align=&quot;center&quot; style=&quot;width: 50%;&quot;&gt;11&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;center&quot; style=&quot;width: 50%;&quot;&gt;3&lt;/td&gt;&lt;td align=&quot;center&quot; style=&quot;width: 50%;&quot;&gt;10&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Die Übergänge stellen sich grafisch so dar:&lt;/p&gt;&lt;div style=&quot;width: 490px;&quot; class=&quot;serendipity_imageComment_center&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:99 --&gt;&lt;img style=&quot;width: 490px; height: 693px;&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/Quadratur.gif&quot; class=&quot;serendipity_image_center&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Zählweise bei Signalübergängen&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;Man sieht, dass die Flanken einer Spur und der zugehörige Pegel der anderen Spur die Zählrichtung und den Zählimpuls liefern. Anhand der entsprechenden Flanken und der Zustände des jeweils anderen Signals könnte man jetzt folgende Auswertung bauen:&lt;p /&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&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;EncoderSim&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;A&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;B&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;Position&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;31&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;EncoderSim&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;EncoderSim&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;p&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, 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;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;A&lt;/span&gt;,&lt;span&gt;B&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;A&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 style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;B&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;span&gt;p&lt;/span&gt;&amp;lt;=&lt;span&gt;p&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(0, 136, 0); font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span&gt;p&lt;/span&gt;&amp;lt;=&lt;span&gt;p&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(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;if&lt;/span&gt; &lt;span&gt;falling_edge&lt;/span&gt;(&lt;span&gt;A&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 style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;B&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;span&gt;p&lt;/span&gt;&amp;lt;=&lt;span&gt;p&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(0, 136, 0); font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span&gt;p&lt;/span&gt;&amp;lt;=&lt;span&gt;p&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(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;if&lt;/span&gt; &lt;span&gt;rising_edge&lt;/span&gt;(&lt;span&gt;B&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 style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;A&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;span&gt;p&lt;/span&gt;&amp;lt;=&lt;span&gt;p&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(0, 136, 0); font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span&gt;p&lt;/span&gt;&amp;lt;=&lt;span&gt;p&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(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;if&lt;/span&gt; &lt;span&gt;falling_edge&lt;/span&gt;(&lt;span&gt;B&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 style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;span&gt;A&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;span&gt;p&lt;/span&gt;&amp;lt;=&lt;span&gt;p&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(0, 136, 0); font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span&gt;p&lt;/span&gt;&amp;lt;=&lt;span&gt;p&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(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;span&gt;Position&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_signed&lt;/span&gt;(&lt;span&gt;p&lt;/span&gt;,&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;32&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 size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;Wie zu erwarten, reagiert diese Beschreibung sofort auf alle Flankenwechsel:&lt;/p&gt;&lt;div style=&quot;width: 680px;&quot; class=&quot;serendipity_imageComment_center&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;a href=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/EncoderSim.gif&quot; class=&quot;serendipity_image_link&quot;&gt;&lt;!-- s9ymdb:100 --&gt;&lt;img src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/EncoderSim.gif&quot; class=&quot;serendipity_image_center&quot; style=&quot;width: 680px; height: 84px;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Zu schön , um wahr zu sein....&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;Leider taugt dieser Quadraturdecoder wegen der Flankenauswertungen nur für die &lt;b&gt;Simulation&lt;/b&gt;. Denn in einem programmierbaren Baustein gibt es kein Flipflop, das zwei Takteingänge hat, die sowohl auf die steigende wie auch die fallende Flanke reagieren könnten.  &lt;img src=&quot;http://www.lothar-miller.de/s9y/templates/default/img/emoticons/sad.png&quot; alt=&quot;:-(&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;&lt;br /&gt;&lt;br /&gt;Für die &lt;b&gt;Synthese &lt;/b&gt;muß deshalb ein &lt;b&gt;Zustandsautomat &lt;/b&gt;hergenommen werden, der nach den Pegelwechslen an den A und B Eingängen weiterschaltet und dabei einen Zähler mitzählt. Mit dem globalen FPGA-Takt wird der Zustand ausgewertet und ein Positionszähler entsprechend dem Folgesignal inkrementiert oder dekrementiert.&lt;p /&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&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;Encoder&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;A&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;B&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;Position&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;31&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;Encoder&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;Encoder&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;zustaende&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;is&lt;/span&gt; (&lt;span&gt;Z00&lt;/span&gt;, &lt;span&gt;Z01&lt;/span&gt;, &lt;span&gt;Z11&lt;/span&gt;, &lt;span&gt;Z10&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;z&lt;/span&gt; : &lt;span&gt;zustaende&lt;/span&gt; := &lt;span&gt;Z00&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;p&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, 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;i&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;1&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;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; &lt;span&gt;e&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;1&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;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;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Eintakten der asynchronen Signale&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;i&lt;/span&gt; &amp;lt;= &lt;span&gt;A&lt;/span&gt; &amp;amp; &lt;span&gt;B&lt;/span&gt;;  &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Zusammenfassen der Eingänge A und B&lt;/span&gt;&lt;br /&gt;    &lt;span&gt;e&lt;/span&gt; &amp;lt;= i&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;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 style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Weiterschalten und Zählen&lt;/span&gt;&lt;br /&gt;  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;variable&lt;/span&gt; &lt;span&gt;cu&lt;/span&gt;, &lt;span&gt;cd&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;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;cu&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(136, 136, 136);&quot;&gt;-- lokale Werte&lt;/span&gt;&lt;br /&gt;    &lt;span&gt;cd&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;case&lt;/span&gt; &lt;span&gt;z&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;Z00&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;e&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;01&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt; &lt;span&gt;z&lt;/span&gt; &amp;lt;= &lt;span&gt;Z01&lt;/span&gt;; &lt;span&gt;cu&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&lt;/span&gt;;&lt;br /&gt;                  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;elsif&lt;/span&gt; (&lt;span&gt;e&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;10&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt; &lt;span&gt;z&lt;/span&gt; &amp;lt;= &lt;span&gt;Z10&lt;/span&gt;; &lt;span&gt;cd&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;when&lt;/span&gt; &lt;span&gt;Z01&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;e&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;11&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt; &lt;span&gt;z&lt;/span&gt; &amp;lt;= &lt;span&gt;Z11&lt;/span&gt;; &lt;span&gt;cu&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&lt;/span&gt;;&lt;br /&gt;                  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;elsif&lt;/span&gt; (&lt;span&gt;e&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;00&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt; &lt;span&gt;z&lt;/span&gt; &amp;lt;= &lt;span&gt;Z00&lt;/span&gt;; &lt;span&gt;cd&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;when&lt;/span&gt; &lt;span&gt;Z11&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;e&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;10&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt; &lt;span&gt;z&lt;/span&gt; &amp;lt;= &lt;span&gt;Z10&lt;/span&gt;; &lt;span&gt;cu&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&lt;/span&gt;;&lt;br /&gt;                  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;elsif&lt;/span&gt; (&lt;span&gt;e&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;01&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt; &lt;span&gt;z&lt;/span&gt; &amp;lt;= &lt;span&gt;Z01&lt;/span&gt;; &lt;span&gt;cd&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;when&lt;/span&gt; &lt;span&gt;Z10&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;e&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;00&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt; &lt;span&gt;z&lt;/span&gt; &amp;lt;= &lt;span&gt;Z00&lt;/span&gt;; &lt;span&gt;cu&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&lt;/span&gt;;&lt;br /&gt;                  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;elsif&lt;/span&gt; (&lt;span&gt;e&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;11&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt; &lt;span&gt;z&lt;/span&gt; &amp;lt;= &lt;span&gt;Z11&lt;/span&gt;; &lt;span&gt;cd&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&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;cu&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;span&gt;p&lt;/span&gt; &amp;lt;= &lt;span&gt;p&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;elsif&lt;/span&gt; (&lt;span&gt;cd&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;span&gt;p&lt;/span&gt; &amp;lt;= &lt;span&gt;p&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;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;Position&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_signed&lt;/span&gt;(&lt;span&gt;p&lt;/span&gt;,&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;32&lt;/span&gt;)); &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Position ausgeben&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 size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;Diese Beschreibung ist sauber synthetisierbar, und kann dank der eingebauten Synchronisationsstufen direkt an einen Drehgeber angeschlossen werden.&lt;/p&gt;&lt;p /&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 678px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;a class=&quot;serendipity_image_link&quot; href=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/WF_Encoder.gif&quot;&gt;&lt;!-- s9ymdb:102 --&gt;&lt;img style=&quot;width: 678px; height: 188px;&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/WF_Encoder.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Waveform des Quadraturdecoders&lt;/div&gt;&lt;/div&gt;
&lt;p /&gt;&lt;p&gt;Zum Verständnis der obigen Simulationen hier die Testbench:&lt;/p&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&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;tb_Encoder_vhd&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;END&lt;/span&gt; &lt;span&gt;tb_Encoder_vhd&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;behavior&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;OF&lt;/span&gt; &lt;span&gt;tb_Encoder_vhd&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(136, 136, 136);&quot;&gt;-- Component Declaration for the Unit Under Test (UUT)&lt;/span&gt;&lt;br /&gt;  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;COMPONENT&lt;/span&gt; &lt;span&gt;Encoder&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;br /&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;A&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;B&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;Position&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;31&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;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;COMPONENT&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;  &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--Inputs&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;clk&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;SIGNAL&lt;/span&gt; &lt;span&gt;A&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;SIGNAL&lt;/span&gt; &lt;span&gt;B&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;br /&gt;  &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--Outputs&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;Position&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;31&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;br /&gt;   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;type&lt;/span&gt; &lt;span&gt;steprom&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;is&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;array&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;3&lt;/span&gt;) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&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;1&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;constant&lt;/span&gt; &lt;span&gt;steps&lt;/span&gt; : &lt;span&gt;steprom&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;00&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&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;01&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&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;11&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&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;10&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;counter&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, 0, 221); font-weight: bold;&quot;&gt;0&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(136, 136, 136);&quot;&gt;-- Instantiate the Unit Under Test (UUT)&lt;/span&gt;&lt;br /&gt;  &lt;span&gt;uut&lt;/span&gt;: &lt;span&gt;Encoder&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;PORT&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;MAP&lt;/span&gt;(&lt;br /&gt;    &lt;span&gt;clk&lt;/span&gt; =&amp;gt; &lt;span&gt;clk&lt;/span&gt;,&lt;br /&gt;    &lt;span&gt;A&lt;/span&gt; =&amp;gt; &lt;span&gt;A&lt;/span&gt;,&lt;br /&gt;    &lt;span&gt;B&lt;/span&gt; =&amp;gt; &lt;span&gt;B&lt;/span&gt;,&lt;br /&gt;    &lt;span&gt;Position&lt;/span&gt; =&amp;gt; &lt;span&gt;Position&lt;/span&gt;&lt;br /&gt;  );&lt;br /&gt;&lt;br /&gt;   &lt;span&gt;clk&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;clk&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;after&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;5&lt;/span&gt; &lt;span&gt;ns&lt;/span&gt;;&lt;br /&gt;   &lt;span&gt;A&lt;/span&gt; &amp;lt;= &lt;span&gt;steps&lt;/span&gt;(&lt;span&gt;counter&lt;/span&gt; &lt;span&gt;mod&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;4&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;B&lt;/span&gt; &amp;lt;= &lt;span&gt;steps&lt;/span&gt;(&lt;span&gt;counter&lt;/span&gt; &lt;span&gt;mod&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;4&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;br /&gt;  &lt;span&gt;tb&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;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;for&lt;/span&gt; &lt;span&gt;i&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(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;7&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;loop&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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;33&lt;/span&gt; &lt;span&gt;ns&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;loop&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;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;31&lt;/span&gt; &lt;span&gt;ns&lt;/span&gt;;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;assert&lt;/span&gt; &lt;span&gt;counter&lt;/span&gt;=&lt;span&gt;to_integer&lt;/span&gt;(&lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;signed&lt;/span&gt;(&lt;span&gt;Position&lt;/span&gt;))  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;report&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;Verzählt...&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;severity&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;error&lt;/span&gt;;&lt;br /&gt;      &lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span&gt;i&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(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;4&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;loop&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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;22&lt;/span&gt; &lt;span&gt;ns&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;loop&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;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;31&lt;/span&gt; &lt;span&gt;ns&lt;/span&gt;;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;assert&lt;/span&gt; &lt;span&gt;counter&lt;/span&gt;=&lt;span&gt;to_integer&lt;/span&gt;(&lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;signed&lt;/span&gt;(&lt;span&gt;Position&lt;/span&gt;))  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;report&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;Verzählt...&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;severity&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;error&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span&gt;i&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(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;3&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;loop&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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;3&lt;/span&gt; &lt;span&gt;ns&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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;13&lt;/span&gt; &lt;span&gt;ns&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;loop&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;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;31&lt;/span&gt; &lt;span&gt;ns&lt;/span&gt;;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;assert&lt;/span&gt; &lt;span&gt;counter&lt;/span&gt;=&lt;span&gt;to_integer&lt;/span&gt;(&lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;signed&lt;/span&gt;(&lt;span&gt;Position&lt;/span&gt;))  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;report&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;Verzählt...&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;severity&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;error&lt;/span&gt;;&lt;br /&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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;30&lt;/span&gt; &lt;span&gt;ns&lt;/span&gt;;&lt;br /&gt;      &lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span&gt;i&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(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;3&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;loop&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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;11&lt;/span&gt; &lt;span&gt;ns&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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;3&lt;/span&gt; &lt;span&gt;ns&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;loop&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;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;31&lt;/span&gt; &lt;span&gt;ns&lt;/span&gt;;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;assert&lt;/span&gt; &lt;span&gt;counter&lt;/span&gt;=&lt;span&gt;to_integer&lt;/span&gt;(&lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;signed&lt;/span&gt;(&lt;span&gt;Position&lt;/span&gt;))  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;report&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;Verzählt...&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;severity&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;error&lt;/span&gt;;&lt;br /&gt;      &lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span&gt;i&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(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;10&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;loop&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;wait&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;13&lt;/span&gt; &lt;span&gt;ns&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;loop&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;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;20&lt;/span&gt; &lt;span&gt;ns&lt;/span&gt;;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;assert&lt;/span&gt; &lt;span&gt;counter&lt;/span&gt;=&lt;span&gt;to_integer&lt;/span&gt;(&lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;signed&lt;/span&gt;(&lt;span&gt;Position&lt;/span&gt;))  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;report&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;Verzählt...&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;severity&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;error&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 style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;PROCESS&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;/pre&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;Langfristig muß &lt;i&gt;position &lt;/i&gt;also gleich &lt;i&gt;counter &lt;/i&gt;sein.&lt;/p&gt;&lt;p&gt;Wer es noch kompakter will, der kann diese Beschreibung verwenden:&lt;/p&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&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;Encoder&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;A&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;B&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;Position&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;31&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;Encoder&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;Encoder&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;p&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, 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;signal&lt;/span&gt; &lt;span&gt;h&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;1&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;signal&lt;/span&gt; &lt;span&gt;s&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;1&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;signal&lt;/span&gt; &lt;span&gt;e&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;1&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;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&gt;h&lt;/span&gt; &amp;lt;= &lt;span&gt;A&lt;/span&gt; &amp;amp; &lt;span&gt;B&lt;/span&gt;;   &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Zusammenfassen der Eingänge A und B&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;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Eintakten der asynchronen Signale&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;s&lt;/span&gt; &amp;lt;= &lt;span&gt;h&lt;/span&gt;;&lt;br /&gt;    &lt;span&gt;e&lt;/span&gt; &amp;lt;= &lt;span&gt;s&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 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;variable&lt;/span&gt; &lt;span&gt;i&lt;/span&gt;  : &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;signed&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(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;variable&lt;/span&gt; &lt;span&gt;os&lt;/span&gt; : &lt;span style=&quot;color: rgb(51, 68, 153); font-weight: bold;&quot;&gt;signed&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(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;01&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;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;br /&gt;    &lt;span&gt;i&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;0&#039;&lt;/span&gt; &amp;amp; &lt;span&gt;e&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(136, 136, 136);&quot;&gt;-- Umwandeln in Gray-Code&lt;/span&gt;&lt;br /&gt;    &lt;span&gt;i&lt;/span&gt; := &lt;span&gt;i&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;XOR&lt;/span&gt; &lt;span&gt;e&lt;/span&gt;(&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;)&amp;amp;&lt;span&gt;e&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;-- i enthält neuen Zustand&lt;/span&gt;&lt;br /&gt;    &lt;span&gt;i&lt;/span&gt; := &lt;span&gt;i&lt;/span&gt;-&lt;span&gt;os&lt;/span&gt;;                   &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- neuer Zustand - alter Zustand&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;i&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, 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;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Bit 0 ist Zählimpuls&lt;/span&gt;&lt;br /&gt;       &lt;span&gt;os&lt;/span&gt; := &lt;span&gt;os&lt;/span&gt;+&lt;span&gt;i&lt;/span&gt;;               &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Zustand merken&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;i&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(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;span&gt;p&lt;/span&gt; &amp;lt;= &lt;span&gt;p&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&gt;p&lt;/span&gt; &amp;lt;= &lt;span&gt;p&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;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;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;Position&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_signed&lt;/span&gt;(&lt;span&gt;p&lt;/span&gt;,&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;32&lt;/span&gt;)); &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Position ausgeben&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 size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;Es wird hier im Spartan 3 eine LUT weniger verbraucht als im oberen Beispiel. Allerdings ist meines Erachtens der Code nicht mehr so leicht nachvollziehbar. Insbesondere, wenn mal ein halbes Jahr vergangen ist &lt;img src=&quot;http://www.lothar-miller.de/s9y/templates/default/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 27 Jul 2009 20:43:00 +0200</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/53-guid.html</guid>
    
</item>

</channel>
</rss>
