{"id":58,"date":"2015-10-21T14:12:27","date_gmt":"2015-10-21T13:12:27","guid":{"rendered":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/?p=58"},"modified":"2015-11-23T14:00:05","modified_gmt":"2015-11-23T14:00:05","slug":"concepts-ii-an-inverter","status":"publish","type":"post","link":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/2015\/10\/21\/concepts-ii-an-inverter\/","title":{"rendered":"Concepts II: An inverter"},"content":{"rendered":"<p><strong><span style=\"text-decoration: underline\">An inverter<\/span><\/strong><\/p>\n<p>In the second post in the <em>Concepts<\/em> series we will discuss another simple logic gate, an <em>inverter<\/em>.<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverter.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-59 size-large\" src=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverter-1024x320.png\" alt=\"inverter\" width=\"474\" height=\"148\" srcset=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverter-1024x320.png 1024w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverter-300x94.png 300w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverter.png 1400w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>An inverter takes an input signal, and outputs a signal in the\u00a0opposite, or inverted,\u00a0state as the input signal, the output is simply the opposite of the input. For example, if the input signal changes from 0 to 1, the output will eventually change from\u00a01 to 0. Similar to with the buffer, and the same with all gates, we say the output changes \u2018eventually\u2019 because the output changes after some unknown delay.<\/p>\n<p>So how\u00a0do we design\u00a0an inverter\u00a0using concepts? We need to describe what causes the output to transition, in terms of when the input transitions.\u00a0 This\u00a0can be described as:<\/p>\n<p><strong>inverter(in, out) = in+ <\/strong><strong>\u21dd out- <\/strong><strong>\u22c4 in- <\/strong><strong>\u21dd out+<\/strong><\/p>\n<p>This is very similar to the buffer concept, but with some subtle differences.\u00a0 This concept implies that <strong>in+<\/strong> causes <strong>out-<\/strong>.\u00a0 This is composed with <strong>in- <\/strong>causing <strong>out+<\/strong>.\u00a0 Therefore, this concept suggest that when the input transitions one way, the output will eventually transition in the opposite direction, for example, when <strong>in+ <\/strong>occurs, <strong>out-<\/strong> will eventually occur after, providing <strong>in <\/strong>stays <strong>high<\/strong>.<\/p>\n<p>As with the <a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/2015\/09\/30\/designing-asynchronous-logic-gates-using-behavioural-concepts-i-a-buffer-2\/\">previous post<\/a>, we need to produce an STG from the inverter concept, which we can simulate, verify and test.\u00a0\u00a0To do this, we pass this into the conversion\u00a0algorithm, which starts as follows:<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/09\/Buffer0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-42 size-large\" src=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/09\/Buffer0-1024x334.png\" alt=\"Buffer0\" width=\"474\" height=\"155\" srcset=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/09\/Buffer0-1024x334.png 1024w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/09\/Buffer0-300x98.png 300w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/09\/Buffer0.png 1400w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>As with the buffer, it starts off by placing cycles for each individual signal.\u00a0 This keeps the property of\u00a0consistency in the STG, as discussed in <em><a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/2015\/09\/30\/designing-asynchronous-logic-gates-using-behavioural-concepts-i-a-buffer-2\/\">Concepts I<\/a><\/em>.<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverter1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-62 size-large\" src=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverter1-1024x358.png\" alt=\"inverter1\" width=\"474\" height=\"166\" srcset=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverter1-1024x358.png 1024w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverter1-300x105.png 300w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverter1.png 1400w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>Next, the first\u00a0causality of the inverter\u00a0concept is applied to these cycles.\u00a0 This is <strong>in+ \u21dd out-<\/strong>. This connects the place after\u00a0<strong>in+<\/strong>, labelled as\u00a0<strong>in_1<\/strong>, with the signal transition of <strong>out-<\/strong>, using a <em>read-arc<\/em>. This is so that\u00a0for <strong>out- <\/strong>to occur, <strong>in <\/strong>must have already transitioned <strong>high<\/strong>, which is displayed by <strong>in_1<\/strong> possessing a token. The read-arc stops <strong>out-<\/strong> from consuming the token in <strong>in_1<\/strong> which would block <strong>in-<\/strong> from happening, but allows <strong>out-<\/strong>\u00a0to occur.<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverterSTG2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-63 size-large\" src=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverterSTG2-1024x396.png\" alt=\"inverterSTG2\" width=\"474\" height=\"183\" srcset=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverterSTG2-1024x396.png 1024w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverterSTG2-300x116.png 300w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/inverterSTG2.png 1400w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>Finally, another read arc is used which represents the concept of <strong>in- <\/strong><strong>\u21dd<\/strong><strong> out+<\/strong>, connecting <strong>in_0<\/strong> place with the <strong>out+<\/strong> transition. This conversion of a concept to an STG is now complete, and this correctly represents the operation of an inverter.<\/p>\n<p>Note, as with the buffer STG,\u00a0that in the above STGs we assume that all signals are initialised to 0.\u00a0 In this case, it means that the output can initially transition <strong>high<\/strong> and will do eventually, due to the fact that in input is initially 0.<\/p>\n<p>In a later blog post we will see how to use concepts to specify initial states of all signals in a compositional manner.<\/p>\n<p><strong><span style=\"text-decoration: underline\">More reuse<\/span><\/strong><\/p>\n<p>We have now defined both an inverter and a buffer in these first two posts.\u00a0 So lets use these together to show some reuse, and how these can be used together.<\/p>\n<p>For this example, lets use a buffer and inverter loop.\u00a0 It doesn&#8217;t necessarily have any real-world applications as these logic gates, but it&#8217;s a perfect example to show how concepts can be composed, and produces some interesting results.<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/bufferinverter.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-83 size-full\" src=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/bufferinverter.png\" alt=\"bufferinverter\" width=\"1400\" height=\"812\" srcset=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/bufferinverter.png 1400w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/bufferinverter-300x174.png 300w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/bufferinverter-1024x594.png 1024w\" sizes=\"auto, (max-width: 1400px) 100vw, 1400px\" \/><\/a><\/p>\n<p>The signals shown in this diagram are\u00a0simply used for viewing the outputs from the inverter and the\u00a0buffer, but can be used\u00a0as part of the concepts.<\/p>\n<p>This circuit can be produced from the following concept:<\/p>\n<p><strong>bufferAndInverter = buffer(a,b)\u00a0\u22c4 inverter(b,a)<\/strong><\/p>\n<p>In this circuit, <strong>a<\/strong> is an input to the buffer, but the output from the inverter, and these are connected. \u00a0<strong>b<\/strong> is another signal connecting the output of the <strong>buffer<\/strong> to the input of the<strong> inverter<\/strong>.<\/p>\n<p>As with the <strong>doubleBuffer\u00a0<\/strong>example from the previous post,\u00a0we could have described this using signal-level concepts, which would be a longer description that that of the one above. Since we have defined both an inverter and a\u00a0buffer, we can simply reuse this definition in order to save time on describing concepts. The <strong>bufferAndInverter <\/strong>STG will be, assuming all signals are initially 0,\u00a0as follows:<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/bufferAndInverterSTG.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-79 size-full\" src=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/bufferAndInverterSTG.png\" alt=\"bufferAndInverterSTG\" width=\"1400\" height=\"578\" \/><\/a><\/p>\n<p>By following pairs of arcs, it is possible to see which are a cause of the buffer, and which are a cause of the inverter.\u00a0 This STG can now be simulated, and does in fact act as expected from the circuit above.\u00a0 When <strong>a+ <\/strong>occurs, <strong>b+<\/strong> is enabled,\u00a0 and after it transitions, this will cause <strong>a-<\/strong> to be enabled.\u00a0 When <strong>a- <\/strong>has occurred, <strong>b-<\/strong> can then occur, after which <strong>a+<\/strong> is enabled, and this completes the circuit.<\/p>\n<p>This STG can be resynthesized, and the result is rather interesting:<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/handshake1.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-85 size-medium aligncenter\" src=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/handshake1-298x300.png\" alt=\"handshake1\" width=\"298\" height=\"300\" srcset=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/handshake1-298x300.png 298w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/handshake1-150x150.png 150w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/handshake1-1017x1024.png 1017w, https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/files\/2015\/10\/handshake1.png 1400w\" sizes=\"auto, (max-width: 298px) 100vw, 298px\" \/><\/a><\/p>\n<p>The resulting STG is in-fact the STG for a <em><strong>handshake protocol<\/strong><\/em>.\u00a0 This means that what we have defined above, <strong>bufferAndInverter<\/strong>, is actually a <strong>handshake<\/strong>, described using a buffer and an inverter.\u00a0 Therefore, let&#8217;s drop the current name, and re-define it using some parameters, so that any pair of signals can be handshaked.<\/p>\n<p><strong>handshake(a,b)\u00a0= buffer(a,b)\u00a0\u22c4 inverter(b,a)<\/strong><\/p>\n<p>Handshakes are very useful for asynchronous systems, and having a concept defined for use at any time can make the design process much easier and quicker.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>Finally<\/strong><\/span><\/p>\n<p>In this post, we have discussed how to describe a second logic gate, an inverter. We have described this\u00a0in terms of concepts, and shown the conversion to produce an STG. We have also shown how a buffer and an inverter can be used\u00a0in conjunction with one-another\u00a0to produce a circuit, now that both have been pre-defined.<\/p>\n<p>The\u00a0next post, <strong><em>Concepts III:\u00a0Initial States <\/em><\/strong>will use buffers and inverters as examples of how initial states can be defined using concepts, or in the case that initial states are not defined, how the conversion algorithm will apply options for initial states, so an STG produced can still be used for simulation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An inverter In the second post in the Concepts series we will discuss another simple logic gate, an inverter. An inverter takes an input signal, and outputs a signal in the\u00a0opposite, or inverted,\u00a0state as the input signal, the output is simply the opposite of the input. For example, if the input signal changes from 0 &hellip; <a href=\"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/2015\/10\/21\/concepts-ii-an-inverter\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Concepts II: An inverter<\/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,2,7,6],"tags":[],"class_list":["post-58","post","type-post","status-publish","format-standard","hentry","category-asynchronous","category-concepts","category-inverter","category-logic-gate"],"_links":{"self":[{"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/posts\/58","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=58"}],"version-history":[{"count":17,"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/posts\/58\/revisions"}],"predecessor-version":[{"id":91,"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/posts\/58\/revisions\/91"}],"wp:attachment":[{"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/media?parent=58"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/categories?post=58"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/jrbeaumont\/wp-json\/wp\/v2\/tags?post=58"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}