ICT114 Computer Architecture PDF
Document Details
Uploaded by WiseCreativity
Singapore University of Social Sciences
2025
Tags
Summary
These lecture notes from SUSS cover computer architecture, focusing on number systems including binary, decimal, and hexadecimal conversions and various representation types. The document also details the course structure, schedule, proposed virtual labs, and some additional resources.
Full Transcript
Academic use CONFIDENTIAL ICT114 Computer Architecture Make Yourself Comfortable Zoom Poll – Student Profiling Academic use Course Structure Seminar 1 – Number Systems and Computer Logic S...
Academic use CONFIDENTIAL ICT114 Computer Architecture Make Yourself Comfortable Zoom Poll – Student Profiling Academic use Course Structure Seminar 1 – Number Systems and Computer Logic Seminar 2 – Systems Architecture and Processor Technology (Seminar 3 – Assembly Language Seminar 4 – Data Representation and Storage Technology Seminar 5 – Systems Integration Seminar 6 – Input/Output Systems Last Revised Jan 2022 Academic use Schedule Every Bi-Weekly Wed Evenings 7-10pm 15 JAN 2025 to 26 MAR 2025 Lesson Dates * Date/Time LESSON 1 15 JAN 2025 (WED) LESSON 2 (due to CNY)(4-7 PM) 25 JAN 2025 (SAT) LESSON 3 12 FEB 2025 (WED) LESSON 4 26 FEB 2025 (WED) LESSON 5 12 MAR 2025 (WED) LESSON 6 26 MAR 2025 (WED) Zoom Meeting Details/URL/Password (Recorded) will be in Announcements Academic use Tutorials Every Bi-Weekly Wed Evenings 8-10pm Zoom Meeting Sessions Will Be Recorded Proposed Virtual Lab Dates * Date/Time Tutorial 1 22 JAN 2025 (WED) Tutorial 2 05 FEB 2025 (WED) Tutorial 3 19 FEB 2025 (WED) Tutorial 4 05 MAR 2025 (WED) Tutorial 5 19 MAR 2025 (WED) Tutorial 6 02 APR 2025 (WED) * Meeting Details/URL/Password will be in Announcements **Familiarize with Easy68K Simulator before Seminar 3 and Tut 3 *** Easy68K is on Vocareum Virtual Lab accessible via Canvas Academic use Announcements Announcements Academic use Zoom Meetings and Cloud Recordings Zoom Meetings and Cloud Recordings Academic use Weighted Quizzes and TMA TMA and Pre-Seminar Quizzes Academic use Seminar Notes, Tutorials and Supplementary Resources Seminar Notes, Tutorials and Supplementary Resources Academic use Seminar Notes, Tutorials and Supplementary Resources Virtual Labs under T-Group Academic use Study Guides and Textbooks Study Guides and Textbooks Academic use Exam Online? Name: Pang Tee How Email Address: [email protected] ❑ More than 25 years Domain Knowledge and Work Experience in IT Infrastructure Systems and Network Design, as well as Security Assessment and Audit ❑ PMP, CCNA Instructor/CCNP, CISSP, ISO27001 ISMS Auditor ❑ Past Exp: Banking/Finance (10YRS), GLC (10YRS), Adjunct Lecturer + Security Auditor (10YRS) Academic use CONFIDENTIAL ICT114 Computer Architecture Seminar 1: Number Systems and Computer Logic Pen Down Three Words What U Know about Computer Architecture Academic use Number Systems and Computer Logic Objectives: Convert a number from one number system to another Represent integer in binary using unsigned magnitude, sign-magnitude and two’s complement Represent real numbers in binary Perform simple arithmetic operations using various binary representations Perform logic operation using binary numbers Number Systems and Computer Logic 1-23 Academic use Computer Data Introduction to Numbering Systems ▪ For humans, we have been using the Decimal Numbering Systems (0-9) ▪ Why? … Any guess? ▪ The Origin of Zero (Concept of Nothing) – many theories but likely 3-5 BC Computer Data Data in a computer is represented using binary codes called Binary Digits (bits) – 0 and 1 Basic data types are: – Integer – Real Number – Character Number Systems and Computer Logic 1-24 Academic use Different Numbering Systems NUMBERING SYSTEMS BASE EXAMPLES BINARY 2 1011 0010 DECIMAL 10 192.168.1.10 (IP Address) HEXADECIMAL 16 001A:3F23:4CE6 (MAC Address) Number Systems and Computer Logic 1-25 Academic use Binary to Decimal Add up the bit value in each bit position Convert 10 01102 to decimal 10 01102 = 1*25 + 0*24 + 0*23 + 1*22 + 1*21 + 0*20 = 32 + 4 + 2 = 3810 Number Systems and Computer Logic 1-26 Academic use Number Systems Know how to convert Decimal Binary Hexadecimal Number Systems and Computer Logic 1-27 Academic use Binary to Decimal Add up the bit value in each bit position Convert 10 01102 to decimal 10 01102 = 1*25 + 0*24 + 0*23 + 1*22 + 1*21 + 0*20 = 32 + 4 + 2 = 3810 6-bit Binary Systems 25 24 23 22 21 20 1 0 0 1 1 0 Number Systems and Computer Logic 1-28 Academic use Convert Between Binary and Decimal Question 1: Convert 1011 01002 to decimal Ans 1: 18010 Question 2: Convert 10910 to binary 25 = 32 – 1= 31 (remember 0 is also a number) => 5 bits not enough to represent 109. How many bits will be required in this case? 27 = 128 – 1= 127, so we will need 7 bits 109-64 =45 7-bit Binary Systems 45-32=13 26 25 24 23 22 21 20 13-16? 13-8=5 1 1 0 1 1 0 1 5-4=1 1-2? 1-1 Number Systems and Computer Logic 1-29 Academic use Decimal-Binary-Hexadecimal Decimal Binary Hexadecimal 0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F Number Systems and Computer Logic 1-30 Academic use Decimal to Hexadecimal Divide by 16 and obtain the remainders E.g. 71310 = 2C916 16 ) 713 16 ) 44 r 9 LSB 16 ) 2 r 12 0 r2 MSB Another way is to convert 71310 into binary 71310 = 10 1100 10012 0 0 1 0 1 1 0 0 1 0 0 1 base 2 2 C 9 base 16 Number Systems and Computer Logic 1-31 Academic use Hexadecimal to Decimal Add up the bit value in each bit position Convert 2A916 to decimal 2A916 = 2*162 + 10*161 + 9*160 = 2*256 + 160 + 9*1 = 68110 Number Systems and Computer Logic 1-32 Academic use Binary to Hexadecimal 4 binary bits = 1 hexadecimal digit Convert 10 1100 10012 to hexadecimal 0010 1100 10012 = 2C916 Number Systems and Computer Logic 1-33 Academic use Hexadecimal to Binary 1 hexadecimal digit = 4 binary bits Convert BEEF16 to binary BEEF16 = 1011 1110 1110 11112 Number Systems and Computer Logic 1-34 Academic use Convert Binary Decimal and Hexadecimal Question 1: Convert 4FA16 to decimal Ans 1: 1,27410 Question 2: Convert 21510 to hexadecimal Ans 2: D716 Question 3: Convert 1001110012 to hexadecimal Ans 3: 13916 Number Systems and Computer Logic 1-35 Academic use Number Systems (1) 1. Unsigned Magnitude Positive numbers stored in binary E.g. 4110 = 0010 10012 No minus sign 2. Signed Magnitude Left most bit is sign bit 0 means positive 1 means negative E.g. +5 = 0000 0101 +1810 = 0001 00102 -3 = 1000 0011 -1810 = 1001 00102 Problems Need to consider both sign and magnitude in arithmetic Two representations of zero (+0 and -0) Separate Registers/Storage Considerations (Hence it is NOT used in computers) Number Systems and Computer Logic 1-37 Academic use Number Systems (2) 3. Two’s Complement Left most bit is sign bit 0 means positive 1 means negative For positive number (sign bit = 0) representation is the same as sign-magnitude For negative number, it is dealt with differently Examples: +210 = 0000 00102 +110 = 0000 00012 +0 = 0000 00002 -110 = 1111 11112 -210 = 1111 11102 Number Systems and Computer Logic 1-38 Academic use Benefits of 2’s Complement Numbers One representation for zero Fairly easy to represent a negative number E.g. represent -310 in 2’s complement: 3 = 0000 00112 Boolean complement gives → 1111 11002 Add 1 to LSB → 1111 11012 Hence -310 is represented as 1111 11012 Number Systems and Computer Logic 1-39 Academic use Two’s Complement Numbers - Examples 1. Express 10810 in 2’s complement Since it is a positive number the 2’s complement representation is the same as the sign-magnitude 10810 = 0110 11002 2. Express -10810 in 2’s complement Step1: convert 10810 to binary, 10810 = 0110 11002 Step2: invert the bits: 1001 00112 Step3: add 1 to the inverted bits: 1001 01002 Thus the 2’s complement representation of -10810 is 1001 01002 Number Systems and Computer Logic 1-40 Academic use Range of 2’s Complement Numbers (Must know) 8 bit 2’s complement +12710 = 0111 11112 = 27 -1 -12810 = 1000 00002 = -27 16 bit 2’s complement +3276710 = 0111 1111 1111 11112 = 215 - 1 -3276810 = 1000 0000 0000 00002 = -215 N bit range: - 2N-1 to + 2N-1 - 1 8-bit 2s Complement Binary Systems Sign Bit With the sign bit, instead of representing 0 – 255, now are represents -128 to 0 as well as 1 up to 127. Remember 0 is a number too. Number Systems and Computer Logic 1-41 Academic use Using an 8-bit 2’s Complement, we can work with -128 to +127 Number Systems and Computer Logic 1-42 Academic use Conversion Between Lengths Two’s Complement Numbers Positive number pack with leading zeros +1810 = 0001 00102 (8-bit Representation) +1810 = 0000 0000 0001 00102 (16-bit Representation) Negative number pack with leading ones -1810 = 1110 11102 (8-bit Representation) -1810 = 1111 1111 1110 11102 (16-bit Representation) i.e. pack with MSB (sign bit) Number Systems and Computer Logic 1-43 Academic use Arithmetic & Logic Operations The Operations that can be done by a computer can be classified as: Arithmetic Operations: Addition, Subtraction, Multiplication, Division Logic Operations: AND, OR, NOT (Complement) and XOR Number Systems and Computer Logic 1-44 Academic use Addition and Subtraction Normal binary addition Monitor sign bit for overflow Obtain 2’s complement of subtrahend and add to minuend i.e. a - b = a + (-b) [a: minuend, b: subtrahend] So we only need addition and complement circuits Hardware for Addition and Subtraction 2’s Complement allows Positive and Negative Integers to be treated together during addition and subtraction using “Addition Logic” Source: Figure 10.6 of Computer Organization and Architecture Tenth Edition Number Systems and Computer Logic 1-45 Academic use Number Systems and Computer Logic 1-46 Academic use Real Numbers A Real Number can contain both whole and fractional components Number Systems and Computer Logic 1-47 Academic use Real Numbers with Fixed Point Numbers Numbers with fractions Fixed Point Numbers or Floating Point Numbers Fixed Point Numbers: Could be done in pure binary E.g. 1001.10102 = 23 + 20 +2-1 + 2-3 =9.62510 The issue with fixed number of bits, there are always numbers that cannot be represented accurately. 8-bit Fixed Point Number 23 22 21 20 2-1 2-2 2-3 2-4 base 2 8 4 2 1 0.5 0.25 0.125 0.0625 base 16 Number Systems and Computer Logic 1-48 Academic use Real Numbers with FPF Floating Point Numbers: Able to represent numbers that increase the precision and the range of numbers for given number of bits Allocate different number of bits for Mantissa and Exponent Decimal Value Normalized as Mantissa Exponential 2,100 2.1 x 103 2.1 3 5,500,000 5.5 x 106 5.5 6 Binary Value Normalized as Mantissa Exponential 1101.101 1.101101 3.00101 1.01 -3 Number Systems and Computer Logic 1-49 Academic use Floating Point Numbers (Unsigned) Bit 15 8 7 0 8 bits 8 bits Exponent (E) is an unsigned integer Mantissa (M) is an unsigned fixed point fraction Decimal value = (0.M) * 2E A computer system uses the above 16-bit floating point number representation. What is the decimal value of 0000 0011 1101 0000? 0.M = 0.1101 00002 = 0.5 + 0.25 + 0.0625 = 0.8125 E = 0000 00112 = 3 Decimal value = 0.8125 * 23 = 6.5 Number Systems and Computer Logic 1-50 Academic use Floating Point Numbers (Signed) Unsigned integer Unsigned fraction 1 bit (E) (F) Decimal value = (1.F) * 2 E-127 Source: Figure 10.18 of Computer Organization and Architecture Tenth Edition A computer system uses the above 32-bit floating point number representation. What is the decimal value of 0 1001 0011 1010 0000 0000 0000 0000 000? Normalised number: MSB of significand is non-zero E = 1001 00112 = 147 1.F = 1.10100002 = 1+2-1+2-3 = 1+0.5+0.125 = 1.625 Decimal value = + 1.625 x 2147-127 = + 1.625 x 220 Number Systems and Computer Logic 1-51 Academic use IEEE 754 Floating-point Formats Source: Figure 10.21 of Computer Organization and Architecture Tenth Edition Standard for floating point storage 32 and 64 bit standards 8 and 11 bit exponent respectively Extended formats (both mantissa and exponent) are used for intermediate calculations Ref: http://steve.hollasch.net/cgindex/coding/ieeefloat.html Number Systems and Computer Logic 1-52 Academic use Logic Operations AND Examples 0 AND 0 = 0 0101 00112 0 AND 1 = 0 0111 11002 1 AND 0 = 0 ------------------ 1 AND 1 = 1 0101 00112 AND 0111 11002 = 0101 00002 ------------------------------------- OR 0 OR 0 = 0 0101 00112 0 OR 1 = 1 0111 11002 1 OR 0 = 1 ------------------ 1 OR 1 = 1 0101 00112 OR 0111 11002 = 0111 11112 ------------------------------------- XOR 0 XOR 0 = 0 0101 00112 0 XOR 1 = 1 0111 11002 1 XOR 0 = 1 ------------------ 1 XOR 1 = 0 0101 00112 XOR 0111 11002 = 0010 11112 ------------------------------------- NOT NOT 0 = 1 0101 00112 NOT 1 = 0 NOT 0101 00112 = 1010 11002 Number Systems and Computer Logic 1-53 Academic use Summary Conversion of different number systems Representation of integer in binary using 1. Unsigned Magnitude 2. Sign-Magnitude 3. Two’s complement Representation of real numbers in binary Simple arithmetic operations using various binary representations Logic operations using binary numbers Number Systems and Computer Logic 1-54 Academic use Challenge Questions Question 1: Write -58.2510 in floating point (IEEE 754) and fill in the fields in diagram shown. 1 bit 8 bits 23 bits Decimal value = (1.F) * 2 E-127 Question 2: Represent the answer for Q1 in hexadecimal Number Systems and Computer Logic 1-55 Academic use Challenge Questions Number Systems and Computer Logic 1-56 Academic use THANK YOU Academic use CONFIDENTIAL Academic use CONFIDENTIAL