<?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</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, 22 Mar 2012 09:36:37 GMT</pubDate>

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

<item>
    <title>EMV-Optimiertes Schaltreglerlayout</title>
    <link>http://www.lothar-miller.de/s9y/archives/46-EMV-Optimiertes-Schaltreglerlayout.html</link>
            <category>Layout Schaltregler</category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/46-EMV-Optimiertes-Schaltreglerlayout.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=46</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=46</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
&lt;p&gt;Bei einem &lt;font color=&quot;#000099&quot;&gt;&lt;b&gt;Schaltreglerdesign &lt;/b&gt;&lt;/font&gt;(Abwärtswandler, Tiefsetzsteller, Step-Down-Converter, Buck-Converter oder Abwärtsregler) sind vorrangig zwei Strompfade interessant:&lt;br /&gt;&lt;br /&gt;Beim Laden der Spule:&lt;br /&gt;&lt;b&gt;Phase 1:&lt;/b&gt; Eingangs-C -&amp;gt; Schalter -&amp;gt; Spule -&amp;gt; Ausgangs-C -&amp;gt; Eingangs-C&lt;br /&gt;Beim Freilauf:&lt;br /&gt;&lt;b&gt;Phase 2:&lt;/b&gt; Ausgangs-C -&amp;gt; Freilaufdiode -&amp;gt; Spule -&amp;gt; Ausgangs-C&lt;br /&gt;&lt;br /&gt;Wie immer, wenn Ströme fließen, gilt es auch hier, die Flächen und Widerstände dieser Stromschleifen möglichst klein zu halten.&lt;br /&gt;&lt;br /&gt;Nehmen wir als Ausgangspunkt einen Schaltregler mit dem LM2676, der 24V auf 5V wandeln soll:&lt;/p&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 728px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:81 --&gt;&lt;img height=&quot;421&quot; width=&quot;728&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/xLM2676_Schaltplan.gif&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Schaltplan Abwärtswandler mit LM2676&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;Bauteile:&lt;table cellspacing=&quot;1&quot; cellpadding=&quot;1&quot; border=&quot;1&quot; style=&quot;width: 400px;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;Nummer&lt;/font&gt;&lt;/td&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;Wert&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;U104&lt;/font&gt;&lt;/td&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;LM2676-ADJ&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;C131&lt;/font&gt;&lt;/td&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;47u/35V&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;C132&lt;/font&gt;&lt;/td&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;10n&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;C133&lt;/font&gt;&lt;/td&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;150u/10V&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;R131&lt;/font&gt;&lt;/td&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;1k&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;R132&lt;/font&gt;&lt;/td&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;3k16&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;V120&lt;/font&gt;&lt;/td&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;30BQ060&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;L101&lt;/font&gt;&lt;/td&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;font size=&quot;2&quot;&gt;33u UP3B-330&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;Hier sind diese beiden Ströme &lt;font color=&quot;#ccff33&quot;&gt;&lt;b&gt;GELB &lt;/b&gt;&lt;/font&gt;(Phase 1, Laden) bzw. &lt;font color=&quot;#ff9933&quot;&gt;&lt;b&gt;ORANGE &lt;/b&gt;&lt;/font&gt;(Phase 2, Leerlauf) eingezeichnet:&lt;/p&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 728px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:82 --&gt;&lt;img height=&quot;421&quot; width=&quot;728&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/xLM2676_Schaltplan_Stromfluss.gif&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Ladestrom gelb / Freilaufstrom orange&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Als ersten Versuch mache ich daraus ein einseitiges Layout:&lt;br /&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 413px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:86 --&gt;&lt;img height=&quot;454&quot; width=&quot;413&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/xLayout_NOK.gif&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Platinenlayout einseitig&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Schön, könnte man sagen. Alle Bauteile hübsch kompakt untergebracht, das ist schon was. Nur die Leiterbahnquerschnitte sind suboptimal, die könnten noch deutlich breiter werden. Aber der Knackpunkt kommt hier: wenn ich die Stromschleifen aus dem Schaltplan ins Layout übertrage, sieht das so aus:&lt;/p&gt;&lt;div style=&quot;width: 413px;&quot; class=&quot;serendipity_imageComment_center&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:85 --&gt;&lt;img height=&quot;454&quot; width=&quot;413&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/xLayout_NOK_Strompfade.gif&quot; class=&quot;serendipity_image_center&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Stromverlauf im einseitigen Layout&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Mit einer doppelseitigen Platine wäre dagegen dieses Layout möglich:&lt;/p&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 504px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:84 --&gt;&lt;img height=&quot;490&quot; width=&quot;504&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/xLayout_OK.gif&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Zweiseitiges Layout&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Und hier die Stromschleifen:&lt;/p&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 504px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:83 --&gt;&lt;img height=&quot;490&quot; width=&quot;504&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/xLayout_OK_Strompfade.gif&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Strompfade im doppelseitigen Layout&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Schon mit wenig Phantasie kann man erkennen, dass das zweite Layout kompakter und aufgeräumter aussieht. Die Schleifen sind räumlich kleiner, die Leiterbahnquerschnitte großzügig und die Leiterbahnverläufe kurz.&lt;br /&gt;&lt;br /&gt;In der Praxis hat dann auch das erste Layout bei der EMV-Messung signifikant schlechtere Werte. Nun könnte jemand sagen: Für mich ist das uninteressant, es ist mir egal, ob mein Regler andere stört. Zu Denken sollte aber geben, dass das Ganze ja kein Sender, sondern ein Spannungswandler sein soll. Und die Energie, die in die Luft abgestrahlt wird, kann nicht mehr am Ausgang herauskommen  &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;Als kleine Verschärfung des Stromkreis-Prinzips ist dann noch die Forderung, dass möglichst keine Änderungen des Stromflusses zwischen den beiden Strompfaden sein sollte. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Wenn diese beiden Strompfade berücksichtigt wurde, hat man das Design zu 90% in der Tasche. Aus EMV-Sicht kommt allerdings noch ein dritter dazu, der es richtig knacken lassen kann:&lt;br /&gt;
&lt;b&gt;Übergang von Phase 2 nach Phase 1:&lt;/b&gt; Eingangs-C -&amp;gt; Schalter -&amp;gt; Diode -&amp;gt; Eingangs-C
&lt;br /&gt;&lt;br /&gt;Das ist der &lt;font color=&quot;#0000CC&quot;&gt;&lt;b&gt;Recovery-Pfad&lt;/b&gt;&lt;/font&gt;. Dieser wird interessant beim Einschalten des Schalttransistors, wenn die Diode gerade (noch) leitet. Weil die Diode leitet, braucht sie ein paar Nanosekunden, bis sie sperrt und bildet solange einen &lt;i&gt;&lt;b&gt;Kurzschluss&lt;/b&gt;&lt;/i&gt; von der Eingangsspannung über den eingeschalteten Transistor über die leitende Diode nach Masse. &lt;br /&gt;&lt;br /&gt;Hier in &lt;font color=&quot;#0099CC&quot;&gt;&lt;b&gt;CYAN &lt;/b&gt;&lt;/font&gt;dieser Strompfad.&lt;/p&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 728px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:155 --&gt;&lt;img height=&quot;421&quot; width=&quot;728&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/LM2676_Schaltplan_trr.gif&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Der Recovery-Pfad: ein Kurzschluss für einige ns...&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Weil insbesondere auch hier wegen des Kurzschlusses mit sehr steilen Stromwechselflanken gerechnet werden muß, sollte die Fläche dieses Pfades sehr klein ausfallen. Im Fall des ersten Layouts ist diese Forderung nicht im mindesten erfüllt, das Design wird ein Störsender sein:&lt;br /&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 455px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:154 --&gt;&lt;img height=&quot;500&quot; width=&quot;455&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/Layout_NOK_trr.png&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Eine große Spule mit 1 Windung!&lt;/div&gt;&lt;/div&gt;&lt;p /&gt;&lt;p&gt;&lt;br /&gt;Im zweiten Layout ist dieser Pfad schön kurz:&lt;/p&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 500px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:153 --&gt;&lt;img height=&quot;490&quot; width=&quot;500&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/Layout_OK_trr.png&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Das sieht gut aus: ein kompakter Recovery-Pfad&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;Dieser kurze Pfad hat sich durch die Beachtung des Lade- und Freilaufstromkreises automatisch ergeben.&lt;br /&gt;&lt;br /&gt;&lt;font color=&quot;#990000&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;u&gt;Zusammengefasst:&lt;/u&gt;&lt;br /&gt;&lt;font color=&quot;#0000cc&quot;&gt;Idealerweise sind alle drei Strompfade (Laden, Freilauf und Recovery) möglichst kompakt. Bei Lade- und Freilaufstromkreis sollte zudem keine Änderung der Stromflussrichtung  stattfinden.&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Diese Strompfade wurden hier exemplarisch mit einem Step-Down-Wandler dargestellt. Sie sind aber in allen üblichen Schaltreglertopologien mehr oder weniger einfach zu finden. Beim Step-Up-Wandler geht der Recovery-Pfad z.B. über die Diode und den Schalttransistor und schließt so den Ausgangskondensator kurz.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Aber auch die &lt;font color=&quot;#0000cc&quot;&gt;&lt;b&gt;Erfassung und Rückführung der Ausgangsspannung&lt;/b&gt;&lt;/font&gt; (Feedback) über R132 und R131 sollte genau angeschaut werden. Bei der ersten (schlechteren) Variante fließt der Laststrom vom Ausgangskondensator zum Eingangskondensator und beeinflusst auf dem Rückweg das GND-Potential von R131. So kann (auch abhängig vom Laststrom) die Ausgangsspannung nicht zuverlässig erfasst und geregelt werden. Ein unruhiges Reglerverhalten ist das Ergebnis.&lt;br /&gt;Das ist beim zweilagigen Design besser: hier sind die Last- und Messstromkreise komplett voneinander getrennt. Das Ergebnis ist eine stabilere und rauschärmere Ausgangsspannung.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color=&quot;#990033&quot;&gt;&lt;b&gt;&lt;u&gt;Auf jeden Fall sollte auch beachtet werden:&lt;/u&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;1. keine Leitung und auch &lt;font color=&quot;#0000cc&quot;&gt;&lt;b&gt;keine Massefläche &lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#0000cc&quot;&gt;&lt;b&gt;unter der Spule&lt;/b&gt;&lt;/font&gt;. Denn sonst koppelt das Magnetfeld der Spule in die Leiterbahn oder die Masse ein und induziert dort Störströme.&lt;br /&gt;&lt;br /&gt;2. die &lt;b&gt;&lt;font color=&quot;#0000cc&quot;&gt;Einspeisung der Spannung&lt;/font&gt;&lt;/b&gt; erfolgt direkt am Eingangskondensator (wie im Schaltplan eingezeichnet). Wird die Spannung z.B. am Schaltregler eingespeist, dann ist eine erhöhte Störstrahlung zu erwarten, denn der Schaltreglerpin wird ja (das liegt in der Natur der Sache) hochfrequenz ein- und ausgeschaltet.&lt;br /&gt;&lt;br /&gt;3. die &lt;font color=&quot;#0000cc&quot;&gt;&lt;b&gt;Auskopplung der geregelten Spannung&lt;/b&gt;&lt;/font&gt; erfolgt (wie auch der Anschluss des Feedback-Widerstandes R132) direkt am Ausgangskondesator. Das ist leider aus dem Schaltplan nicht so klar ersichtlich. Im beiden Layouts ist es aber korrekt ausgeführt.&lt;p&gt;
&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Thu, 22 Mar 2012 06:43:00 +0100</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/46-guid.html</guid>
    
