{"id":1992,"date":"2020-01-17T20:39:55","date_gmt":"2020-01-18T04:39:55","guid":{"rendered":"http:\/\/wonghoi.humgar.com\/blog\/?p=1992"},"modified":"2020-01-18T21:30:31","modified_gmt":"2020-01-19T05:30:31","slug":"shortest-explanation-to-sr-flip-flop","status":"publish","type":"post","link":"https:\/\/wonghoi.humgar.com\/blog\/2020\/01\/17\/shortest-explanation-to-sr-flip-flop\/","title":{"rendered":"Shortest Explanation to NAND SR-flip-flop"},"content":{"rendered":"<p>When I was in high school studying electronics on my own as a hobby (it was not taught in the curriculum. No, physics people culturally hates electronics, they consider it a chore.), I followed the logic states of the bistable (two NAND gates) meticulously. However, it was tedious and hard to remember correctly.<\/p>\n<p>There&#8217;s a fast way to reconstruct the explanation from scratch. You&#8217;ll need these invariants:<\/p>\n<ul>\n<li>&#8216;1&#8217; is &#8216;let the other input decide&#8217; in AND logic (1 &amp; A = A)<\/li>\n<li>&#8216;0&#8217; is &#8216;<strong>action<\/strong>&#8216; in AND logic, namely clear (0 &amp; A = 0)<\/li>\n<li>NAND is practically a NOT gate if you tie the inputs together<\/li>\n<li>Two NOT gates chasing each other generates Q&#8217; and Q<\/li>\n<li>NAND gates provides a mean for external inputs to disturb the chasing NOT gates<\/li>\n<\/ul>\n<p>By leaving external inputs (S and R) at &#8216;1&#8217;, we are letting the state pins decide, behaving like the two chasing NOT gates.<\/p>\n<p>The only way to disturb the state is to create a &#8216;0&#8217; (clear) <strong>action<\/strong>. The circuit is symmetric, so &#8216;S&#8217; and &#8216;R&#8217; is arbitrary as long as you are willing to switch the roles of Q and Q&#8217;.<\/p>\n<ul>\n<li>Set Q to &#8216;0&#8217; by sending a &#8216;0&#8217; (clear <strong>action<\/strong>) through &#8216;S&#8217;<\/li>\n<li>Set Q&#8217; to &#8216;0&#8217; by sending a &#8216;0&#8217; (clear <strong>action<\/strong>) through &#8216;R&#8217;<\/li>\n<\/ul>\n<p>There are no other valid <strong>actions<\/strong> in this configuration.<\/p>\n<hr \/>\n<p>Side note: persisting the clear action will lead to 0 &amp; 0 = 0 at the applied input and 1 &amp; 1 = 1 at opposite NAND gate, which the achieved state remains. Normally we want to return the external inputs back to 1 to receive future commands (actions) correctly, both external inputs asserting low is invalid.<\/p>\n<p>It&#8217;s more natural to have S and R being active high in transistor&#8217;s implementation. NAND&#8217;s &#8216;S&#8217; and &#8216;R&#8217; are active low (so technically, I should use S&#8217; and R&#8217; instead, but I&#8217;m following the more common nomenclature for the moment for the NAND gate implementation).<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_1992\" class=\"pvc_stats all  \" data-element-id=\"1992\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>When I was in high school studying electronics on my own as a hobby (it was not taught in the curriculum. No, physics people culturally hates electronics, they consider it a chore.), I followed the logic states of the bistable &hellip; <a href=\"https:\/\/wonghoi.humgar.com\/blog\/2020\/01\/17\/shortest-explanation-to-sr-flip-flop\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_1992\" class=\"pvc_stats all  \" data-element-id=\"1992\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[18],"tags":[],"class_list":["post-1992","post","type-post","status-publish","format-standard","hentry","category-electronics"],"_links":{"self":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/1992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/comments?post=1992"}],"version-history":[{"count":3,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/1992\/revisions"}],"predecessor-version":[{"id":1995,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/1992\/revisions\/1995"}],"wp:attachment":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/media?parent=1992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/categories?post=1992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/tags?post=1992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}