{"id":118,"date":"2016-07-05T13:03:03","date_gmt":"2016-07-05T12:03:03","guid":{"rendered":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/?p=118"},"modified":"2016-07-05T13:03:03","modified_gmt":"2016-07-05T12:03:03","slug":"concepts-v-set-reset-latch","status":"publish","type":"post","link":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/2016\/07\/05\/concepts-v-set-reset-latch\/","title":{"rendered":"Concepts V: Set-Reset Latch"},"content":{"rendered":"<p><span style=\"text-decoration: underline\"><strong>Set-Reset Latch<\/strong><\/span><\/p>\n<p>After learning how a <a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/2016\/01\/13\/concepts-iv-c-element\/\">C-element<\/a> can be produce with concepts, we can introduce other gates. In this case another fairly standard gate, a <em>latch<\/em>.<\/p>\n<p>The operation of a latch is to hold a given value. There are several different types of latch, but in this case we will talk about a\u00a0<em>Set-Reset latch (SR Latch).\u00a0<\/em>This latch has two inputs, one will\u00a0<em>set<\/em> the latch when high, causing its one output to be high. The second input will\u00a0<em>reset<\/em> the latch when it is high, causing its output to be low.<\/p>\n<p>So lets see how we can specify this using concepts.<\/p>\n<p><strong><span style=\"text-decoration: underline\">Concepts<\/span><\/strong><\/p>\n<p>For this, let&#8217;s start off by referring to the two inputs as\u00a0<strong>a\u00a0<\/strong>and\u00a0<strong>b<\/strong>. The output is\u00a0<strong>c<\/strong>.<\/p>\n<p>So, first of all, lets think about how we can set the latch:<\/p>\n<p><strong>set = a+\u00a0<strong>\u21dd c+\u00a0<strong><strong><strong><strong>\u22c4 a-\u00a0<strong><strong>\u21dd c-<\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/p>\n<p>And it&#8217;s that simple. Simply put, when one of the outputs,\u00a0<strong>a<\/strong> in this case, goes high, we want the output,\u00a0<strong>c<\/strong>, to go high.<\/p>\n<p>So we have described the interaction for set using one of the inputs and the output, now lets describe the reset action:<\/p>\n<p><strong>reset = b+<\/strong>\u00a0<strong><strong>\u21dd c-\u00a0<strong><strong><strong><strong><strong><strong>\u22c4 b-\u00a0<strong><strong>\u21dd c+<\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/p>\n<p>This will cause the output to go low when the\u00a0second input,\u00a0<strong>b<\/strong>, goes high.<\/p>\n<p>These two concepts describe the operation of a SR-latch. But we still need to think about how the SR-latch will act initially, such as when it first receives power.<\/p>\n<p>Unless specifically required, we should assume that the output of the latch should be low at startup. Because of this, we don&#8217;t want it to be set initially by\u00a0<strong>a<\/strong> being high, so we can set this to 0 initially also.<\/p>\n<p>However, with the second input,\u00a0<strong>b<\/strong>, setting this high at this point would\u00a0ensure that the output will reset to 0 at start up, but if the initial state of\u00a0<strong>c<\/strong> is already set to low initially, we shouldn&#8217;t need to set\u00a0<strong>b\u00a0<\/strong>to high, so we will set the initial state of this to low too.<\/p>\n<p>The <a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/2015\/11\/24\/concepts-iii-initial-states\/\">initial state concept<\/a> will be as follows:<\/p>\n<p><strong>initialState = initialise(a, 0)\u00a0<strong>\u22c4 initialise(b, 0)\u00a0<strong>\u22c4 initialise(c, 0)<\/strong><\/strong><\/strong><\/p>\n<p>Now let&#8217;s create the scenario concept for the SR-Latch:<\/p>\n<p><strong>SRLatch = set\u00a0<strong>\u22c4 reset\u00a0<strong>\u22c4 initialState<\/strong><\/strong><\/strong><\/p>\n<p>And this can be converted to a Signal Transition Graph, so this specification\u00a0can be verified, simulated, tested and then synthesised. The STG for a SRLatch will be as follows:<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2016\/07\/STG_SR_Latch.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-132\" src=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2016\/07\/STG_SR_Latch.png\" alt=\"STG_SR_Latch\" width=\"1400\" height=\"411\" srcset=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2016\/07\/STG_SR_Latch.png 1400w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2016\/07\/STG_SR_Latch-300x88.png 300w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2016\/07\/STG_SR_Latch-768x225.png 768w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2016\/07\/STG_SR_Latch-1024x301.png 1024w\" sizes=\"auto, (max-width: 1400px) 100vw, 1400px\" \/><\/a><\/p>\n<p>This is a fairly simple STG, but simulation would prove that setting\u00a0<strong>a\u00a0<\/strong>high will allow\u00a0<strong>c<\/strong> to transition high. Once it has transitioned high, it cannot transition low until\u00a0<strong>b<\/strong> has been set high.<\/p>\n<p>For some simpler understanding of how this latch works, we can change some of the signal names.\u00a0In this case, we will change\u00a0<strong>a<\/strong> to\u00a0<strong>s<\/strong>, which stands for\u00a0<em>set<strong>.\u00a0<\/strong><\/em><strong>b\u00a0<\/strong>will be set to\u00a0<strong>r<\/strong>, which stands for reset. Finally, we can call\u00a0<strong>c<\/strong>,\u00a0<strong>q.\u00a0<\/strong><strong>q<\/strong> is a standard output symbol for latches.<\/p>\n<p>This will change the concepts to the following:<\/p>\n<p><strong>set = s+\u00a0<strong>\u21dd q+\u00a0<strong><strong><strong><strong>\u22c4\u00a0<\/strong><\/strong><\/strong><\/strong><strong>s-\u00a0<strong>\u21dd q-<\/strong><\/strong><br \/>\n<strong>reset = r+<\/strong>\u00a0<strong><strong>\u21dd q-\u00a0<strong><strong><strong><strong>\u22c4\u00a0<strong><strong><strong>r-<\/strong>\u00a0<strong><strong>\u21dd q+<\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><br \/>\n<strong>initialState = initialise(s, 0)\u00a0<strong>\u22c4 initialise(r, 0)\u00a0<strong>\u22c4 initialise(q, 0)<\/strong><\/strong><\/strong><br \/>\n<strong>SRLatch = set\u00a0<strong>\u22c4 reset\u00a0<strong>\u22c4 initialState<\/strong><\/strong><\/strong><br \/>\n<\/strong><\/strong><\/p>\n<p>This will produce the following STG:<a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2016\/07\/STG_SR_Lath2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-133\" src=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2016\/07\/STG_SR_Lath2.png\" alt=\"STG_SR_Lath2\" width=\"2050\" height=\"603\" srcset=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2016\/07\/STG_SR_Lath2.png 2050w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2016\/07\/STG_SR_Lath2-300x88.png 300w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2016\/07\/STG_SR_Lath2-768x226.png 768w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2016\/07\/STG_SR_Lath2-1024x301.png 1024w\" sizes=\"auto, (max-width: 2050px) 100vw, 2050px\" \/><\/a><\/p>\n<p>Changing the names of the signals does not affect the operation.<\/p>\n<p>Now the SR-Latch has been defined, if a user has signals which will be inputs to a latch, they can use the concept and pass their signals into this, in the order of\u00a0<strong>s, r\u00a0<\/strong>and\u00a0<strong>q<\/strong>. \u00a0For example someone can use the concept:<\/p>\n<p><strong>SRLatch(x, y, z)<\/strong><\/p>\n<p>In this case, <strong>x<\/strong> will be the set signal,\u00a0<strong>y<\/strong> is the reset and\u00a0<strong>z<\/strong> will be the output.<\/p>\n<p><strong><span style=\"text-decoration: underline\">Some reuse<\/span><\/strong><\/p>\n<p>As is usually the case with concepts, we can define a SR-Latch using previously defined gates as concepts.<\/p>\n<p>First of all, if we look at\u00a0the\u00a0<strong>set\u00a0<\/strong>concept, it is clear that\u00a0<strong>s\u00a0<\/strong>and\u00a0<strong>q\u00a0<\/strong>form a <a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/2015\/09\/30\/designing-asynchronous-logic-gates-using-behavioural-concepts-i-a-buffer-2\/\">buffer<\/a>. So this can be rewritten as:<\/p>\n<p><strong>set = buffer(s, q)<\/strong><\/p>\n<p>The\u00a0<strong>reset<\/strong> concept can also be redefined. In this case, it acts as an <a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/2015\/09\/30\/designing-asynchronous-logic-gates-using-behavioural-concepts-i-a-buffer-2\/\">inverter<\/a>:<\/p>\n<p><strong>reset = inverter(r, q)<\/strong><\/p>\n<p>As the initial state doesn&#8217;t need to be changed, we can compose these concepts as above to produce the SRLatch concept:<\/p>\n<p><strong><strong><strong>SRLatch = set\u00a0<strong>\u22c4 reset\u00a0<strong>\u22c4 initialState<\/strong><\/strong><\/strong><\/strong><\/strong><\/p>\n<p>Or we can reduce the number of concepts defined and compose these as follows:<\/p>\n<p><strong>SRLatch = buffer(s, q)\u00a0<strong><strong><strong><strong>\u22c4 inverter(r, q)\u00a0<strong><strong><strong><strong>\u22c4 initialState<\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/p>\n<p>There are of course several ways of specifying an SRLatch using concepts, but these are two of the simpler ways, either using signal-level concepts, or predefined gate-level concepts. The preference is entirely on the user.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>Finally<\/strong><\/span><\/p>\n<p>In this post, we have explained another simple logic gate. The discussion includes the basic operation being specified as signal-level concepts, or by taking this a step higher and using pre-defined gates.<\/p>\n<p>We have also shown how while the concept defines certain signal names, these aren&#8217;t set. A default SRLatch concept will use these signal names, but if these signals are not used in a design, a user can pass the desired signal names into the concept, and these names will replace the default ones.<\/p>\n<p>This blog series will continue soon, with the inclusion of further logic gates and how they can be defined simply.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Set-Reset Latch After learning how a C-element can be produce with concepts, we can introduce other gates. In this case another fairly standard gate, a latch. The operation of a latch is to hold a given value. There are several different types of latch, but in this case we will talk about a\u00a0Set-Reset latch (SR &hellip; <a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/2016\/07\/05\/concepts-v-set-reset-latch\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Concepts V: Set-Reset Latch<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":6010,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5,2,7,10,6,1],"tags":[],"class_list":["post-118","post","type-post","status-publish","format-standard","hentry","category-asynchronous","category-buffer","category-concepts","category-inverter","category-latch","category-logic-gate","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/users\/6010"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/comments?post=118"}],"version-history":[{"count":8,"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/posts\/118\/revisions"}],"predecessor-version":[{"id":134,"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/posts\/118\/revisions\/134"}],"wp:attachment":[{"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/media?parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/categories?post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/tags?post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}