</item>
<item>
    <title>Qualifier</title>
    <link>http://www.lothar-miller.de/s9y/archives/82-Qualifier.html</link>
            <category>Code-Schnipsel</category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/82-Qualifier.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=82</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=82</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
&lt;p&gt;Es gestaltet sich in VHDL oft nicht so einfach, dem Synthesizer etwas Glasklares zu vermitteln. Nehmen wir mal diese einfache Aufgabe: Eine Konstante x&amp;quot;1234&amp;quot; soll an einen Vektor (&lt;i&gt;std_logic_vector&lt;/i&gt; oder &lt;i&gt;unsigned&lt;/i&gt;) zugewiesen werden. Weil die Länge des Vektors noch nicht feststeht, soll vorher ein &lt;i&gt;resize()&lt;/i&gt; durchgeführt werden. &lt;br /&gt;Wenn man das jetzt einfach so hinschreibt:&lt;/p&gt;&lt;pre&gt;slv &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(resize(x&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;1234&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, slv&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength));&lt;/pre&gt;
&lt;p&gt;Dann erlebt man ein blaues Wunder. Obwohl eigentlich auf Anhieb erkennbar ist, was hier passieren soll, zickt der Compiler herum und meldet sowas wie:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;Expression in type conversion to std_logic_vector has 2 possible definitions in this scope, for example, SIGNED and UNSIGNED.&lt;/font&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Was ist passiert?&lt;br /&gt;&lt;i&gt;resize()&lt;/i&gt; kann &lt;i&gt;signed &lt;/i&gt;oder &lt;i&gt;unsigned &lt;/i&gt;für diese Konstante zurückliefern. Weil der Synthesizer selber aber nicht entscheiden kann, welcher Datentyp gemeint ist, weiß er auch nicht, ob die &lt;i&gt;resize()&lt;/i&gt; Funktion die Konstante als &lt;i&gt;signed &lt;/i&gt;oder &lt;i&gt;unsigned &lt;/i&gt;zu betrachten hat.&lt;br /&gt;Dies kann ihm mit einem Qualifier gesagt werden: &lt;i&gt;unsigned&#039;&lt;/i&gt; sagt, dass der folgende Wert als &lt;i&gt;unsigned&lt;/i&gt; zu betrachten ist. &lt;/p&gt;&lt;pre&gt;slv &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;(&lt;/span&gt;resize(x&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;1234&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, slv&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength)));&lt;/pre&gt;&lt;p&gt;Das hilft dem Synthesizer aus der Klemme, denn jetzt weiß er was das Ziel ist und er verwendet die gewünschte Implementierung der Funktion. &lt;/p&gt;&lt;p&gt;Hier mal eine kleine Aufstellung, was geht und was nicht:&lt;/p&gt;&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;signal&lt;/span&gt; slv  :  &lt;span style=&quot;color: rgb(0, 119, 68); 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;15&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;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; uv   :  &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt; (&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;15&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;);


slv &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(resize(x&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;1234&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, slv&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength));
&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--&amp;gt; Expression in type conversion to std_logic_vector has 2 possible definitions in this scope, for example, SIGNED and UNSIGNED.&lt;/span&gt;

slv &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;(&lt;/span&gt;resize(x&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;1234&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, slv&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength)));
&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--&amp;gt; ok, das Ergebnis von resize ist ein unsigned Vektor&lt;/span&gt;

slv &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(resize(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;(x&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;1234&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;), slv&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength));
&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--&amp;gt; Expression in type conversion to unsigned has 7 possible definitions in this scope, for example, std_ulogic_vector and std_logic_vector.&lt;/span&gt;

slv &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(resize(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;(&lt;/span&gt;x&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;1234&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;), slv&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength));
&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--&amp;gt; ok, die Konstante x&amp;quot;1234&amp;quot; ist ein unsigned Wert&lt;/span&gt;

uv &amp;lt;= resize(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;(x&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;1234&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;), uv&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength);
&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--&amp;gt; Expression in type conversion to unsigned has 7 possible definitions in this scope, for example, std_ulogic_vector and std_logic_vector.&lt;/span&gt;

uv &amp;lt;= resize(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;(&lt;/span&gt;x&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;&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;&lt;/span&gt;&lt;span&gt;1234&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&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;&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;), uv&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength);
&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--&amp;gt; ok, die Konstante x&amp;quot;1234&amp;quot; ist ein unsigned Wert&lt;/span&gt;

uv &amp;lt;= resize(x&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;&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;&lt;/span&gt;&lt;span&gt;1234&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&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;&lt;/span&gt;&lt;span style=&quot;color: rgb(119, 17, 0);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, uv&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength);
&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--&amp;gt; ok, der Typ von uv wird für resize verwendet&lt;/span&gt;&lt;/pre&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;
&lt;p&gt;&lt;br /&gt;
Bis zu einer Vektorlänge von 31 Bit geht es auch so:




&lt;/p&gt;&lt;pre&gt;slv &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;16&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;#&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1234&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;#&lt;/span&gt;&lt;/span&gt;, slv&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength));&lt;/pre&gt;&lt;p /&gt;


 
    </content:encoded>

    <pubDate>Thu, 10 Nov 2011 13:16:56 +0100</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/82-guid.html</guid>
    
</item>
<item>
    <title>Xilinx ISE Step-by-Step</title>
    <link>http://www.lothar-miller.de/s9y/archives/81-Xilinx-ISE-Step-by-Step.html</link>
            <category>Xilinx ISE</category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/81-Xilinx-ISE-Step-by-Step.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=81</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=81</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
Die &lt;b&gt;Xilinx ISE Entwicklungumgebung&lt;/b&gt; ist eigentlich nicht kompliziert, nur eben umfangreich. Leicht kann da ein Anfänger mal einen falschen Knopf drücken und verliert sich dann in der Vielfalt der Menüs...
&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Hier ein bebildertes &lt;b&gt;Tutorial &lt;/b&gt;als Schritt-für-Schritt Anleitung, wie man &lt;/p&gt;&lt;p&gt;1) mit ISE ein Projekt aufsetzt, &lt;/p&gt;&lt;p&gt;2) den &lt;a href=&quot;http://www.lothar-miller.de/s9y/archives/80-Hello-World!.html&quot; title=&quot;Hello World!&quot;&gt;VHDL-Code für eine blinkende LED&lt;/a&gt; schreibt, &lt;/p&gt;&lt;p&gt;3) eine Testbench aufsetzt und den Code mit ISIM simuliert&lt;/p&gt;&lt;p&gt;4) die Pinzuordnung mit PlanAhead vornimmt&lt;/p&gt;&lt;p&gt;5) das Ganze implementiert und&lt;/p&gt;&lt;p&gt;6) mit Impact auf das FPGA lädt.&lt;/p&gt;&lt;p /&gt;&lt;p&gt;&lt;a href=&quot;http://www.lothar-miller.de/s9y/uploads/Tutorial_Xilinx_ISE13.pdf&quot;&gt;Zum PDF-Download (1,5MB) HIER clicken.&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;

 
    </content:encoded>

    <pubDate>Fri, 23 Sep 2011 12:22:39 +0200</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/81-guid.html</guid>
    
</item>
<item>
    <title>Hello World!</title>
    <link>http://www.lothar-miller.de/s9y/archives/80-Hello-World!.html</link>
            <category>Code-Schnipsel</category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/80-Hello-World!.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=80</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=80</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
