<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ritobrata Ghosh</title>
    <description>The latest articles on Forem by Ritobrata Ghosh (@ghoshr).</description>
    <link>https://forem.com/ghoshr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F473203%2F6682da63-b231-4b2e-bc44-f048c762db1a.jpg</url>
      <title>Forem: Ritobrata Ghosh</title>
      <link>https://forem.com/ghoshr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ghoshr"/>
    <language>en</language>
    <item>
      <title>Creating Any Boolean Function with Elementary Logic Gates</title>
      <dc:creator>Ritobrata Ghosh</dc:creator>
      <pubDate>Mon, 14 Jun 2021 08:11:14 +0000</pubDate>
      <link>https://forem.com/ghoshr/creating-any-boolean-function-with-elementary-logic-gates-4jj6</link>
      <guid>https://forem.com/ghoshr/creating-any-boolean-function-with-elementary-logic-gates-4jj6</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Digital electronics is probably the most impactful and widespread technology now. It forms the basis of all of the chips- from ARM microcontrollers to processors in cellphones, all the way to uberpowerful AMD Threadrippers. In all these cases, digital electronics reign supreme.&lt;/p&gt;

&lt;p&gt;It is very useful to learn not only about basic principles but also how these principles and the components of Digital Electronics exactly form the basis of the modern world, i.e., how do we go from basic logic gates to fully functional computers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Elements of Computing Systems
&lt;/h3&gt;

&lt;p&gt;Digital Electronics is not only important because it is the base of the modern technology that literally governs our lives, but it makes us better as programmers, and computer scientists.&lt;/p&gt;

&lt;p&gt;Whether we are self-taught programmers or a person with a 4-year CS degree, we were never taught how we go from basic logic gates to CPUs.&lt;/p&gt;

&lt;p&gt;A book that I have come across- &lt;a href="https://mitpress.mit.edu/books/elements-computing-systems-second-edition" rel="noopener noreferrer"&gt;&lt;em&gt;The Elements of Computing Systems&lt;/em&gt;&lt;/a&gt; by By Noam Nisan and Shimon Schocken does just that. It teaches you how the basic building blocks of modern computers actually create the computers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmitpress.mit.edu%2Fsites%2Fdefault%2Ffiles%2Fstyles%2Flarge_book_cover%2Fhttp%2Fmitp-content-server.mit.edu%253A18180%2Fbooks%2Fcovers%2Fcover%2F%253Fcollid%253Dbooks_covers_0%2526isbn%253D9780262539807%2526type%253D.jpg%3Fitok%3DKlT7RdFp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmitpress.mit.edu%2Fsites%2Fdefault%2Ffiles%2Fstyles%2Flarge_book_cover%2Fhttp%2Fmitp-content-server.mit.edu%253A18180%2Fbooks%2Fcovers%2Fcover%2F%253Fcollid%253Dbooks_covers_0%2526isbn%253D9780262539807%2526type%253D.jpg%3Fitok%3DKlT7RdFp" alt="nand2tetris-book-cover-2ed"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;[Although it shows the new 2nd edition, I am reading the first one]&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It promises to teach you, actively, how we can start from nothing but a NAND gate and go all the way to a full-fledged computer with an operating system, and a general-purpose programming language that runs on it, which can be used to create anything. The book is also known as &lt;strong&gt;&lt;em&gt;nand2tetris&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I have started reading this book and working through it every Sunday, and I have almost finished a chapter.&lt;/p&gt;
&lt;h3&gt;
  
  
  Building Gates from Elementary Gates
&lt;/h3&gt;

&lt;p&gt;People who have taken a Digital Architecture class or a Digital Electronics class will know that NAND (NOT AND) gates are called "universal gates" because some combination of them are able to create any other gates. So, when you have a NAND gate with you, you can create a general-purpose computer with it. And the book makes you do that. It makes you create many logic gates starting from AND, NOT, and OR  with nothing but a pre-implemented NAND gate.&lt;/p&gt;

&lt;p&gt;So, a NAND gate is already implemented and supplied. You first have to create AND, OR, and NOT gates. Then you go on to further create XOR gates, Multiplexors (MUX), Demultiplexors (D-MUX), and multi-bit versions of these gates and basic gates with what you have built previously, viz. AND, OR, NOT, and NAND gates.&lt;/p&gt;

