You are on page 1of 18

Elements of Computing Systems-1

Basic Logic gates and Implementation in Hack


Platform

Dr. Jyothish Lal G, Assistant Professor (Sr. Gr)


Department of AI / Center for Computational Engineering and Networking (CEN)
Amrita School of AI, Coimbatore
Acknowledgment: Prof. Noam Nisan, Prof. Shimon Schocken , Dr. D. Govind
Gate Logic
• A technique for implementing Boolean
function using logic gates
• What is a logic Gate ?
– Elementary chip
– Composite
– Designed to deliver a well-defined functionality
– It has one output and one or more inputs
EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 2
Basic Logic Gates
• NOT gate
• Also called inverter Truth Table

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 3


• AND gate
– For 2 inputs (say A, B), the output will be 1 if both
the inputs are 1, and 0 otherwise
– Denoted as A.B Truth Table

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 4


• OR Gate
– For 2 inputs (say A, B), the output will be 1 if at
least one of the inputs are 1, and 0 otherwise
– Denoted as A+B Truth Table

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 5


• NAND gate
– For 2 inputs (say A, B), the output will be 1 if at
least one of the inputs are 0, and 0 otherwise
– Denoted as (A.B)’ Truth Table

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 6


• NOR gate
– For 2 inputs (say A, B), the output will be 1 if both
the the inputs are 0, and 0 otherwise
– Denoted as (A+B)’ Truth Table

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 7


• Exclusive OR (XOR) gate
– For 2 inputs (say A, B), the output will be 1 if odd
number of inputs are at 1, and 0 otherwise
– Denoted as A  B Truth Table

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 8


• Exclusive NOR (XNOR) gate
– For 2 inputs (say A, B), the output will be 1 if both the inputs of the gate are
same, and 0 otherwise
– In general, an XNOR gate will give an output value of logic “1” ONLY when
there are an EVEN number of 1’s on the inputs to the gate (the inverse of
the Ex-OR gate) except when all its inputs are “LOW”
Truth Table
– Denoted as ( A  B )

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 9


How do we build a chip?

We use Hardware Simulators

https://www.nand2tetris.org/course

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 10


Steps
• Design the gate architecture
• Specify the architecture in HDL
• Test the chip in a hardware simulator
• Optimize the design

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 11


HDL: some comments

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 12


Interactive simulation
Simulation process:
• Load the HDL file into the hardware simulator
• Enter values (0’s and 1’s) into the chip’s input pins
(example: a and b)
• Evaluate the chip’s logic
• Inspect the resulting values of:
– Output pins
– Internal pins

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 13


v

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 14


In this course, the hardware units are
built using NAND gates

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 15


Realization of basic gates using NAND
NOT gate

AND gate

OR gate

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 16


Implement the basic Logic Gates in Hack Platform

1. AND using NAND


2. NOT using NAND
3. OR using NAND
4. NOR using NAND

(Use interactive simulation to test the chips)

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 17


Thank You

EOC-1|B.TECH CSE (AI)|CEN|Dr. Jyothish 18

You might also like