&lt;p&gt;&lt;b&gt;Eine blinkende LED ist das &amp;quot;&lt;font color=&quot;#000099&quot;&gt;Hello World!&lt;/font&gt;&amp;quot; der Hardware.&lt;/b&gt; &lt;/p&gt;&lt;p&gt;Man kann daran erkennen, dass die Versorgung funktioniert, die Logik arbeitet und anhand der Blinkfrequenz einen Zähler beurteilen. Also schon einiges, was so eine einzelne Funzel einem sagen kann &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;&lt;p&gt;Leider funktioniert diese einfache Variante eines Blinklichts nur in der Simulation:&lt;/p&gt;&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; IEEE; 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.STD_LOGIC_1164.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&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;entity&lt;/span&gt; BlinkLED &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;Port&lt;/span&gt; (led : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;buffer&lt;/span&gt;  &lt;span style=&quot;color: rgb(0, 119, 68); 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;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; BlinkLED; 
 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; Behavioral &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; BlinkLED &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;begin&lt;/span&gt; 
   led &amp;lt;= &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;not&lt;/span&gt; led &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;500&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ms&lt;/span&gt;;    &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- LED alle 500 ms toggeln &lt;/span&gt;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; Behavioral;&lt;/pre&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;Warum geht das nicht? Es gibt keine &amp;quot;einstellbaren Verzögerungsglieder&amp;quot; (ähnlich wie Monoflops oder RC-Glieder...) im FPGA. Alles, was mit Zeiten zu tun hat, muss in einem FPGA als Zähler aufgebaut werden, der einen Takt mitzählen und beim Erreichen eines passenden Endwertes eine Reaktion auslöst. &lt;br /&gt;Also brauchen wir einen Takt und einen Zähler. In der Regel ist am FPGA ein Quarz mit z.B. 50MHz angeschlossen. Für eine halbe Sekunde müssen also 25 Millionen Takte gezählt werden. Das ergibt eine Registerkette mit 25 Bits (mit diesen 25 Bit wären maximal 2^25=33554432 Zählschritte möglich).&lt;br /&gt;Und diese 25 Register werden mit einem festen Wert 24999999 verglichen. Warum 24999999 und nicht 25000000? &lt;br /&gt;Weil 0...24999999 schon 25000000 Schritte sind. Einfacher wird es vielleicht mit kleineren Zahlen: ein Zähler, der 5 Schritte abzählen muß, braucht die Zahlen 0, 1, 2, 3 und 4.&lt;/p&gt;&lt;p&gt;Also zusammengefasst:&lt;br /&gt;Ein Takt geht auf einen Zähler, der mit einem festen Wert verglichen wird, bei dessen Erreichen zurückgesetzt wird und gleichzeitig eine Aktion auslöst: die LED wird getoggelt.&lt;/p&gt;&lt;p&gt;Hier ist der VHDL-Quellcode für so ein Blinklicht:&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; IEEE; 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.STD_LOGIC_1164.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;; 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.NUMERIC_STD.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;; 
 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;entity&lt;/span&gt; BlinkLED &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;Port&lt;/span&gt; ( clk : &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, 119, 68); font-weight: bold;&quot;&gt;STD_LOGIC&lt;/span&gt;; 
           led : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt;  &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;STD_LOGIC&lt;/span&gt;); 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; BlinkLED; 
 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; Behavioral &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; BlinkLED &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;signal&lt;/span&gt; c : &lt;span style=&quot;color: rgb(0, 119, 68); 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;24999999&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;-- 0,5s bei 50MHz fosc&lt;/span&gt;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; x : &lt;span style=&quot;color: rgb(0, 119, 68); 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;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;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(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; rising_edge(clk); &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- warten bis zum nächsten Takt &lt;/span&gt;
      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (c&amp;lt;&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;24999999&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;-- 0…24999999 = 25000000 Takte = 1/2 Sekunde bei 50MHz &lt;/span&gt;
          c &amp;lt;= c+&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;-- wenn kleiner: weiterzählen &lt;/span&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;-- wenn Zählerende erreicht: &lt;/span&gt;
          c &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;-- Zähler zurücksetzen &lt;/span&gt;
          x &amp;lt;= &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;not&lt;/span&gt; x;              &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- und Signal x togglen &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;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;; 
   led &amp;lt;= x;                       &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Signal x an LED ausgeben &lt;/span&gt;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; Behavioral;&lt;/pre&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;Zur Funktionsweise:&lt;br /&gt;mit einem Zähler werden 25 Millionen Takte eines 50 MHz Taktes abgezählt (also 0..24999999). Wenn der Zählerendwert erreicht wurde, wird der Zähler zurückgesetzt und gleichzeitig ein lokales Signal &lt;b&gt;&lt;i&gt;x&lt;/i&gt;&lt;/b&gt; getoggelt. Dieses Signal wird dann an den &lt;b&gt;&lt;i&gt;led &lt;/i&gt;&lt;/b&gt;Ausgang gegeben.&lt;/p&gt;&lt;p&gt;Das lokale Signal &lt;b&gt;&lt;i&gt;x&lt;/i&gt;&lt;/b&gt; brauchen wir, weil der Port &lt;b&gt;&lt;i&gt;led &lt;/i&gt;&lt;/b&gt;als &lt;b&gt;&lt;i&gt;out &lt;/i&gt;&lt;/b&gt;deklariert ist, und daher entsprechend den VHDL Richtlinien &lt;u&gt;nicht lesbar&lt;/u&gt; ist.&lt;br /&gt;Und um den Schlauen zuvorzukommen: Nein, es ist &lt;u&gt;keine gute Idee&lt;/u&gt;, den Port &lt;b&gt;&lt;i&gt;led &lt;/i&gt;&lt;/b&gt;als &lt;b&gt;&lt;i&gt;buffer &lt;/i&gt;&lt;/b&gt;oder &lt;b&gt;&lt;i&gt;inout &lt;/i&gt;&lt;/b&gt;zu deklarieren, nur damit er zurückgelesen werden und so ein lokales Signal gespart werden kann. Das ist eher ein Kündigungsgrund oder sollte wenigstens einen strengen Verweis in der Personalakte nach sich ziehen...&lt;br /&gt;Als kleiner Lichtblick: ab VHDL 2008 können auch &lt;b&gt;&lt;i&gt;out &lt;/i&gt;&lt;/b&gt;Ports wieder zurückgelesen werden, diese Ports verhalten sich dann ähnlich wie &lt;i&gt;&lt;b&gt;buffer&lt;/b&gt;&lt;/i&gt;. So ist es dann möglich, z.B. einen Zähler direkt auf einen &lt;b&gt;&lt;i&gt;out&lt;/i&gt;&lt;/b&gt; Port zu erzeugen.&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Und hier die kompakte Stimuli-&amp;quot;Testbench&amp;quot;:&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; IEEE; 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.STD_LOGIC_1164.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;; 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.NUMERIC_STD.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;;  
  
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;entity&lt;/span&gt; tb_BlinkLED &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;is&lt;/span&gt; 
                                   &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- leere Entity --&amp;gt; Testbench&lt;/span&gt;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; tb_BlinkLED; 
  
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; behavior &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; tb_BlinkLED &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;component&lt;/span&gt; BlinkLED 
   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;port&lt;/span&gt;( clk : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;; 
         led : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;OUT&lt;/span&gt;  &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&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;component&lt;/span&gt;; 
    
   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; clk : &lt;span style=&quot;color: rgb(0, 119, 68); 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;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- lokale Signale der Testbench&lt;/span&gt;
   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; led : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;         &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- werden an den Prüfling angeschlossen&lt;/span&gt;

&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;begin&lt;/span&gt;
   uut: BlinkLED                   &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- der Prüfling wird verdrahtet&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; ( clk =&amp;gt; clk, 
              led =&amp;gt; led ); 
 
   clk &amp;lt;= &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;not&lt;/span&gt; clk &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;10&lt;/span&gt; ns;     &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- einen 50MHz Takt erzeugen&lt;/span&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;
Wer dieses Blinklicht zum ersten Mal mit ISE realisieren will, der kann sich die &lt;a title=&quot;Xilinx ISE Schritt für Schritt&quot; target=&quot;_blank&quot; href=&quot;http://www.lothar-miller.de/s9y/archives/81-Xilinx-ISE-Step-by-Step.html&quot;&gt;Schritt-für-Schritt Anleitung HIER mal ansehen&lt;/a&gt;.
&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Für alle, die noch nicht genug haben kommt hier der Binärzähler auf 8 LEDs.&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; IEEE; 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.STD_LOGIC_1164.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;; 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.NUMERIC_STD.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;; 
 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;entity&lt;/span&gt; BinaryLED &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;Port&lt;/span&gt; ( clk  : &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, 119, 68); font-weight: bold;&quot;&gt;STD_LOGIC&lt;/span&gt;; 
           leds : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); 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;7&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;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; BinaryLED; 
 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; Behavioral &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; BinaryLED &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;signal&lt;/span&gt; c : &lt;span style=&quot;color: rgb(0, 119, 68); 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;12499999&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;-- 0,25s bei 50MHz fosc&lt;/span&gt;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; x : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&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;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;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;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;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(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; rising_edge(clk); &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- warten bis zum nächsten Takt &lt;/span&gt;
      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (c&amp;lt;&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;12499999&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;-- 0..12499999 = 12500000 Takte = 1/4 Sekunde bei 50MHz &lt;/span&gt;
          c &amp;lt;= c+&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;-- wenn kleiner: c weiterzählen &lt;/span&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;-- wenn Zählerende erreicht: &lt;/span&gt;
          c &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;-- Zähler c zurücksetzen &lt;/span&gt;
          x &amp;lt;= x+&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 Zähler x hochzählen &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;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;; 
   leds &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(x);    &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Signal x an LEDs ausgeben &lt;/span&gt;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; Behavioral;&lt;/pre&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;Im Großen und Ganzen ist das Beispiel gleich wie das obere. Nur wird hier statt der einzelnen LED ein &lt;i&gt;&lt;b&gt;unsigned&lt;/b&gt;&lt;/i&gt;-Vektor hochgezählt. Das Hochzählen von Vektoren hat den Vorteil, dass der Überlauf von &lt;i&gt;11111111bin &lt;/i&gt;= &lt;i&gt;255dez &lt;/i&gt;nach &lt;i&gt;00000000bin &lt;/i&gt;= &lt;i&gt;0dez &lt;/i&gt;automatisch passiert. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ich hätte den Zähler &lt;i&gt;&lt;b&gt;x&lt;/b&gt;&lt;/i&gt; natürlich wie den Zähler &lt;i&gt;&lt;b&gt;c&lt;/b&gt;&lt;/i&gt; auch als &lt;i&gt;&lt;b&gt;integer &lt;/b&gt;&lt;/i&gt;machen können, dann hätte der Code (für eine fehlerfreie Simulation) aber so aussehen müssen:&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; IEEE; 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.STD_LOGIC_1164.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;; 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.NUMERIC_STD.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;; 
 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;entity&lt;/span&gt; BinaryLED &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;Port&lt;/span&gt; ( clk  : &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, 119, 68); font-weight: bold;&quot;&gt;STD_LOGIC&lt;/span&gt;; 
           leds : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); 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;7&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;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; BinaryLED; 
 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; Behavioral &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; BinaryLED &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;signal&lt;/span&gt; c : &lt;span style=&quot;color: rgb(0, 119, 68); 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;12499999&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;-- 0,25s bei 50MHz fosc&lt;/span&gt;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; x : &lt;span style=&quot;color: rgb(0, 119, 68); 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;255&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;begin&lt;/span&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(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; rising_edge(clk); &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- warten bis zum nächsten Takt &lt;/span&gt;
      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (c&amp;lt;&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;12499999&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;-- 0..12499999 = 12500000 Takte &lt;/span&gt;
          c &amp;lt;= c+&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;-- wenn kleiner: c weiterzählen &lt;/span&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;-- wenn Zählerende erreicht: &lt;/span&gt;
          c &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;-- Zähler c zurücksetzen &lt;/span&gt;
          &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (x&amp;lt;&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;255&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;-- ist Zähler x schon &amp;quot;oben&amp;quot; angekommen&lt;/span&gt;
             x &amp;lt;= x+&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;-- nein: Zähler x hochzählen &lt;/span&gt;
          &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;else&lt;/span&gt;
             x &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;-- ja: zurücksetzen&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;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;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;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Signal konvertieren und casten und an LEDs ausgeben &lt;/span&gt;
   leds &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(x,&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)); 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; Behavioral;&lt;/pre&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;&lt;br /&gt;Der nächste logische Schritt ist dann, die Erzeugung des Fortschaltimpulses in einem eigenen Prozess zu erzeugen.&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; IEEE; 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.STD_LOGIC_1164.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;; 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.NUMERIC_STD.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;; 
 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;entity&lt;/span&gt; BinaryLED &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;Port&lt;/span&gt; ( clk  : &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, 119, 68); font-weight: bold;&quot;&gt;STD_LOGIC&lt;/span&gt;; 
           leds : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); 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;7&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;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; BinaryLED; 
 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; Behavioral &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; BinaryLED &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;signal&lt;/span&gt; c : &lt;span style=&quot;color: rgb(0, 119, 68); 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;12499999&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;-- 0,25s bei 50MHz fosc&lt;/span&gt;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; t : &lt;span style=&quot;color: rgb(0, 119, 68); 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;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; x : &lt;span style=&quot;color: rgb(0, 119, 68); 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;255&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;begin&lt;/span&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(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; rising_edge(clk); &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- warten bis zum nächsten Takt &lt;/span&gt;
      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (c&amp;lt;&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;12499999&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;-- 1/4 Sekunde bei 50MHz &lt;/span&gt;
          c &amp;lt;= c+&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;-- wenn kleiner: c weiterzählen &lt;/span&gt;
          t &amp;lt;= &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;else&lt;/span&gt;                         &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- wenn Zählerende erreicht: &lt;/span&gt;
          c &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;-- Zähler c zurücksetzen &lt;/span&gt;
          t &amp;lt;= &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&lt;/span&gt;;                &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Flag für Tick setzen&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;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;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(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; rising_edge(clk); &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- warten bis zum nächsten Takt &lt;/span&gt;
      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (t=&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;-- sind schon wieder 0,25 sec vorbei?&lt;/span&gt;
          &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (x&amp;lt;&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;255&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;-- ist Zähler x schon &amp;quot;oben&amp;quot; angekommen&lt;/span&gt;
             x &amp;lt;= x+&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;-- nein: Zähler x hochzählen &lt;/span&gt;
          &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;else&lt;/span&gt;
             x &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;-- ja: zurücksetzen&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;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;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;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Signal konvertieren und casten und an LEDs ausgeben &lt;/span&gt;
   leds &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(x,&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)); 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; Behavioral;&lt;/pre&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;&lt;br /&gt;Wie man klar sieht, gibt es in diesem Design nur und genau einen einzigen Takt &lt;i&gt;&lt;b&gt;clk&lt;/b&gt;&lt;/i&gt;. Das ist der Quarzoszillator, der aussen am FPGA angeschlossen ist. Mit diesem Takt läuft das ganze Design. Für Anfänger gilt: &lt;br /&gt;&lt;b&gt;Der Takt ist wie der Highlander: es kann nur einen geben&lt;/b&gt;. &lt;/p&gt;



 
    </content:encoded>

    <pubDate>Fri, 23 Sep 2011 11:59:39 +0200</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/80-guid.html</guid>
    
</item>
<item>
    <title>-use_new_parser YES</title>
    <link>http://www.lothar-miller.de/s9y/archives/79-use_new_parser-YES.html</link>
            <category>Xilinx ISE</category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/79-use_new_parser-YES.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=79</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=79</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
&lt;p&gt;Leider kann die Xilinx-Synthese nur Arrays bis max. 2 Dimensionen. Der 
Xilinx SXT User Guide dazu:&lt;br /&gt; &lt;font color=&quot;#0000CC&quot; face=&quot;courier new,courier,monospace&quot;&gt;XST supports multi-dimensional array types 
of up to two dimensions.&lt;/font&gt;&lt;br /&gt;Das ist lästig, wenn man mehr Dimensionen bräuchte, und der Simulator das problemlos mitmacht...&lt;/p&gt;&lt;p&gt;Ein anderer Effekt ist das Initialisieren von Arrays, das in bestimmten Konstellationen einfach nicht klappt und mit einer Meldung wie&lt;br /&gt; &lt;font color=&quot;#0000CC&quot; face=&quot;courier new,courier,monospace&quot;&gt;Default value is ignored for signal &amp;lt;my_array&amp;gt;&lt;/font&gt; &lt;br /&gt;kommentiert wird. Und auch hier: die Simulation läuft tadellos, nur der Synthesizer schafft die Initialisierung nicht...&lt;/p&gt;&lt;p&gt;Glück gehabt: die Rettung naht verkleidet als undokumentierte Syntheseoption: -use_new_parser yes&lt;/p&gt;&lt;p&gt;Der ist zu finden in den Process-Properties, die mit einem Rechtsclick auf &lt;i&gt;&lt;b&gt;Synthesize-XST&lt;/b&gt;&lt;/i&gt; auswählbar sind. Dort muß dann &lt;i&gt;&lt;b&gt;Property display level: Advanced&lt;/b&gt;&lt;/i&gt; ausgewählt und in der letzten Zeile bei &lt;i&gt;&lt;b&gt;Other XST Command Line Options&lt;/b&gt;&lt;/i&gt; der Schalter &lt;i&gt;&lt;b&gt;-use_new_parser yes&lt;/b&gt;&lt;/i&gt; eingetragen werden.
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- s9ymdb:148 --&gt;&lt;img height=&quot;260&quot; width=&quot;700&quot; class=&quot;serendipity_image_center&quot; style=&quot;border: 0px none; padding-left: 5px; padding-right: 5px;&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/use_new_parser.gif&quot; /&gt;&lt;br /&gt;&lt;br /&gt;Mit diesem Schalter ergibt sich dann eine wundersame Wandlung:&lt;/p&gt;&lt;pre&gt;  &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- XST13: OK  &lt;/span&gt;
  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; array_typ1 &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, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;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(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;
  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; array_typ2 &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, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;gt;, &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;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(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;

  &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- XST13 default: Fehler  / mit &amp;quot;-use_new_parser yes&amp;quot;: OK&lt;/span&gt;
  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; array_typ3 &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, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;gt;, &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;gt;, &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;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(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;
  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; array_typ4 &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, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;gt;, &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;gt;, &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;gt;, &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;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(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;
  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; array_typ5 &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, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;gt;, &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;gt;, &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;gt;, &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;gt;, &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;natural&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;range&lt;/span&gt; &amp;lt;&amp;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(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;/pre&gt;&lt;p&gt;Hier der komplette Quelltext dazu: &lt;b&gt;&lt;a target=&quot;_blank&quot; title=&quot;PackageTypedef.vhd&quot; href=&quot;http://www.lothar-miller.de/s9y/uploads/PackageTypedef.vhd&quot;&gt;PackageTypedef.vhd&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;






 
    </content:encoded>

    <pubDate>Wed, 31 Aug 2011 08:00:58 +0200</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/79-guid.html</guid>
    
</item>
<item>
    <title>Bubblesort</title>
    <link>http://www.lothar-miller.de/s9y/archives/78-Bubblesort.html</link>
            <category>Rechnen </category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/78-Bubblesort.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=78</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=78</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
&lt;p&gt;Hier jetzt mal eine Umsetzung des allseits bekannten Bubblesort-Algorithmus in VHDL. &lt;br /&gt;Zuerst die rein kombinatorische Variante:&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; IEEE;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.STD_LOGIC_1164.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;all&lt;/span&gt;;

&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;package&lt;/span&gt; BSTypes &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;type&lt;/span&gt; BSData_Typ &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;9&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(0, 119, 68); 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;127&lt;/span&gt;;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; BSTypes;

&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;package&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;body&lt;/span&gt; BSTypes &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;end&lt;/span&gt; BSTypes;




&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;library&lt;/span&gt; IEEE;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.STD_LOGIC_1164.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.NUMERIC_STD.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; work.bstypes.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;all&lt;/span&gt;;

&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;entity&lt;/span&gt; Bubblesort &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;Port&lt;/span&gt; ( di  : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;in&lt;/span&gt;  BSData_Typ;
           do  : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; BSData_Typ );
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; Bubblesort;

&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; Behavioral &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; Bubblesort &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;begin&lt;/span&gt;

   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;process&lt;/span&gt; (di) 
   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;variable&lt;/span&gt; din  : BSData_Typ;
   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;variable&lt;/span&gt; temp : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;integer&lt;/span&gt;;
   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;variable&lt;/span&gt; n    : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;integer&lt;/span&gt;;
   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;variable&lt;/span&gt; oncemore : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;boolean&lt;/span&gt;;
   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;begin&lt;/span&gt;
      din      := di;
      n        := din&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength;
      oncemore := TRUE;
      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;while&lt;/span&gt; oncemore = TRUE &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;and&lt;/span&gt; n &amp;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;loop&lt;/span&gt;
         oncemore := FALSE;
         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; i &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; din&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength-&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;loop&lt;/span&gt;
            &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; din(i) &amp;gt; din(i+&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;then&lt;/span&gt; 
               temp     := din(i);   &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Dreieckstausch&lt;/span&gt;
               din(i)   := din(i+&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;);
               din(i+&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;) := temp;
               oncemore := TRUE;
            &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;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;;
         n := n-&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;loop&lt;/span&gt;;
      do &amp;lt;= din;
   &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;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; Behavioral;&lt;/pre&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;In einem Spartan 3 FPGA braucht diese Lösung abhängig vom Abbruch (über die Variable oncemore) unterschiedlich viele Ressourcen:&lt;br /&gt;Mit Abbruch:      Number of Slices  1293         Number of 4 input LUTs 2272&lt;br /&gt;Ohne Abbruch:   Number of Slices  976           Number of 4 input LUTs 1701&lt;/p&gt;&lt;p&gt;Der offensichtlichste Unterschied ist, dass der in der Software effizientere Abbruch (wenn das Array schon vor Ablauf aller Kombinationen schon komplett sortiert ist) in der Hardware nur Nachteile mit sich bringt.&lt;/p&gt;&lt;p&gt;Nachfolgend eine getaktete Lösung, die auf Kosten der Rechenzeit deutlich weniger Ressourcen braucht. &lt;a href=&quot;http://www.lothar-miller.de/s9y/uploads/Bubblesort.zip&quot; title=&quot;Bubblesort.zip&quot; target=&quot;_blank&quot;&gt;Bubblesort.zip&lt;/a&gt;&lt;br /&gt;Insbesondere fällt hier der Unterschied zwischen der Variante mit und der ohneAbbruch wesentlich geringer aus:&lt;br /&gt;Mit Abbruch:      Number of Slices  168           Number of 4 input LUTs 250&lt;br /&gt;Ohne Abbruch:   Number of Slices  167           Number of 4 input LUTs 245&lt;/p&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;pre&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Typdefinition BSData_Typ s.o.&lt;/span&gt;

&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;library&lt;/span&gt; IEEE;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.STD_LOGIC_1164.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.NUMERIC_STD.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; work.bstypes.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;all&lt;/span&gt;;

&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;entity&lt;/span&gt; Bubblesort &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;Port&lt;/span&gt; ( di    : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;in&lt;/span&gt;  BSData_Typ;
           do    : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; BSData_Typ;
           start : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;
           done  : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;
           clk   : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;);
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; Bubblesort;

&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; Behavioral &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; Bubblesort &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;signal&lt;/span&gt; busy     : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;boolean&lt;/span&gt; := FALSE;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; din      : BSData_Typ;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; n,i      : &lt;span style=&quot;color: rgb(0, 119, 68); 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; din&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength;
&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;process&lt;/span&gt; 
   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;variable&lt;/span&gt; temp : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;integer&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(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; rising_edge(clk);
      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (busy=FALSE) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt;
         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (start=&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;
            din  &amp;lt;= di;
            busy &amp;lt;= TRUE;
            n    &amp;lt;= &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;0&lt;/span&gt;;
            i    &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(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;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;else&lt;/span&gt;
         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (n &amp;lt; din&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt;
            &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (i&amp;lt;din&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;l&lt;/span&gt;ength-&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;then&lt;/span&gt;
               &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; din(i) &amp;gt; din(i+&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;then&lt;/span&gt;
                  temp     := din(i);   &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Dreieckstausch&lt;/span&gt;
                  din(i)   &amp;lt;= din(i+&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;);
                  din(i+&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;) &amp;lt;= temp;
               &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;;
               i &amp;lt;= i+&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;
               i &amp;lt;= &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;0&lt;/span&gt;;
               n &amp;lt;= n+&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;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;else&lt;/span&gt;
            busy &amp;lt;= FALSE;       
            do   &amp;lt;= din;
         &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;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;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;;
   
   done &amp;lt;= &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;when&lt;/span&gt; start=&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;and&lt;/span&gt; busy=FALSE &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;else&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;end&lt;/span&gt; Behavioral;&lt;/pre&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;Das ist die Testbench für die kombinatorische Variante:&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; ieee;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;USE&lt;/span&gt; ieee.std_logic_1164.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;USE&lt;/span&gt; ieee.numeric_std.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ALL&lt;/span&gt;;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; ieee.math_real.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;all&lt;/span&gt;;
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; work.bstypes.&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;all&lt;/span&gt;;
 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ENTITY&lt;/span&gt; tb_BubbleSort &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;END&lt;/span&gt; tb_BubbleSort;
 
&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ARCHITECTURE&lt;/span&gt; behavior &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;OF&lt;/span&gt; tb_BubbleSort &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;COMPONENT&lt;/span&gt; Bubblesort
    &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;Port&lt;/span&gt; ( di  : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;in&lt;/span&gt;  BSData_Typ;
           do  : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; BSData_Typ );
    &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;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--Inputs&lt;/span&gt;
   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; di : BSData_Typ := (&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, 0, 221); font-weight: bold;&quot;&gt;6&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, 0, 221); font-weight: bold;&quot;&gt;8&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, 0, 221); font-weight: bold;&quot;&gt;2&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;5&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;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--Outputs&lt;/span&gt;
   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; do : BSData_Typ;
   
&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;-- Instantiate the Unit Under Test (UUT)&lt;/span&gt;
   uut: Bubblesort &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; (
          di =&amp;gt; di,
          do =&amp;gt; do
        );

   &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Stimulus process&lt;/span&gt;
   stim_proc: &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;variable&lt;/span&gt; rand  : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;real&lt;/span&gt;;
    &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;variable&lt;/span&gt; seed1 : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;positive&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;234&lt;/span&gt;;
    &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;variable&lt;/span&gt; seed2 : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;positive&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;567&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(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;100&lt;/span&gt; ns;  
      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;loop&lt;/span&gt;
         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; i &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;9&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;loop&lt;/span&gt;
            UNIFORM(seed1, seed2, rand);
            di(i) &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;integer&lt;/span&gt;(TRUNC(rand*&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 0, 238); font-weight: bold;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 0, 238); font-weight: bold;&quot;&gt;.999&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;loop&lt;/span&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;10&lt;/span&gt; ns;
         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;for&lt;/span&gt; i &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;8&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;loop&lt;/span&gt;
            &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;assert&lt;/span&gt; do(i)&amp;lt;=do(i+&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;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;Falsche Reihenfolge!&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;failure&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;loop&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;loop&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;process&lt;/span&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;Und das kommt dabei heraus:&lt;/p&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 711px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:147 --&gt;&lt;img height=&quot;104&quot; width=&quot;711&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/BubblesortKomb.gif&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Waveform der Testbench für den kombinatorischen Sortierer&lt;/div&gt;&lt;/div&gt;&lt;p /&gt;&lt;p /&gt;&lt;p&gt;&lt;br /&gt;Und hier können die Dateien gezippt heruntergeladen werden: &lt;b&gt;&lt;a target=&quot;_blank&quot; title=&quot;Bubblesort.zip&quot; href=&quot;http://www.lothar-miller.de/s9y/uploads/Bubblesort.zip&quot;&gt;Bubblesort.zip&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;





 
    </content:encoded>

    <pubDate>Thu, 21 Apr 2011 11:22:18 +0200</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/78-guid.html</guid>
    
</item>
<item>
    <title>Xilinx New Source</title>
    <link>http://www.lothar-miller.de/s9y/archives/27-Xilinx-New-Source.html</link>
            <category>Xilinx ISE</category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/27-Xilinx-New-Source.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=27</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=27</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
&lt;p&gt;Wenn mit &lt;b&gt;Xilinx ISE&lt;/b&gt; ein &lt;b&gt;neues Projekt oder Source-File&lt;/b&gt; angelegt wird, fragt der Wizzard nach EA und Bitbreiten. Nach einem Klick auf &amp;quot;DONE&amp;quot; wird dann ein neues Sourcefile angelegt, in dem aber ein riesiger Header und die alten Synopsys-Libs eingebunden sind:&lt;/p&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;pre&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Company: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Engineer: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Create Date:    11:21:38 &lt;/span&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;01/04/2010&lt;/span&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Design Name: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Module Name:    Defaulttext - Behavioral &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Project Name: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Target Devices: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Tool versions: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Description: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Dependencies: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Revision: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Revision 0.01 - File Created&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Additional Comments: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--------------------------------------------------------&lt;/span&gt;&lt;br /&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;STD_LOGIC_ARITH&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;STD_LOGIC_UNSIGNED&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(136, 136, 136);&quot;&gt;---- Uncomment the following library declaration if instantiating&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;---- any Xilinx primitives in this code.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--library UNISIM;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--use UNISIM.VComponents.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;Defaulttext&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, 51, 153); font-weight: bold;&quot;&gt;STD_LOGIC&lt;/span&gt;;&lt;br /&gt;           &lt;span&gt;d&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, 51, 153); font-weight: bold;&quot;&gt;STD_LOGIC&lt;/span&gt;;&lt;br /&gt;           &lt;span&gt;o&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, 51, 153); font-weight: bold;&quot;&gt;STD_LOGIC&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;Defaulttext&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;Defaulttext&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;begin&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;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;&lt;p&gt;Das musste ich geändert haben: &lt;br /&gt;Ich will als Standard-Lib die NUMERIC_STD einbinden, die UNISIM soll raus, und der Header etwas verschlankt werden.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;font size=&quot;4&quot; color=&quot;#660000&quot;&gt;ISE Version 13&lt;/font&gt;&lt;/b&gt; &lt;br /&gt;Hier müssen dazu die beiden TCL-Scripte &lt;br /&gt;&lt;font color=&quot;#0000CC&quot;&gt;&lt;b&gt;C:\Xilinx\ISE_DS\ISE\data\projnav\scripts\dpm_sourceTasks.tcl&lt;br /&gt;C:\Xilinx\ISE_DS\ISE\data\testbnch2.tcl&lt;/b&gt;&lt;/font&gt;  &lt;br /&gt;angepasst werden.&lt;br /&gt;&lt;br /&gt;Im Script &lt;font color=&quot;#0000CC&quot;&gt;&lt;b&gt;dpm_sourceTasks.tcl&lt;/b&gt;&lt;/font&gt; wird die Erzeugung eines neuen VHDL-Sourcecodemodul gesteuert. Hier muss die Prozedur &lt;font color=&quot;#0000CC&quot;&gt;&lt;b&gt;proc dpm_sourceCreateVHDL&lt;/b&gt;&lt;/font&gt; geändert werden. Hier hat sich im Gegensatz zu früheren Versionen (siehe Beschreibung unten) das &lt;b&gt;$_fs&lt;/b&gt; in ein &lt;b&gt;$hFile&lt;/b&gt; geändert.&lt;br /&gt;&lt;br /&gt;Im &lt;font color=&quot;#0000CC&quot;&gt;&lt;b&gt;testbnch2.tcl&lt;/b&gt;&lt;/font&gt; wird die Generierung der Testbench gesteuert. Hier hat sich einiges getan, und ich musste erst mal die automatische Reset-Suche pensionieren. Auch die Taktgenerierung hat mir nicht gefallen, so dass sich da ebenso einiges geändert hat.&lt;br /&gt;&lt;br /&gt;Damit die Suche nicht so schwer fällt, gibt es hier meine beiden Templates zum Download: &lt;b&gt;&lt;a href=&quot;http://www.lothar-miller.de/s9y/uploads/IseTemplates.zip&quot; title=&quot;IseTemplates.zip&quot; target=&quot;_blank&quot;&gt;IseTemplates.zip&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;font size=&quot;4&quot; color=&quot;#660000&quot;&gt;&lt;b&gt;ISE Versionen 9 bis 11 &lt;/b&gt;&lt;/font&gt;&lt;br /&gt;Etwa in der Mitte dieses TCL-Scripts   &lt;br /&gt;&lt;font color=&quot;#0000cc&quot;&gt;&lt;b&gt;C:\Xilinx\data\projnav\scripts\dpm_sourceTasks.tcl&lt;/b&gt;&lt;/font&gt;   &lt;br /&gt;findet sich die Stelle, die angepasst werden muss:&lt;/p&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot; color=&quot;#006600&quot;&gt;      $_iHdlData GetPorts _portIter&lt;br /&gt;      puts $_fs &amp;quot;----------------------------------------------------------&amp;quot;&lt;br /&gt;      puts $_fs &amp;quot;-- Engineer: Lothar Miller&amp;quot;&lt;br /&gt;      puts $_fs &amp;quot;-- &amp;quot;&lt;br /&gt;      puts $_fs &amp;quot;-- Create Date:    $_ts &amp;quot;&lt;br /&gt;      puts $_fs &amp;quot;-- Design Name: &amp;quot;&lt;br /&gt;      puts $_fs &amp;quot;-- Module Name:    $_entityName - $_archName &amp;quot;&lt;br /&gt;      puts $_fs &amp;quot;----------------------------------------------------------&amp;quot;&lt;br /&gt;      puts $_fs &amp;quot;library IEEE;&amp;quot;&lt;br /&gt;      puts $_fs &amp;quot;use IEEE.STD_LOGIC_1164.ALL;&amp;quot;&lt;br /&gt;      puts $_fs &amp;quot;use IEEE.NUMERIC_STD.ALL;&amp;quot;&lt;br /&gt;      puts $_fs &amp;quot;&amp;quot;&lt;/font&gt;&lt;/p&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;p /&gt;&lt;p&gt;Nach der Änderung dieser Datei kommt beim Erzeugen eines neuen Projekts/Sourcefiles der gewünschte Customer-Header.&lt;/p&gt;&lt;pre&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;pre&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Engineer: Lothar Miller&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Create Date:    11:21:38 01/04/2010 &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Design Name: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Module Name:    Defaulttext - Behavioral &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--------------------------------------------------------&lt;/span&gt;&lt;br /&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;Defaulttext&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, 51, 153); font-weight: bold;&quot;&gt;STD_LOGIC&lt;/span&gt;;&lt;br /&gt;           &lt;span&gt;d&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, 51, 153); font-weight: bold;&quot;&gt;STD_LOGIC&lt;/span&gt;;&lt;br /&gt;           &lt;span&gt;o&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, 51, 153); font-weight: bold;&quot;&gt;STD_LOGIC&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;Defaulttext&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;Defaulttext&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;begin&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;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;Für die Voreinstellungen beim Erstellen der Simulationsdatei gilt der Pfad&lt;br /&gt;&lt;p&gt;&lt;font color=&quot;#0000cc&quot;&gt;&lt;b&gt;C:\Xilinx\data\testbnch2.tft&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;/p&gt;



 
    </content:encoded>

    <pubDate>Wed, 13 Apr 2011 09:19:00 +0200</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/27-guid.html</guid>
    
</item>
<item>
    <title>DCF77 Decoder</title>
    <link>http://www.lothar-miller.de/s9y/archives/77-DCF77-Decoder.html</link>
            <category>DCF77</category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/77-DCF77-Decoder.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=77</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=77</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
&lt;p&gt;Ein DCF-Signal besteht aus Impulsfolgen, die pro Sekunde mit unterschiedlich langen High-Pegeln eine 0 (=100ms high) bzw. eine 1 (=200ms high) codieren. Die 59. Sekunde wird zur Synchronisation verwendet und wird mit low-Pegel ausgegeben. Die steigende Flanke nach der 58. skeunde ist daher dann die Sekunde 0. &lt;br /&gt;&lt;br /&gt;Die&lt;b&gt; Auswertung des DCF-Signals&lt;/b&gt; wird also von einem Zähler übernommen, der mit einer steigenden Flanke zurückgesetzt wird. Bei einer fallenden Flanke wird dann entsprechend dem Zählerstand eine &#039;0&#039; (&amp;lt;150ms) oder eine &#039;1&#039; (&amp;gt;150ms) übernommen. &lt;br /&gt;Alternativ kann auch beim Zählerstand 150ms einfach der Pegel des DCF-Signals eingelesen werden.&lt;br /&gt;&lt;br /&gt;Erreicht der Zähler einen Wert größer 1 Sekunde, war das die 59. Sekunde. Bei der der nächsten steigenden Flanke des DCF-Signals werden dann die eingelesenen Bits zur weiteren Verarbeitung über ein Pufferregister bereitgestellt.&lt;br /&gt;&lt;br /&gt;In dem folgenden Code sollte vor der Synthese eine der beiden Varianten (beide funktionieren gleich gut) der Bit-Auswertung auskommentiert werden &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;&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; IEEE;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.STD_LOGIC_1164.&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; IEEE.NUMERIC_STD.&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; DCF77 &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;Generic&lt;/span&gt;( fclk : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;integer&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;50000000&lt;/span&gt; ); &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- 50MHz&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;Port&lt;/span&gt;   ( clk       : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;; &lt;br /&gt;             dcf       : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;             dcf_sec0  : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;             bitsout   : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); 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;58&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; DCF77;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; Behavioral &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; DCF77 &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;constant&lt;/span&gt; cntmax    : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;integer&lt;/span&gt; := (&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;11&lt;/span&gt;*fclk)/&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;10&lt;/span&gt;;   &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;     -- 1.1 sec&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;constant&lt;/span&gt; cntsample : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;integer&lt;/span&gt; := (&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;15&lt;/span&gt;*fclk)/&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;100&lt;/span&gt;;  &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;     -- 150 ms&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; cnt         : &lt;span style=&quot;color: rgb(0, 119, 68); 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; cntmax := &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;-- Zähler bis 1.1 sec&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; dcfsr       : &lt;span style=&quot;color: rgb(0, 119, 68); 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;2&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; bits        : &lt;span style=&quot;color: rgb(0, 119, 68); 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;58&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;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;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; rising_edge(clk);&lt;br /&gt;      &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Einsynchronisieren&lt;/span&gt;&lt;br /&gt;      dcfsr &amp;lt;= dcfsr(&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;) &amp;amp; dcf;&lt;br /&gt;   &lt;br /&gt;      &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- erst Zaehler hochzählen (sättigend bei 1.1 sec)&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (cnt &amp;lt; cntmax) &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;then&lt;/span&gt; &lt;br /&gt;         cnt &amp;lt;= cnt+&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;br /&gt;      &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- steigende Flanke vom DCF-Signal&lt;/span&gt;&lt;br /&gt;      dcf_sec0 &amp;lt;= &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;-- für 1 Taktzyklus bei Sekunde 0 aktiv&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (dcfsr(&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;2&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;1&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;br /&gt;         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (cnt = cntmax) &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;-- Überlauf? ja: Sekunde 59 war da&lt;/span&gt;&lt;br /&gt;            dcf_sec0 &amp;lt;= &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&lt;/span&gt;;       &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Sekunde 0 anzeigen&lt;/span&gt;&lt;br /&gt;            bitsout &amp;lt;= bits;       &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- die gesammelten Daten übergeben&lt;/span&gt;&lt;br /&gt;            bits &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;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Bit-Schiebegregister zuruecksetzen&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;         cnt &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(136, 136, 136);&quot;&gt;-- Variante 1: einlesen bei fallender Flanke vom DCF-Signal&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (dcfsr(&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;2&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;1&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;br /&gt;         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (cnt &amp;lt; cntsample) &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;-- kurzer Impuls? Grenze 150ms&lt;/span&gt;&lt;br /&gt;            bits &amp;lt;= &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;0&#039;&lt;/span&gt; &amp;amp; bits(&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;58&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;1&lt;/span&gt;); &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- ja: 0 von links einschieben&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;            bits &amp;lt;= &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&lt;/span&gt; &amp;amp; bits(&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;58&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;1&lt;/span&gt;); &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- nein: 1 von links einschieben&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(136, 136, 136);&quot;&gt;-- --&amp;gt; Ressourcenverbrauch    &lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of Slices       88&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of Slice FFs    137&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of 4 input LUTs 104&lt;/span&gt;&lt;br /&gt;      &lt;br /&gt;      &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Variante 2: bei Zeitpunkt &amp;quot;150ms&amp;quot; einlesen   &lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (cnt = cntsample) &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;-- DCF-Signal einlesen bei 150ms&lt;/span&gt;&lt;br /&gt;          bits &amp;lt;= dcfsr(&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;2&lt;/span&gt;) &amp;amp; bits(&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;58&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;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(136, 136, 136);&quot;&gt;-- --&amp;gt; Ressourcenverbrauch&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of Slices       87&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of Slice FFs    137&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of 4 input LUTs 103&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; Behavioral;&lt;/pre&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;Zusammen mit der Testbench unten ergeben sich folgende Waveforms:&lt;/p&gt;
&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 700px;&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/SimWave11.gif&quot;&gt;&lt;!-- s9ymdb:140 --&gt;&lt;img height=&quot;134&quot; width=&quot;700&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/SimWave11.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Überblick&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 700px;&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/SimWave12.gif&quot;&gt;&lt;!-- s9ymdb:141 --&gt;&lt;img height=&quot;133&quot; width=&quot;700&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/SimWave12.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Detail mit Sekunde 59 und darauffolgender Datenübergabe&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;&lt;p&gt;Hier der DCF77-Decoder incl. Testbench zum Download: &lt;a target=&quot;_blank&quot; title=&quot;DCF77.zip&quot; href=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/DCF77.zip&quot;&gt;DCF77.zip&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Mit diesem Decoder werden nur die rohen Daten bereitgestellt. In dem Modul darüber muß dann noch die gesamte Plausibilitätskontrolle (Parity), die Validierung und die weitere Verwaltung der empfangenen Daten realisiert werden.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 14 Jan 2011 09:20:00 +0100</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/77-guid.html</guid>
    
</item>
<item>
    <title>BCD nach ASCII</title>
    <link>http://www.lothar-miller.de/s9y/archives/76-BCD-nach-ASCII.html</link>
            <category>BCD Umwandlung</category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/76-BCD-nach-ASCII.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=76</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=76</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
&lt;p&gt;Sollen Zahlen z.B. an ein Display oder über eine serielle Schnittstelle ausgegeben werden, dann ist es naheliegend, sie zuerst in ein BCD-Format und anschliessend in ASCII umzuwandeln. &lt;br /&gt;Hier werden mehrere Lösungsmöglichkeiten für die Umwandlung einer BCD-Zahl in ein ASCII-Format aufgezeigt. &lt;br /&gt;&lt;br /&gt;Der Lösungsansatz bei der Addiererlösung ist folgender:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;Wenn &lt;i&gt;di &lt;/i&gt;eine Zahl von 0..9 ist, dann addiere eine ASCII-0 dazu.&lt;br /&gt;Wenn &lt;i&gt;di &lt;/i&gt;eine Zahl von 10..15 ist, dann subtrahiere 10 und addiere ein ASCII-A dazu.&lt;/font&gt;&lt;/b&gt;&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; IEEE;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.STD_LOGIC_1164.&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; IEEE.NUMERIC_STD.&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; BCD2ASCII &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; ( di : &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, 119, 68); 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;           do : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); 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;7&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; BCD2ASCII;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Dierekte Beschreibung als Distributed BROM&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Maximum combinational path delay: 7.276ns&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of Slices         3&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of 4 input LUTs   6&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; Behavioral &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; BCD2ASCII &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; Rom16x8 &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;15&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(0, 119, 68); 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;7&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; BCDRom : Rom16x8 := ( &lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;0&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&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, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;2&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;3&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;4&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;5&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;6&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;7&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;8&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;9&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;A&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;B&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;C&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;D&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;E&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)),&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;F&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&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;   do &amp;lt;= BCDRom(to_integer(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;(di)));&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; Behavioral;&lt;/pre&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Über eine when-else Anweisung --&amp;gt; es wird ein Distributed BROM instatiiert&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Maximum combinational path delay: 7.276ns&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of Slices         3&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of 4 input LUTs   6&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; Behavioral &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; BCD2ASCII &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;begin&lt;/span&gt;&lt;br /&gt;     do &amp;lt;= x&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;30&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;when&lt;/span&gt; di=x&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;0&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;31&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;when&lt;/span&gt; di=x&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;1&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;32&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;when&lt;/span&gt; di=x&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;2&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;33&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;when&lt;/span&gt; di=x&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;3&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;34&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;when&lt;/span&gt; di=x&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;4&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;35&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;when&lt;/span&gt; di=x&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;5&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;36&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;when&lt;/span&gt; di=x&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;6&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;37&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;when&lt;/span&gt; di=x&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;7&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;38&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;when&lt;/span&gt; di=x&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;8&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;39&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;when&lt;/span&gt; di=x&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;9&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;41&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;when&lt;/span&gt; di=x&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;A&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;42&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;when&lt;/span&gt; di=x&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;B&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;43&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;when&lt;/span&gt; di=x&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;C&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;44&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;when&lt;/span&gt; di=x&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;D&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;45&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;when&lt;/span&gt; di=x&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;E&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;else&lt;/span&gt;  &lt;br /&gt;           x&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;46&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; Behavioral;&lt;/pre&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Mit Addierer, die Konstate 10 wird direkt vom ASCII-Wert &#039;A&#039; abgezogen (selbe Klammerebene)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Maximum combinational path delay: 7.276ns&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of Slices         3&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of 4 input LUTs   6&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; Behavioral &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; BCD2ASCII &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;begin&lt;/span&gt;&lt;br /&gt;     do &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(resize(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;(di),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)+to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;A&#039;&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, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;))  &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;when&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;(di)&amp;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;else&lt;/span&gt;  &lt;br /&gt;           &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(resize(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;(di),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)+to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&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, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;));&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; Behavioral;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Wie vorher, die Konstate 10 wird aber auf einer anderen Klammerebene abgezogen --&amp;gt; ein Subtrahierer wird instatiiert!&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Maximum combinational path delay: 10.471ns&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of Slices         6&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Number of 4 input LUTs   10&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;--architecture Behavioral of BCD2ASCII is&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;     do &amp;lt;= &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(resize(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;(di),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)+to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;A&#039;&lt;/span&gt;),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)-&lt;span style=&quot;color: rgb(0, 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;when&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;(di)&amp;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;else&lt;/span&gt;  &lt;br /&gt;           &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic_vector&lt;/span&gt;(resize(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;unsigned&lt;/span&gt;(di),&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;)+to_unsigned(&lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;character&lt;/span&gt;&#039;pos(&lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&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, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt;));&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; Behavioral;&lt;br /&gt;&lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;Die ersten 3 Lösungen resultieren in gleichem Ressourcenverbrauch und in
 der selben Geschwindigkeit.&lt;br /&gt;&lt;br /&gt;Sehr interessant ist aber der Unterschied zwischen der (optisch fast gleichen) 3. und 4. Lösung. Dort wurde nur die &lt;b&gt;Subtraktion der Konstante &lt;/b&gt;10 etwas verlegt, und XST fügt dann in die Hardware einen Subtrahierer ein. Dadurch wird das Design größer und langsamer!&lt;br /&gt;&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Thu, 25 Nov 2010 15:43:53 +0100</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/76-guid.html</guid>
    
</item>
<item>
    <title>PS/2 Tastatur</title>
    <link>http://www.lothar-miller.de/s9y/archives/75-PS2-Tastatur.html</link>
            <category>PS/2</category>
    
    <comments>http://www.lothar-miller.de/s9y/archives/75-PS2-Tastatur.html#comments</comments>
    <wfw:comment>http://www.lothar-miller.de/s9y/wfwcomment.php?cid=75</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=75</wfw:commentRss>
    

    <author>nospam@example.com (Lothar Miller)</author>
    <content:encoded>
    
&lt;p&gt;Zur Eingabe von Daten bietet sich eine &lt;b&gt;PS/2 Tastatur&lt;/b&gt; an. Die Dinger gibts für ein paar Euros und das Protokoll ist in der einfachsten Variante sehr überschaubar.&lt;/p&gt;&lt;p&gt;Ich habe hier mehrere Implementationen: die Erste ist sehr einfach gehalten und gibt alle empfangenen Scancodes incl. Break und Extended Keycodes einfach mit einem Handshake weiter an ein übergeordnetes Modul:&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; IEEE;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;use&lt;/span&gt; IEEE.STD_LOGIC_1164.&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; IEEE.NUMERIC_STD.&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; PS2_Keyboard &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; ( PS2_Data    : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;           PS2_Clk     : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;           RxData      : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); 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;7&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;           RxActive    : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;           DataReady   : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;; &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Handshake-Signal: Daten bereit&lt;/span&gt;&lt;br /&gt;           DataFetched : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;; &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Handshake-signal: Daten übernommen&lt;/span&gt;&lt;br /&gt;           CLK         : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;);&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; PS2_Keyboard;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;architecture&lt;/span&gt; Behavioral &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;of&lt;/span&gt; PS2_Keyboard &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; RxTimeout   : &lt;span style=&quot;color: rgb(0, 119, 68); 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;500000&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;-- max. 10ms&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; RxRegister  : &lt;span style=&quot;color: rgb(0, 119, 68); 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;10&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;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;1&#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; DataSR      : &lt;span style=&quot;color: rgb(0, 119, 68); 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;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;1&#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; ClkSR       : &lt;span style=&quot;color: rgb(0, 119, 68); 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;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;1&#039;&lt;/span&gt;);&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;type&lt;/span&gt; PS2RXStateType &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;is&lt;/span&gt; (IDLE, RECEIVE, READY); &lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; PS2RXState : PS2RXStateType := IDLE;&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; rising_edge(CLK);&lt;br /&gt;      RxTimeout &amp;lt;= RxTimeout+&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;;&lt;br /&gt;      &lt;br /&gt;      DataSR    &amp;lt;= DataSR(&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;0&lt;/span&gt;) &amp;amp; PS2_Data;&lt;br /&gt;      ClkSR     &amp;lt;= ClkSR(&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;0&lt;/span&gt;)  &amp;amp; PS2_Clk;&lt;br /&gt;      &lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (ClkSR = &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 style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- fallende Flanke am PS2_CLK&lt;/span&gt;&lt;br /&gt;         RxRegister &amp;lt;= DataSR(&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;) &amp;amp; RxRegister(&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;downto&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;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;case&lt;/span&gt; PS2RXState &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; IDLE =&amp;gt;&lt;br /&gt;         RxRegister &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;1&#039;&lt;/span&gt;);&lt;br /&gt;         RxActive   &amp;lt;= &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;0&#039;&lt;/span&gt;;&lt;br /&gt;         DataReady  &amp;lt;= &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;0&#039;&lt;/span&gt;;&lt;br /&gt;         RxTimeout  &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; (DataSR(&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;0&#039;&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;and&lt;/span&gt; ClkSR(&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 style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- STARTBIT erkannt&lt;/span&gt;&lt;br /&gt;            PS2RXState &amp;lt;= RECEIVE;&lt;br /&gt;            RxActive   &amp;lt;= &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; RECEIVE =&amp;gt;&lt;br /&gt;         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (RxTimeout = &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;500000&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;-- 10 ms&lt;/span&gt;&lt;br /&gt;            PS2RXState &amp;lt;= IDLE;&lt;br /&gt;         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;elsif&lt;/span&gt; (RxRegister(&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;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 style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Startbit ganz durchgeschoben?&lt;/span&gt;&lt;br /&gt;            DataReady  &amp;lt;= &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&lt;/span&gt;;            &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- SCANCODE empfangen&lt;/span&gt;&lt;br /&gt;            RxData     &amp;lt;= RxRegister(&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;8&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;downto&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt;);&lt;br /&gt;            PS2RXState &amp;lt;= READY;&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; READY =&amp;gt;                       &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- warten, bis Daten abgeholt sind&lt;/span&gt;&lt;br /&gt;         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt; (DataFetched=&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;            PS2RXState &amp;lt;= IDLE;&lt;br /&gt;            DataReady  &amp;lt;= &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;0&#039;&lt;/span&gt;;&lt;br /&gt;            RxActive   &amp;lt;= &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;end&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt;;&lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;case&lt;/span&gt;;&lt;br /&gt;   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;process&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;end&lt;/span&gt; Behavioral;&lt;/pre&gt;&lt;hr size=&quot;2&quot; width=&quot;100%&quot; /&gt;&lt;p&gt;&lt;br /&gt;Realisiert wurde dieses PS/2 Interface in Form eines 11 Bit breiten Schieberegisters, das zu Beginn im Zustand IDLE mit &#039;1&#039;en vorbelegt wird. Mit jeder fallenden Flanke am PS2-Clk wird dieses Schieberegister um 1 Bit von links her weitergeschoben. In das MSB wird dabei der Zustand des einsynchronisierten PS2-Data Pins eingetragen. &lt;br /&gt;Nachdem ein Startbit erkannt wurde, wechselt der Zustand auf RECEIVE und es werden solange Bits eingeschoben, bis das Startbit das rechte Ende (Bit0) des Schieberegisters erreicht hat. Dann werden die Daten in das Pufferregister übernommen und im Zustand READY gewartet, bis die Daten abgeholt sind.&lt;br /&gt;&lt;br /&gt;Zusammen mit dieser 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; ieee;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;USE&lt;/span&gt; ieee.std_logic_1164.&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; ieee.numeric_std.&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; PS2_tb &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; PS2_tb;&lt;br /&gt; &lt;br /&gt;&lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;ARCHITECTURE&lt;/span&gt; behavior &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;OF&lt;/span&gt; PS2_tb &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;procedure&lt;/span&gt; PS2Send( &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; din :  &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, 119, 68); 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;7&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; ps2c : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;OUT&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;                      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; ps2d : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;OUT&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&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;variable&lt;/span&gt; parity : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&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;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;for&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;1&lt;/span&gt; ns;&lt;br /&gt;      ps2c  &amp;lt;= &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&lt;/span&gt;;&lt;br /&gt;      ps2d  &amp;lt;= &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;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;5&lt;/span&gt;us;&lt;br /&gt;      ps2d  &amp;lt;= &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;-- startbit&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;us;&lt;br /&gt;      ps2c  &amp;lt;= &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;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;40&lt;/span&gt;us;&lt;br /&gt;      ps2c  &amp;lt;= &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;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;us;&lt;br /&gt;      &lt;br /&gt;      parity := &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;for&lt;/span&gt; i &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;         ps2d &amp;lt;= din(i);&lt;br /&gt;         &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;if&lt;/span&gt;(din(i)=&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;            parity := &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;not&lt;/span&gt; parity; &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;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;us;&lt;br /&gt;         ps2c  &amp;lt;= &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;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;40&lt;/span&gt;us;&lt;br /&gt;         ps2c  &amp;lt;= &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;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;us;&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;br /&gt;      ps2d &amp;lt;= parity;  &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- parity&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;us;&lt;br /&gt;      ps2c  &amp;lt;= &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;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;40&lt;/span&gt;us;&lt;br /&gt;      ps2c  &amp;lt;= &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;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;us;&lt;br /&gt;   &lt;br /&gt;      ps2d &amp;lt;= &lt;span style=&quot;color: rgb(0, 68, 221);&quot;&gt;&#039;1&#039;&lt;/span&gt;;     &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- stopbit&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;us;&lt;br /&gt;      ps2c  &amp;lt;= &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;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;40&lt;/span&gt;us;&lt;br /&gt;      ps2c  &amp;lt;= &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;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;us;&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;procedure&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; PS2_Keyboard&lt;br /&gt;    &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;PORT&lt;/span&gt;(&lt;br /&gt;         PS2_Data : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;         PS2_Clk : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;         RxData : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;OUT&lt;/span&gt;  &lt;span style=&quot;color: rgb(0, 119, 68); 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;7&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;         RxActive : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;OUT&lt;/span&gt;  &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;         DataReady : &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;OUT&lt;/span&gt;  &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;         DataFetched : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;         CLK : &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, 119, 68); font-weight: bold;&quot;&gt;std_logic&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(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; TxData : &lt;span style=&quot;color: rgb(0, 119, 68); 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;7&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(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; PS2_Data : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&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;signal&lt;/span&gt; PS2_Clk : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&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;signal&lt;/span&gt; DataFetched : &lt;span style=&quot;color: rgb(0, 119, 68); 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; CLK : &lt;span style=&quot;color: rgb(0, 119, 68); 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; RxData : &lt;span style=&quot;color: rgb(0, 119, 68); 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;7&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; RxActive : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;signal&lt;/span&gt; DataReady : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;std_logic&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Clock period definitions&lt;/span&gt;&lt;br /&gt;   &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;constant&lt;/span&gt; CLK_period : &lt;span style=&quot;color: rgb(0, 119, 68); font-weight: bold;&quot;&gt;time&lt;/span&gt; := &lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;20&lt;/span&gt; ns; &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- 50MHz&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;   uut: PS2_Keyboard &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;          PS2_Data =&amp;gt; PS2_Data,&lt;br /&gt;          PS2_Clk =&amp;gt; PS2_Clk,&lt;br /&gt;          RxData =&amp;gt; RxData,&lt;br /&gt;          RxActive =&amp;gt; RxActive,&lt;br /&gt;          DataReady =&amp;gt; DataReady,&lt;br /&gt;          DataFetched =&amp;gt; DataFetched,&lt;br /&gt;          CLK =&amp;gt; CLK&lt;br /&gt;        );&lt;br /&gt;&lt;br /&gt;   &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Clock process definitions&lt;/span&gt;&lt;br /&gt;   CLK &amp;lt;= &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;not&lt;/span&gt; CLK &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;after&lt;/span&gt; CLK_period/&lt;span style=&quot;color: rgb(0, 0, 221); font-weight: bold;&quot;&gt;2&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- Stimulus process&lt;/span&gt;&lt;br /&gt;   DataFetched &amp;lt;= DataReady &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;10&lt;/span&gt; us; &lt;span style=&quot;color: rgb(136, 136, 136);&quot;&gt;-- fake handshake&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;   stim_proc: &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(136, 136, 136);&quot;&gt;-- hold reset state for 100 ns.&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;100&lt;/span&gt; ns;   &lt;br /&gt;      &lt;br /&gt;      TXData&amp;lt;=x&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;AA&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;      PS2Send(TXData,PS2_Clk,PS2_Data);&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;100&lt;/span&gt; us;   &lt;br /&gt;&lt;br /&gt;      TXData&amp;lt;=x&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;55&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;      PS2Send(TXData,PS2_Clk,PS2_Data);&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;100&lt;/span&gt; us;   &lt;br /&gt;&lt;br /&gt;      TXData&amp;lt;=x&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;br /&gt;      PS2Send(TXData,PS2_Clk,PS2_Data);&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;100&lt;/span&gt; us;   &lt;br /&gt;&lt;br /&gt;      TXData&amp;lt;=x&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;80&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;      PS2Send(TXData,PS2_Clk,PS2_Data);&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;100&lt;/span&gt; us;   &lt;br /&gt;&lt;br /&gt;      TXData&amp;lt;=x&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;      PS2Send(TXData,PS2_Clk,PS2_Data);&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;100&lt;/span&gt; us;   &lt;br /&gt;&lt;br /&gt;      TXData&amp;lt;=x&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;C3&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;      PS2Send(TXData,PS2_Clk,PS2_Data);&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;100&lt;/span&gt; us;   &lt;br /&gt;      &lt;br /&gt;      &lt;span style=&quot;color: rgb(0, 136, 0); font-weight: bold;&quot;&gt;wait&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 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;ergibt sich dann folgende Waveform:&lt;/p&gt;&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 750px;&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:136 --&gt;&lt;img height=&quot;213&quot; width=&quot;750&quot; class=&quot;serendipity_image_center&quot; src=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/WF_PS2_Simulation.gif&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Waveform Simulation PS2 Interface&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Hier die zusammengepackte Quelldatei und die passende Testbench: &lt;br /&gt;
Download &lt;a target=&quot;_blank&quot; title=&quot;PS2_Simplest.zip&quot; href=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/PS2_Simplest.zip&quot;&gt;PS2_Simplest.zip&lt;/a&gt;&lt;/p&gt;&lt;p&gt;In der zweiten Variante werden die Steuerkommandos (Break und Extended Keycode) in Flags umgewandelt: &lt;br /&gt;Download &lt;a target=&quot;_blank&quot; title=&quot;PS2_Simple.zip&quot; href=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/PS2_Simple.zip&quot;&gt;PS2_Simple.zip&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Die dritte Variante schliesslich erlaubt auch das Senden von Kommandos an die Tastatur. Damit können dann z.B. die LEDs auf der Tastatur an- und ausgeschaltet werden.&lt;br /&gt;Download &lt;a target=&quot;_blank&quot; title=&quot;PS2_Full.zip&quot; href=&quot;http://www.lothar-miller.de/s9y/uploads/Bilder/PS2_Full.zip&quot;&gt;PS2_Full.zip&lt;/a&gt;&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Tue, 26 Oct 2010 08:07:18 +0200</pubDate>
    <guid isPermaLink="false">http://www.lothar-miller.de/s9y/archives/75-guid.html</guid>
    
</item>

</channel>
</rss>
