CSCI101 - Tutorial 2 Logic Gates & Numbering Systems (Nile University) - PDF
Document Details
Uploaded by Deleted User
Nile University
Tags
Summary
This document is a tutorial on digital logic gates and number systems, specifically exploring concepts like AND, OR, and NOT gates, alongside various numbering systems including decimal, binary, octal, and hexadecimal, with descriptions and examples. The document is part of a Computer Science course at Nile University.
Full Transcript
CSCI101 Logic Gates & Numbering Nile University TUTORIAL 2 - WEEK 2 CSCI101 Team CSCI101 Machine Language CSCI101 What Are Bits? CSCI101 How Does A C...
CSCI101 Logic Gates & Numbering Nile University TUTORIAL 2 - WEEK 2 CSCI101 Team CSCI101 Machine Language CSCI101 What Are Bits? CSCI101 How Does A Computer Work? Logic Gates are the fundamental building blocks of digital circuits. Logical functions Each gate has one or more input signals and produces an output signal based on a certain logic. CSCI101 Basic Logic Gates AND Gate OR Gate NOT Gate CSCI101 ‘AND’ Gate Input Output A B A AND B 0 0 0 0 1 0 AND Gate 1 0 0 1 1 1 Z=A.B CSCI101 ‘OR’ Gate Input Output A B A AND B 0 0 0 0 1 1 OR Gate 1 0 1 Z=A+B 1 1 1 CSCI101 ‘NOT’ Gate Input Output A NOT A 0 1 NOT Gate 1 a Z=A CSCI101 Derived Logic Gates NAND Gate NOR Gate XOR Gate XNOR Gate CSCI101 Numbering Systems There are multiple numbering systems that we use for different reasons. Some of the systems are: Decimal Binary Octal Hexadecimal CSCI101 Decimal Numbering The Decimal numbering system consists of the numbers we’ve seen our entire lives, from 0 to 9 Since this system consists of 10 number (0 to 9), it is known as BASE 10 CSCI101 Binary Numbering The Binary Numbering system consists of only 0s and 1s Different combinations of these 0s and 1s have different meanings and values! Since the binary system has 2 numbers only (0 and 1), it is known as BASE 2 CSCI101 Octal Numbering From its name, Octal = Eight, consists of 8 numbers from 0 to 7 Octal is known as BASE 8 number system CSCI101 Hexadecimal Numbering Hexadecimal is slightly different from the previous system, since it consists of both digits AND letters. Hexadecimal consists of 16 symbols: 10 digits (from 0 to 9) 6 letters (from A to F) Known as BASE 16 CSCI101 Conversions Between Numbering Systems Each numbering system has a different purpose. To be able to use all the systems for any reason, we must learn how to convert between them and move from one system to the other! CSCI101 Decimal to Binary Conversion Decimal Binary 8 1000 12 1100 145 1001 0001 CSCI101 Decimal to Binary Conversion There are TWO methods of converting the Decimal numbering system to the Binary numbering system Remainder Method Weights Method CSCI101 Decimal to Binary Conversion: Remainder Method The remainder method focuses on using division to find the binary value of the number CSCI101 Decimal to Binary Conversion: Weights Method Each position in the binary system has what we call a “weight” 7 6 5 4 3 2 1 0 2 2 2 2 2 2 2 2 128 64 32 16 8 4 2 1 CSCI101 Decimal to Binary Conversion: Weights Method Lets convert 75 to binary using the weights 128 64 32 16 8 4 2 1 Since 75 lies between 128 and 64, we will place a 1 at 64 as follows: 0 1 The remaining will be 75-64 = 11 CSCI101 Decimal to Binary Conversion: Weights Method Lets convert 75 to binary using the weights cont. 128 64 32 16 8 4 2 1 Since 11 is between 16 and 8, we will place a 1 at the smaller value, 8, and add 0s before it 0 1 0 0 1 The remaining will be 11-8 = 3 CSCI101 Decimal to Binary Conversion: Weights Method Lets convert 75 to binary using the weights cont. 128 64 32 16 8 4 2 1 The remaining 3 lies between 4 and 2, which means we will place the 1 at 2 0 1 0 0 1 0 1 The remaining will be 3-2 = 1 CSCI101 Decimal to Binary Conversion: Weights Method Lets convert 75 to binary using the weights cont. 128 64 32 16 8 4 2 1 Since the remaining value is 1, we will place 1 in that position 0 1 0 0 1 0 1 1 The remaining will be 1-1 = 0 CSCI101 Decimal to Binary Conversion: Weights Method Solution: 75 10 = 01001011 2 CSCI101 Binary Numbering 8 1000 12 1100 CSCI101 Binary to Hexadecimal Conversion Hexa 8 9 A B C D E F Binary 1000 1001 1010 1011 1100 1101 1110 1111 Hexadecimal numbers are base-16, using digits 0-9 and letters A-F. Each hexadecimal digit represents four binary digits (bits). Hexadecimal is often used in programming to simplify binary code representation. CSCI101 Binary to Hexadecimal Conversion 1011 1010 11 10 B A CSCI101 Octal Numbering Octal numbers are base-8, using digits 0-7. Each octal digit represents three binary digits (bits). Octal is commonly used in computing for compact binary representation. CSCI101 Binary to Octal Conversion = (1010111100)₂ = (001 010 111 100)₂ = (1 2 7 4) 8 = (1274) 8 CSCI101 Numbering Systems Conversion: Example 1 Convert (2A7)₁₆ into Binary CSCI101 Numbering Systems Conversion: Example 2 Convert (1011101)₂ into Decimal CSCI101 Tutorial Task TASK 1 Convert (FF)₁₆ into Octal on Paper CSCI101 Tutorial Task TASK 2 Convert (2F)₁₆ into its octal equivalent. CSCI101 Tutorial Task TASK 3 0 1 ? 1 Calculate the output of the gate. CSCI101 THANK YOU Any Questions? Nile University End Slide YOU CAN ALSO CHECK https://www.youtube.com/watch?v=Vq04T0Cwj5Y CSCI101 Resources: https://www.cuemath.com/numbers/decimal-to-binary/ https://www.log2base2.com/number-system/how-to-convert- Nile University hexadecimal-to-octal-with-example.html