&lt;p&gt;This is a fascinating task in itself, and very intellectually stimulating.&lt;/p&gt;

&lt;p&gt;This is where the core of the post comes in.&lt;/p&gt;

&lt;p&gt;I will show you how to implement any Boolean function with nothing but three logic gates. This is a trick worth knowing.&lt;/p&gt;

&lt;p&gt;Let's start.&lt;/p&gt;


&lt;h3&gt;
  
  
  Implementing a Boolean Function
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Design a Boolean Function
&lt;/h4&gt;

&lt;p&gt;Let's say we need a Boolean function that behaves in such a way-&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;A&lt;/th&gt;
&lt;th&gt;B&lt;/th&gt;
&lt;th&gt;C&lt;/th&gt;
&lt;th&gt;Y&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This &lt;em&gt;truth table&lt;/em&gt; tells you that we need such a Boolean function that outputs 1 iff-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;A&lt;/em&gt;, &lt;em&gt;B&lt;/em&gt;, and &lt;em&gt;C&lt;/em&gt;, three Boolean variables, are all 0&lt;/li&gt;
&lt;li&gt;only &lt;em&gt;A&lt;/em&gt; is 1, &lt;em&gt;B&lt;/em&gt; and &lt;em&gt;C&lt;/em&gt; are 0&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;A&lt;/em&gt; and &lt;em&gt;C&lt;/em&gt; are 1, &lt;em&gt;B&lt;/em&gt; is 0&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;A&lt;/em&gt; and &lt;em&gt;B&lt;/em&gt; are 1, &lt;em&gt;C&lt;/em&gt; is 0&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, in some situations, you might need to define a Boolean function that behaves as you expect. Do not worry about what this function is doing. Let's focus on the implementation part.&lt;/p&gt;
&lt;h4&gt;
  
  
  Boolean Expression
&lt;/h4&gt;

&lt;p&gt;I am assuming that you already know about the basic gates, and how they function.&lt;/p&gt;

&lt;p&gt;So, in the first step to build a Boolean function, you must create the Boolean expression. Just like a Boolean variable can have two values (0, 1), and a Boolean function can only output two values (0, 1, duh!), a Boolean expression always evaluates to either 0 or 1.&lt;/p&gt;

&lt;p&gt;How to actually do it?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You should just note in which cases the function outputs a 1. Focus just on those.&lt;/li&gt;
&lt;li&gt;Note which variables are on (1) and which are off (0).&lt;/li&gt;
&lt;li&gt;Keep the variables unchanged which are 1 in this case, and take a negation of those which are off (in electronics, you would put them through NOT).&lt;/li&gt;
&lt;li&gt;Multiply them together.&lt;/li&gt;
&lt;li&gt;For these products for each 1 in the output, just add them together.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it. You have got your Boolean expression.&lt;/p&gt;

&lt;p&gt;Let me go through it step by step.&lt;/p&gt;

&lt;p&gt;In the first occurrence of 1 in the output, we see that all the input variables are off. So, we get a*, b*, and c*, where a, b, and c are the variables representing inputs &lt;em&gt;A&lt;/em&gt;, &lt;em&gt;B&lt;/em&gt;, and &lt;em&gt;C&lt;/em&gt;, respectively, and x* is the negation of x. We multiply them together, and we get a*b*c*.&lt;/p&gt;

&lt;p&gt;In the second occurrence of 1, in a similar manner, we get- ab*c*.&lt;/p&gt;

&lt;p&gt;For the third and fourth occurrences of 1, we get ab*c, and abc*, respectively.&lt;/p&gt;

&lt;p&gt;We have to add them. And doing so, we get-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsif7ny028w0l4dv7gse1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsif7ny028w0l4dv7gse1.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[You are required to write cases in the proper order. The first of three variable has these values row-wise- 0-0-0-0-1-1-1-1, the second one varies- 0-0-1-1-0-0-1-1, and the third one- 0-1-0-1-0-1-0-1.]&lt;/p&gt;
&lt;h4&gt;
  
  
  Implementation
