{"id":2982,"date":"2024-08-25T22:13:01","date_gmt":"2024-08-25T22:13:01","guid":{"rendered":"https:\/\/workhouse.sweetdishy.com\/?p=2982"},"modified":"2024-08-25T22:13:01","modified_gmt":"2024-08-25T22:13:01","slug":"xnor-and-xor-gates","status":"publish","type":"post","link":"https:\/\/workhouse.sweetdishy.com\/index.php\/2024\/08\/25\/xnor-and-xor-gates\/","title":{"rendered":"XNOR and XOR Gates"},"content":{"rendered":"\n<p id=\"P0740\">The concepts of NAND, AND, NOR, and OR are relatively easy to understand because they map onto the way we think in everyday life. For example, a textual equivalent of a NOR could be:&nbsp;<em>\u201cIf it\u2019s windy<\/em>&nbsp;or&nbsp;<em>if it\u2019s raining then I\u2019m<\/em>&nbsp;not&nbsp;<em>going out.\u201d<\/em>&nbsp;By comparison, the concepts of XOR and XNOR can be a little harder to grasp because we don\u2019t usually consider things in these terms. A textual equivalent of an XOR could be:&nbsp;<em>\u201cIf it<\/em>&nbsp;is<a><\/a><em>windy and it\u2019s<\/em>&nbsp;not&nbsp;<em>raining, or if it\u2019s<\/em>&nbsp;not&nbsp;<em>windy and it<\/em>&nbsp;is&nbsp;<em>raining, then I will go out.\u201d<\/em>&nbsp;Although this does make sense (in a strange sort of way), we don\u2019t often find ourselves making decisions in this manner.<\/p>\n\n\n\n<p id=\"P0750\">For this reason, it is natural to assume that XNOR and XOR gates would be a little more difficult to construct. However, these gates are full of surprises, both in the way in which they work and the purposes for which they can be used. For example, a 2-input XNOR can be implemented using only four transistors (Figure 10.28). Unlike AND, NAND, OR, and NOR gates, there are no such beasts as XNOR or XOR primitives with more than two inputs. However, equivalent functions with more than two inputs can be formed by connecting a number of 2-input primitives together.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/learning.oreilly.com\/api\/v2\/epubs\/urn:orm:book:9781856175289\/files\/images\/F00010Xgr28.jpg\" alt=\"image\"\/><\/figure>\n\n\n\n<p><strong>Figure 10.28<\/strong>&nbsp;CMOS implementation of a 2-input XNOR gate<\/p>\n\n\n\n<p id=\"P0760\">The NOT gate would be constructed in the standard way using two transistors as described above, but the XNOR differs from the previous gates in the way that transistors Tr<sub>3<\/sub>&nbsp;and Tr<sub>4<\/sub>&nbsp;are utilized. First, consider the case where input&nbsp;<em>b<\/em>&nbsp;is presented with a logic 0: transistor Tr<sub>4<\/sub>&nbsp;is turned OFF, transistor Tr<sub>3<\/sub>&nbsp;is turned ON, and output&nbsp;<em>y<\/em>&nbsp;is connected to the output of the NOT gate via Tr<sub>3<\/sub>. Thus, when input&nbsp;<em>b<\/em>&nbsp;is logic 0, output&nbsp;<em>y<\/em>&nbsp;has the inverse of the value on input&nbsp;<em>a<\/em>. Now consider the case where input&nbsp;<em>b<\/em>&nbsp;is presented with a logic 1: transistor Tr<sub>3<\/sub>&nbsp;is turned OFF, transistor Tr<sub>4<\/sub>&nbsp;is turned ON, and output&nbsp;<em>y<\/em>&nbsp;is connected to input&nbsp;<em>a<\/em>&nbsp;via Tr<sub>4<\/sub>. Thus, when input&nbsp;<em>b<\/em>&nbsp;is logic 1, output&nbsp;<em>y<\/em>&nbsp;has the same value as input&nbsp;<em>a<\/em>. The end result of all these machinations is that wiring the transistors together in this way does result in a function that satisfies the requirements of the XNOR truth table.<\/p>\n\n\n\n<p id=\"P0770\">Unlike the other complementary gates, it is not necessary to invert the output of the XNOR to form an XOR (although we could if we wanted to, of course). A little judicious\u00a0rearranging of the components results in a 2-input XOR that also requires only four transistors (Figure 10.29).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/learning.oreilly.com\/api\/v2\/epubs\/urn:orm:book:9781856175289\/files\/images\/F00010Xgr29.jpg\" alt=\"image\"\/><\/figure>\n\n\n\n<p><strong>Figure 10.29<\/strong>&nbsp;CMOS implementation of a 2-input XOR gate<\/p>\n\n\n\n<p id=\"P0780\">First, consider the case where input&nbsp;<em>b<\/em>&nbsp;is presented with a logic 0: transistor Tr<sub>4<\/sub>&nbsp;is turned OFF, transistor Tr<sub>3<\/sub>&nbsp;is turned ON, and output&nbsp;<em>y<\/em>&nbsp;is connected to input&nbsp;<em>a<\/em>&nbsp;via Tr<sub>3<\/sub>. Thus, when input&nbsp;<em>b<\/em>&nbsp;is logic 0, output&nbsp;<em>y<\/em>&nbsp;has the same value as input&nbsp;<em>a<\/em>. Now consider the case where input&nbsp;<em>b<\/em>&nbsp;is presented with a logic 1: transistor Tr<sub>3<\/sub>&nbsp;is turned OFF, transistor Tr<sub>4<\/sub>&nbsp;is turned ON, and output&nbsp;<em>y<\/em>&nbsp;is connected to the output of the NOT gate via Tr<sub>4<\/sub>. Thus, when input&nbsp;<em>b<\/em>&nbsp;is logic 1, output&nbsp;<em>y<\/em>&nbsp;has the inverse of the value on input&nbsp;<em>a<\/em>. Once again, this results in a junction that satisfies the requirements of the XOR truth table.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The concepts of NAND, AND, NOR, and OR are relatively easy to understand because they map onto the way we think in everyday life. For example, a textual equivalent of a NOR could be:&nbsp;\u201cIf it\u2019s windy&nbsp;or&nbsp;if it\u2019s raining then I\u2019m&nbsp;not&nbsp;going out.\u201d&nbsp;By comparison, the concepts of XOR and XNOR can be a little harder to grasp [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2976,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[417],"tags":[],"class_list":["post-2982","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-digital-electronics"],"jetpack_featured_media_url":"https:\/\/workhouse.sweetdishy.com\/wp-content\/uploads\/2024\/08\/circuit.png","_links":{"self":[{"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/2982","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/comments?post=2982"}],"version-history":[{"count":1,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/2982\/revisions"}],"predecessor-version":[{"id":2983,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/2982\/revisions\/2983"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/media\/2976"}],"wp:attachment":[{"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/media?parent=2982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/categories?post=2982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/tags?post=2982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}