<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" 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/"><channel><title>Entering The World Of FPGA&amp;#39;s with a DEO-NANO P0082 - Part 5 (modelling a M74HC590)</title><link>/technologies/fpga-group/b/blog/posts/entering-the-world-of-fpga-s-with-a-deo-nano-p0082---part-5-modelling-a-m74hc590</link><description>Ive been recently using an M74HC590 binary counter to capture some data from an opto-encoder and thought that since I&amp;#39;d modelled a basic binary counter into the FPGA, why don&amp;#39;t I go the whole hog and model this real world component into it to...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Entering The World Of FPGA&amp;#39;s with a DEO-NANO P0082 - Part 5 (modelling a M74HC590)</title><link>https://community.element14.com/technologies/fpga-group/b/blog/posts/entering-the-world-of-fpga-s-with-a-deo-nano-p0082---part-5-modelling-a-m74hc590</link><pubDate>Sat, 26 Aug 2017 05:53:46 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a5bf9f7d-5459-4a7d-a462-73acd0ab0ee1</guid><dc:creator>jw0752</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hi Lucie,&lt;/p&gt;&lt;p&gt;I enjoyed your presentation. Reading through the discussion afterwards reminded me what it was like as a child to sit and listen to the grown-ups talk. I understood just enough to be really impressed with everyone.&lt;/p&gt;&lt;p&gt;John&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=3472&amp;AppID=19&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Entering The World Of FPGA&amp;#39;s with a DEO-NANO P0082 - Part 5 (modelling a M74HC590)</title><link>https://community.element14.com/technologies/fpga-group/b/blog/posts/entering-the-world-of-fpga-s-with-a-deo-nano-p0082---part-5-modelling-a-m74hc590</link><pubDate>Fri, 25 Aug 2017 19:39:51 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a5bf9f7d-5459-4a7d-a462-73acd0ab0ee1</guid><dc:creator>DAB</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Good post Lucie.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Your compile results helped to provide me with a gage on just how many devices you might be able to setup in this FPGA.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;You are definitely answering the basic question I had about the product.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Well done.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;DAB&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=3472&amp;AppID=19&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Entering The World Of FPGA&amp;#39;s with a DEO-NANO P0082 - Part 5 (modelling a M74HC590)</title><link>https://community.element14.com/technologies/fpga-group/b/blog/posts/entering-the-world-of-fpga-s-with-a-deo-nano-p0082---part-5-modelling-a-m74hc590</link><pubDate>Fri, 25 Aug 2017 18:41:49 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a5bf9f7d-5459-4a7d-a462-73acd0ab0ee1</guid><dc:creator>rachaelp</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;As &lt;span&gt;[mention:fbb6a29175924ef2b9847498e58a0842:e9ed411860ed4f2ba0265705b8793d05]&lt;/span&gt; gave you his implementation of your design in Verilog, I&amp;#39;ve gone ahead and thrown something similar together in VHDL. I&amp;#39;ve not run it through a compiler or checked syntax and it&amp;#39;s off the top of my head so I might have got something wrong as I am a tad rusty but here goes:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:3ef06e6b-9b7d-4651-b12d-db8be7f5e991:type=text&amp;amp;text=library+IEEE%3B%0Ause+IEEE.std_logic_1164.all%3B%0Ause+IEEE.numeric_std.all%3B%0A%0Aentity+74HC590+is%0Abegin%0A+++port+%28%0A++++++CCK+++%3A+in++std_logic%3B++++++++++++++++++++%2F%2F+Counter+clock%2C+rising+edge.%0A++++++CCKEN+%3A+in++std_logic%3B++++++++++++++++++++%2F%2F+Counter+clock+enable%2C+active+LOW.%0A++++++RCK+++%3A+in++std_logic%3B++++++++++++++++++++%2F%2F+Register+clock%2C+rising+edge.%0A++++++G+++++%3A+in++std_logic%3B++++++++++++++++++++%2F%2F+Output+enable%2C+active+LOW.%0A++++++CCLR++%3A+in++std_logic%3B++++++++++++++++++++%2F%2F+Counter+clear%2C+active+LOW.%0A++++++RCO+++%3A+out+std_logic%3B++++++++++++++++++++%2F%2F+Ripple+carry+output%2C+active+low.%0A++++++Q+++++%3A+out+std_logic_vector+%287+downto+0%29+%2F%2F+Chip+output%2C+may+be+high-Z.%0A+++%29%0Aend+entity%3B%0A%0Aarchitecture+RTL+of+74HC590+is%0A%0Asignal+countVal+%3A+std_logic_vector+%287+downto+0%29%3B%0Asignal+RCO_i++++%3A+std_logic%3B%0Asignal+CCK_last+%3A+std_logic%3B%0A%0Abegin%0A%0A--+Counter+process%0ACOUNT1%3A+process+%28RCK%29+--+Only+RCK+needs+to+be+in+the+sensitivity+list+as+the+process+is+fully+synchronous.%0Abegin%0A+++if+rising_edge+%28RCK%29+then%0A++++++countVal+%3C%3D+countVal%3B%0A++++++CCK_last+%3C%3D+CCK%3B%0A++++++if+%28CCLR+%3D+%270%27%29+then%0A+++++++++countVal+%3C%3D+X%2200%22%3B%0A++++++elsif+%28CCKEN+%3D+%270%27%29+then%0A+++++++++if+%28CCK+%3D+%271%27+and+CCK_last+%3D+%270%27%29+then%0A++++++++++++if+%28countVal+%3E%3D+X%22FF%22%29+then%0A+++++++++++++++countVal+%3C%3D+X%2200%22%3B%0A++++++++++++else%0A+++++++++++++++countVal+%3C%3D+countVal+%2B+X%2201%22%3B%0A++++++++++++end+if%3B%0A+++++++++end+if%3B%0A++++++end+if%3B%0A+++end+if%3B%0Aend+process%3B%0A%0ARCO_i+%3C%3D+%270%27+when+countVal+%3D+X%22FF%22+else+%271%27%3B%0A%0A--+Assign+to+outputs+and+create+the+tristate+buffers%0AQ+%3C%3D+countVal+when+G+%3D+%271%27+else+%28others+%3D%3E+%27Z%27%29%3B%0ARCO+%3C%3D+RCO_i+when+G+%3D+%271%27+else+%27Z%27%3B%0A%0Aend+architecture%3B]&lt;/p&gt;&lt;div&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;It&amp;#39;s also possible to have an asynchronous reset but as &lt;span&gt;[mention:a5312e9762dd4699ba5d3876da34ffe5:e9ed411860ed4f2ba0265705b8793d05]&lt;/span&gt; pointed out, you don&amp;#39;t necessarily want to have asynchronous things going on in your FPGA. A global reset can be ok but again you need to be careful to ensure at startup your entire chip comes out of reset at the same time.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Best Regards,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Rachael&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=3472&amp;AppID=19&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Entering The World Of FPGA&amp;#39;s with a DEO-NANO P0082 - Part 5 (modelling a M74HC590)</title><link>https://community.element14.com/technologies/fpga-group/b/blog/posts/entering-the-world-of-fpga-s-with-a-deo-nano-p0082---part-5-modelling-a-m74hc590</link><pubDate>Fri, 25 Aug 2017 17:54:04 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a5bf9f7d-5459-4a7d-a462-73acd0ab0ee1</guid><dc:creator>johnbeetem</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;If you&amp;#39;re interested, here&amp;#39;s how I&amp;#39;d write the Verilog for the 74HC590.&amp;nbsp; Along with your data sheet excerpts I downloaded a &lt;a class="jive-link-external-small" href="https://assets.nexperia.com/documents/data-sheet/74HC590.pdf" rel="nofollow ugc noopener" target="_blank"&gt;data sheet from Nexperia&lt;/a&gt;, the new name for Philips&amp;#39; jellybean semiconductors, originally&amp;nbsp; Signetics (yep, I&amp;#39;m old).&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;// The I/Os are pretty much the same except that RCO is not registered: it&amp;#39;s combinational and only depends on the current value of the counter.&amp;nbsp; I&amp;#39;ve also made a separate output port Q since it may be high-impedance.&amp;nbsp; I&amp;#39;ve named the internal counter register &amp;quot;K&amp;quot; and storage register &amp;quot;R&amp;quot; to save typing.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;input CCK;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Counter clock, rising edge.&lt;/p&gt;&lt;p&gt;input CCKEN;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Counter clock enable, active LOW.&lt;/p&gt;&lt;p&gt;input RCK;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Register clock, rising edge.&lt;/p&gt;&lt;p&gt;input G;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Output enable, active LOW.&lt;/p&gt;&lt;p&gt;input CCLR;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Counter clear, active LOW.&lt;/p&gt;&lt;p&gt;output RCO;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Ripple carry output, active low.&lt;/p&gt;&lt;p&gt;output [7:0] Q;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Chip output, may be high-Z.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;reg [7:0] K;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Counter register.&lt;/p&gt;&lt;p&gt;reg [7:0] R;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Storage register.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;// Updating R from K is unconditional.&lt;/p&gt;&lt;p&gt;always @(posedge RCK) begin R &amp;lt;= K; end&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;// This is compacted from your version by making CCKEN a carry-in.&lt;/p&gt;&lt;p&gt;always @(posedge CCK or negedge CCLR)&lt;/p&gt;&lt;p&gt;begin&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!CCLR) K &amp;lt;= 0; else K &amp;lt;= K + !CCKEN;&lt;/p&gt;&lt;p&gt;end&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;// Q is high-impedance if OE is high and outputs the storage register R if OE is active low.&lt;/p&gt;&lt;p&gt;assign Q = OE? 8&amp;#39;hzz: R;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;// The RCO output only depends on the current value of K.&amp;nbsp; It&amp;#39;s not clocked.&lt;/p&gt;&lt;p&gt;assign RCO = K != 255;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // RCO is low when K = 255.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=3472&amp;AppID=19&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Entering The World Of FPGA&amp;#39;s with a DEO-NANO P0082 - Part 5 (modelling a M74HC590)</title><link>https://community.element14.com/technologies/fpga-group/b/blog/posts/entering-the-world-of-fpga-s-with-a-deo-nano-p0082---part-5-modelling-a-m74hc590</link><pubDate>Fri, 25 Aug 2017 08:43:44 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a5bf9f7d-5459-4a7d-a462-73acd0ab0ee1</guid><dc:creator>michaelkellett</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hello Lucie,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I don&amp;#39;t think this will work properly&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;em&gt;always @ (posedge CCK or negedge CCLR)&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;It&amp;#39;s legal Verilog but:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;It wont&amp;#39; work like the chip because CCLR is an asynchronous reset in real life. In fact I&amp;#39;m not sure what it will do because the FPGA doesn&amp;#39;t have edge detect hardware - the construction &lt;em&gt;always @ (posedge CCK) &lt;/em&gt;gives the synthesizer a hint that you want to make a synchronous process using CCK as the clock so it connects CCK to the clock port of its flip-flops. The hardware has no way of ORing the edges so the synthesizer will make some assumptions (didn&amp;#39;t it give a warning ?).&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I don&amp;#39;t use Verilog because I think it is more susceptible to this kind of problem.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;There is some more explanation here:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a class="jive-link-external-small" href="https://electronics.stackexchange.com/questions/26502/verilog-check-for-two-negedges-in-always-block" rel="nofollow ugc noopener" target="_blank" title="https://electronics.stackexchange.com/questions/26502/verilog-check-for-two-negedges-in-always-block"&gt;https://electronics.stackexchange.com/questions/26502/verilog-check-for-two-negedges-in-always-block&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In real life it is almost never a good idea to do FPGA design based on emulation of standard logic chips.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Even having an asynchronous clear for a counter on an FPGA is bad news - the usual way is to synchronize the clear and reset signals to the clock - but that wouldn&amp;#39;t be like the chip either.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The problem is that if the CCLR and CCK edges get too close together in time the design won&amp;#39;t meet the timing constraints of the chip and won&amp;#39;t behave predictably - the only way to design with FPGAs and have the tools make good predictions about timing margins is to design synchronously.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;MK&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=3472&amp;AppID=19&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>