&lt;/h4&gt;

&lt;p&gt;You might be already aware that negation is passing through a NOT gate, multiplying is just passing through an AND gate, and adding is just an OR gate.&lt;/p&gt;

&lt;p&gt;The first &lt;em&gt;component&lt;/em&gt; a*b*c* can be obtained in this way-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623507789933%2FQBItJ0Vmd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623507789933%2FQBItJ0Vmd.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here are the second, third, and fourth components-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623507861780%2FSGdZszA-c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623507861780%2FSGdZszA-c.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623508014150%2F-0UIiS7o5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623508014150%2F-0UIiS7o5.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623508144340%2F0hlCdyidE.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623508144340%2F0hlCdyidE.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we have to add them all together, i.e. put these components through an OR gate. The output of the OR gate will be our final output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623566604394%2FCm-9WW_ftX.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623566604394%2FCm-9WW_ftX.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our final output.&lt;/p&gt;
&lt;h4&gt;
  
  
  HDL: Implement and Test
&lt;/h4&gt;

&lt;p&gt;Now, if you have ICs lying around, you can quickly test this with a power supply or a 5V cell, and some wires. You will also need a multimeter or LED bulbs to check your output.&lt;/p&gt;

&lt;p&gt;But, remember, we are building a computer from scratch when following this book. Using thousands of ICs to build a computer is not slightly practical unless you happen to have a contract with TSMC!&lt;/p&gt;

&lt;p&gt;Something called HDL (Hardware Description Language) is used. It is an intuitive, high-level, special-purpose programming language that you use to design and test chips, and use previously created chips.&lt;/p&gt;

&lt;p&gt;It is implemented in Java, but you do not have to worry about its implementation, you just need to use it. A GUI program is also supplied to do load and test chips.&lt;/p&gt;

&lt;p&gt;For example, given a NAND gate, you will design an AND gate this way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623567491868%2F2i-eaHy4V.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623567491868%2F2i-eaHy4V.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, it is very intuitive, and you can pick it up in 20 minutes.&lt;/p&gt;

&lt;p&gt;And, this is how you'd test this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623567613326%2FEIaikZlbD.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623567613326%2FEIaikZlbD.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To write our custom function in HDL, we would do-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Custom.hdl
// this is a part of Hashnode blog Convoluted demo

CHIP Custom {
    IN a, b, c;
    OUT out;

    PARTS:
    Not(in=a, out=nota);
    Not(in=b, out=notb);
    Not(in=c, out=notc);
    And(a=nota, b=notb, out=notanotb);
    And(a=notanotb, b=notc, out=w1);
    And(a=a, b=notb, out=anotb);
    And(a=anotb, b=notc, out=w2);
    And(a=anotb, b=c, out=w3);
    And(a=a, b=b, out=ab);
    And(a=ab, b=notc, out=w4);
    Or8Way(in[0]=w1, in[1]=w2, in[2]=w3, in[3]=w4, out=out);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And as this is a custom chip, the &lt;code&gt;.tst&lt;/code&gt; test file, and &lt;code&gt;.cmp&lt;/code&gt; compare file are not supplied. So, for testing this chip, I wrote my own.&lt;/p&gt;

&lt;p&gt;Here is the test (&lt;code&gt;.tst&lt;/code&gt;) file-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Custom.tst
// test file for testing custom chip
// could be found at- https://gist.github.com/ghosh-r/c4e6f5ceb1e7ea2e3ba3601c9de121be

// test file for a custom chip in Convoluted, a Hashnode blog

load Custom.hdl,
output-file Custom.out,
compare-to Custom.cmp,
output-list a%B3.1.3 b%B3.1.3 c%B3.1.3 out%B3.1.3;

set a 0,
set b 0,
set c 0,
eval,
output;

set a 0,
set b 0,
set c 1,
eval,
output;

set a 0,
set b 1,
set c 0,
eval,
output;

set a 0,
set b 1,
set c 1,
eval,
output; 

set a 1,
set b 0,
set c 0,
eval,
output;

set a 1,
set b 0,
set c 1,
eval,
output;

set a 1,
set b 1,
set c 0,
eval,
output;

set a 1,
set b 1,
set c 1,
eval,
output;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here is the compare (&lt;code&gt;.cmp&lt;/code&gt;) file. It contains the truth table that we expect.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Custom.cmp
// compare file for chip Custom.hdl
// found at- https://gist.github.com/ghosh-r/c4e6f5ceb1e7ea2e3ba3601c9de121be
// test file at- https://gist.github.com/ghosh-r/cef52b9f6ac017e00d64460b025a53fe

|   a   |   b   |   c   |  out  |
|   0   |   0   |   0   |   1   |
|   0   |   0   |   1   |   0   |
|   0   |   1   |   0   |   0   |
|   0   |   1   |   1   |   0   |
|   1   |   0   |   0   |   1   |
|   1   |   0   |   1   |   1   |
|   1   |   1   |   0   |   1   |
|   1   |   1   |   1   |   0   |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that the text in Compare files is not robust to whitespaces.&lt;/p&gt;

&lt;p&gt;It will be compared with the output file generated by the simulator.&lt;/p&gt;

&lt;p&gt;Here's how the successful run looks like-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623576505734%2Fbj93xn62K.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1623576505734%2Fbj93xn62K.gif" alt="final_60c5cd572911290063ac8055_216317.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Another Example: XOR Gate
&lt;/h4&gt;

&lt;p&gt;Suppose you want to implement a XOR gate from basic gates. And the truth-table would be-&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;A&lt;/th&gt;
&lt;th&gt;B&lt;/th&gt;
&lt;th&gt;Y&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This will be your Boolean expression-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm2latrxqmh5agpl8hn4s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm2latrxqmh5agpl8hn4s.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this will be your HDL implementation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Xor.hdl

CHIP Xor {
    IN a, b;
    OUT out;

    PARTS:
    Not(in=a, out=nota);
    Not(in=b, out=notb);
    And(a=a, b=notb, out=w1);
    And(a=nota, b=b, out=w2);
    Or(a=w1, b=w2, out=out);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I showed you how to implement any Boolean function with nothing but three elementary logic gates. However, you should keep in mind that this approach is impractical when there are more variables, and the chip you want is more complicated.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://ghosh-r.github.io" rel="noopener noreferrer"&gt;Ritobrata Ghosh&lt;/a&gt; is a Physics undergrad, and a Deep Learning Consultant focused on Computer Vision. I am interested in ML in embedded devices, Private AI (federated learning), Deep RL, and GANs. I am also interested in Maths, problem-solving, and programming in general.&lt;/p&gt;

&lt;p&gt;Follow me to get more similar posts.&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://twitter.com/AllesistKode" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or connect with me on &lt;a href="https://www.linkedin.com/in/ritobrata-ghosh/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>electronics</category>
      <category>nand2tetris</category>
      <category>programming</category>
    </item>
    <item>
      <title>The Best 5 + 1 Podcasts for ML Learners and Practitioners</title>
      <dc:creator>Ritobrata Ghosh</dc:creator>
      <pubDate>Thu, 18 Feb 2021 06:39:51 +0000</pubDate>
      <link>https://forem.com/ghoshr/the-best-5-1-podcasts-for-ml-learners-and-practitioners-4dah</link>
      <guid>https://forem.com/ghoshr/the-best-5-1-podcasts-for-ml-learners-and-practitioners-4dah</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Podcasts are a great way to learn about novel fields and tools, as well as keeping yourself updated with the fields that you care about.&lt;/p&gt;

&lt;p&gt;I also believe that podcasts which are mainly centered around interviews are a great way to learn about the rockstars and superheroes of the AI world. You get a glimpse of how they think, what are they working on, and they solved a particular problem.&lt;/p&gt;

&lt;p&gt;I would also argue that the content you get access to by listening to podcasts is very unique, and you cannot access them somewhere else.&lt;/p&gt;

&lt;p&gt;In this post, I am not going into the details of why I think podcasts are great and Machine Learning learners and practitioners should listen to them.&lt;/p&gt;




&lt;h1&gt;
  
  
  The List
&lt;/h1&gt;

&lt;p&gt;Here are the podcasts that I highly recommend for ML learners and professionals-&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;a href="https://wandb.ai/site/podcast"&gt;Gradient Dissent&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;from Weights and Biases, hosted by &lt;a href="https://twitter.com/l2k?"&gt;Lukas Biewald&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It is a Machine Learning podcast that focuses on "Stories from machine learning experts solving real world problems".&lt;/p&gt;

&lt;p&gt;Lukas hosts his podcasts in his own style. He asks really meaningful questions and is well-informed on the topics. The podcast episodes are very informative and engaging.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Length per episode: usually 30-60 minutes&lt;/li&gt;
&lt;li&gt;Favorite episode so far: &lt;a href="https://www.youtube.com/watch?v=hVW1mwLtDcI"&gt;Peter Norvig, Google’s Director of Research – Singularity is in the eye of the beholder&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;a href="https://deepmind.com/blog/article/welcome-to-the-deepmind-podcast"&gt;DeepMind: The Podcast&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;from DeepMind, hosted by &lt;a href="https://en.wikipedia.org/wiki/Hannah_Fry"&gt;Hannah Fry&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hannah Fry is a superb host, as good as any professional podcast host. That sets this podcast apart from the others. Hanna Fry is a Mathematician and has had experience in hosting podcasts. She is passionate and knowledgeable about AI, and passionate about this podcast. This podcast likely has a team working behind it, and the sound effects and the music tells us so. They also make the experience absolutely entertaining.&lt;/p&gt;

&lt;p&gt;This podcast focuses on works being done on DeepMind and hosts people working on those problems within DeepMind. The problems and solutions are described in plain words. The host also gives you a big picture view surrounding the problem, and what the future holds. This podcast is really well-structured, well-designed, and is really informative and edifying.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Length per episode: 30 minutes&lt;/li&gt;
&lt;li&gt;Favorite episode so far: &lt;a href="https://www.youtube.com/watch?v=OkAwsrHMTgM"&gt;Episode 2: Go to Zero&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. &lt;a href="https://lexfridman.com/podcast/"&gt;Lex Fridman Podcast&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;hosted by &lt;a href="https://lexfridman.com/"&gt;Lex Fridman&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Lex Fridman is an AI researcher working on autonomous vehicles, and human-robot interaction. He also teaches at MIT. The way he is unique as a podcast host is that he is very focused on long-term goals, and far-reaching implications of the works of the guests. He is interested in deep things such as consciousness and the idea of AGI. He asks deep, fundamental questions and lets us know about the guests' views on these questions.&lt;/p&gt;

&lt;p&gt;The topics on his podcast transcend the AI universe. He has had guests like Roger Penrose, Richard Dawkins, and Noam Chomsky. A significant portion of his interviews &lt;em&gt;are&lt;/em&gt; on AI. His interviews are generally long, and hence have much more scope to discuss topics in an in-depth, detailed manner. I really like that.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Length per episode: 60-180 minutes&lt;/li&gt;
&lt;li&gt;Favorite episode so far: &lt;a href="https://www.youtube.com/watch?v=uPUEq8d73JI"&gt;David Silver: AlphaGo, AlphaZero, and Deep Reinforcement Learning | Lex Fridman Podcast #86&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. &lt;a href="https://sanyambhutani.com/tag/chaitimedatascience/"&gt;Chai Time Data Science&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;hosted by &lt;a href="https://sanyambhutani.com/"&gt;Sanyam Bhutani&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Sanyam Bhutani is a community man. Period. As a Data Scientist at h2o.ai, he writes blogs, hosts interviews, and hosts book-reading clubs and other clubs with Machine Learning Tokyo. He is also very active on the &lt;a href="https://fast.ai"&gt;fast.ai&lt;/a&gt; Communities. And he never monetizes his content! When he is interviewing guests on his podcast, he is not asking questions for the interview, but for learning, too! I like his inquisitive, humble manner of asking questions.&lt;/p&gt;

&lt;p&gt;This podcast hosts a lot of Kaggle Competition winners and Grandmasters. He talks about the guests' journey, career, and current research, projects, and interests. And, then there is Kaggle! He often interviews winners of particular competitions and asks about their thinking and approach to those particular competitions. These are really informative for people competing on Kaggle, and/or interested in developing full pipelines for any project. It is very interesting to see the diverse set of people from diverse backgrounds win Kaggle competitions, and talk about their careers and lives on this podcast.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Length per episode: 30-90 minutes&lt;/li&gt;
&lt;li&gt;Favorite episode so far: &lt;a href="https://www.youtube.com/watch?v=QGCvycOXs2M"&gt;Chris Deotte | Secrets to Becoming 4x Kaggle Grandmaster | Discussions and Notebooks&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. &lt;a href="https://www.youtube.com/channel/UCMLtBahI5DMrt0NPvDSoIRQ"&gt;Machine Learning Street Talks&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;hosted by &lt;a href="https://twitter.com/ykilcher"&gt;Yannic Kilcher&lt;/a&gt;, &lt;a href="https://twitter.com/ecsquendor"&gt;Dr. Tim Scarfe&lt;/a&gt;, and &lt;a href="https://mit.academia.edu/KeithDuggar"&gt;Keith Dugger&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is the only entry in the list which has multiple hosts. Yannic is famous for his paper-explaining videos, and his sunglasses. Dr. Scarfe and Keith also maintain an online presence and are involved in Deep Learning.&lt;/p&gt;

&lt;p&gt;This podcast deliberately maintains a hacker, open-source sort of aura about them. That is evident from their choice of backgrounds, style of presentation, and many more things. They delve deep into research topics and interview the person(s) attached to them. The fact that there is more than one host adds value to the conversations, rather than being a liability. The listeners get to hear from multiple perspectives and get acquainted with multiple views. The guests are also much more likely to shed light on different aspects of the research.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Length per episode: 90-120 minutes&lt;/li&gt;
&lt;li&gt;Favorite episode so far: &lt;a href="https://www.youtube.com/watch?v=2PenK06tvE4"&gt;#040​ - Adversarial Examples&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The +1. &lt;a href="https://www.youtube.com/user/AtGoogleTalks"&gt;Talks at Google&lt;/a&gt;, &lt;a href="https://www.youtube.com/user/MicrosoftResearch"&gt;Microsoft Research&lt;/a&gt;, and &lt;a href="https://www.ted.com/"&gt;TED/TEDx&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Of course, you have noticed that "+1" in the title. I am including these resources together as one, because, all of the content present at the first two resources are not focused on ML or AI. And although TED has a few talks based on this topic and broader topics, it has some really good talks on ML, Data Science, and AI.&lt;/p&gt;

&lt;p&gt;If you visit the Microsoft Research YouTube page, you will see many playlists that will kindle your excitement. For example, the &lt;a href="https://www.youtube.com/playlist?list=PLD7HFcN7LXRdF6EcEFmrXGo4pngaR4Z_p"&gt;AI Distinguished Lecture Series&lt;/a&gt; contains many thought-provoking talks in AI. The same goes with Talks at Google.&lt;/p&gt;

&lt;p&gt;TED has quite a few talks on Data Science, AI, and its impact. And TED has been covering Data Analysis, AI, etc. years before these fields blew up. I remember listening to a talk- &lt;a href="https://www.youtube.com/watch?v=6xsvGYIxJok"&gt;Making data mean more through storytelling | Ben Wellington&lt;/a&gt; which was given back in 2015 that highlights how creative, yet simple Data Analysis can reveal many important insights, and how it can make lives better by influencing government policies. There's another talk that I will mention- &lt;a href="https://www.youtube.com/watch?v=U6FvJ6jMGHU"&gt;Daphne Koller: What we're learning from online education&lt;/a&gt;. The co-founder of Coursera gives us many deep insights about online education and how data are at the core and crux of it. This is yet another example of data transforming something fundamental like education, and impacting the lives of millions positively.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Length per episode: mixed&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Podcasts about and around Machine Learning have seen a boom in recent times. It is important not to get overwhelmed in this overflow. I have listened to many podcasts about ML/Data Science and decided on these as the bests.&lt;/p&gt;

&lt;p&gt;If you have any suggestions or questions, please let me know in the comments.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>podcast</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
