Comp Org & Assembly Lang

Slides:



Advertisements
Similar presentations
1 Chapter 2 The Digital World. 2 Digital Data Representation.
Advertisements

COMP 2130 Intro Computer Systems Thompson Rivers University
Binary Representation Introduction to Computer Science and Programming I Chris Schmidt.
Comp 1001 Introduction to Information Technology & Computer Architecture Wednesday 12-1Dr. Joe Carthy
Binary Expression Numbers & Text CS 105 Binary Representation At the fundamental hardware level, a modern computer can only distinguish between two values,
Codes and number systems Introduction to Computer Yung-Yu Chuang with slides by Nisan & Schocken ( ) and Harris & Harris (DDCA)
CREATED BY, MS. JENNIFER DUKE BITS, BYTES, AND UNITS OF MEASUREMENT.
Communications Technology 2104 Mercedes Lahey. Bit 1. bit=From a shortening of the words “binary digit” 2. the basic unit of information for computers.
Aug CMSC 104, LECT-021 Machine Architecture and Number Systems Some material in this presentation is borrowed form Adrian Ilie From The UNIVERSITY.
1 Machine Architecture and Number Systems Topics Major Computer Components Bits, Bytes, and Words The Decimal Number System The Binary Number System Converting.
Copyright © 2003 by Prentice Hall Module 5 Central Processing Unit 1. Binary representation of data 2. The components of the CPU 3. CPU and Instruction.
Fill in the blanks: (1) _________ has only two possible values 0 and 1. (2) There are __________bits in a byte. (3) 1 kilobyte of memory space can store.
Why does it matter how data is stored on a computer? Example: Perform each of the following calculations in your head. a = 4/3 b = a – 1 c = 3*b e = 1.
Machine Architecture CMSC 104, Section 4 Richard Chang 1.
OBJECTIVES  Explain why a computer represents data in the form of binary  Explain the terms related to data storage: bit, byte, character, word  Calculate.
Introduction to Computer Systems and the Java Programming Language.
Bits and Bytes Spring, 2015 Topics Why bits? Representing information as bits Binary / Hexadecimal Byte representations »Numbers »Characters and strings.
Representing Information Digitally (Number systems) Nell Dale & John Lewis (adapted by Erin Chambers, Michael Goldwasser, Andrew Harrington)
1 3 Computing System Fundamentals 3.2 Computer Architecture.
CS41B MACHINE David Kauchak CS 52 – Fall Admin  Assignment 3  due Monday at 11:59pm  one small error in 5b (fast division) that’s been fixed.
Bits and Bytes IGCSE. A binary number is either a 0 or a 1 and is known as a 'bit' or b inary dig it. However, the CPU cannot deal with just one bit at.
Do it now activity Can you work out what the missing symbols are and work out the order they should be in if the table shows smallest to largest KB kilobyte.
Data Representation Bits, Bytes, Binary, Hexadecimal.
How We Measure Memory. Learning Goal Today we are going to learn how the computer stores information.
Networking for Home and Small Businesses –.  Explain the binary representation of data.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Thursday 8 th October, 2015 Information Technology Fundamentals of Hardware & Software.
How We Measure Memory. At the Bottom of things A piece of digital information is always stored as a sequence of binary states. What’s that mean you ask???
Computer Organization and Assembly Languages 2007/11/10
Introduction to Computer Organization & Systems Topics: Command Line Bitwise operators COMP Spring 2014 C Part V.
CS 125 Lecture 2 Martin van Bommel. Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk drive Software.
Binary Decimal Hexadecimal
Number Systems Part 2. Counting in Binary DecimalBinary
Binary a. express numbers in binary, binary-coded decimal (BCD), octal and hexadecimal;
Binary Numbers. Base 10 and Base 2  We normally work with numbers in base 10.  In base 10 we use the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.  Everything.
Numerical Representation Intro to Computer Science CS1510 Dr. Sarah Diesburg 1.
Topic: Binary Encoding – Part 2
Binary & Hex Review.
Topic: Binary Encoding – Part 1
Unit 2.6 Data Representation Lesson 1 ‒ Numbers
Computer basics.
© 2003, Cisco Systems, Inc. All rights reserved.
How do Computers Work ?.
Assembly Language (CSW 353)
Data Representation Binary Numbers Binary Addition
Integer Real Numbers Character Boolean Memory Address CPU Data Types
Numerical Representation
Memory Parts of a computer
COMP211 Computer Logic Design Lecture 1. Number Systems
Introduction to Computer Architecture
EPSII 59:006 Spring 2004.
Unit 2.6 Data Representation Lesson 1 ‒ Numbers
David Kauchak CS 52 – Spring 2016
इंट्रस्टिंग बनने के लिए आपको इंट्रस्टेड होना पड़ेगा।
CSCI 161: Introduction to Programming
Machine Architecture and Number Systems
Data Representation Numbers
Numerical Representation
Comp Org & Assembly Lang
Numerical Representation
Why computers use binary
Chapter Four Data Representation in Computers By Bezawit E.
Comp Org & Assembly Lang
Comp Org & Assembly Lang
Comp Org & Assembly Lang
Comp Org & Assembly Lang
Binary System.
Binary & Hex Review.
Networks & I/O Devices.
Numerical Representation
Presentation transcript:

Comp Org & Assembly Lang Bits and Bytes Topics Why bits? Representing information as bits Binary / Hexadecimal Byte representations Numbers Characters and strings Instructions Bit-level manipulations Boolean algebra Expressing in C

Converting main() { octal_print(0); /* result: 00 */ octal_print(0123456); /* result: 0123456 since 0 at */ /* beginning indicates octal num */ octal_print(-0123456); /* result: -0123456 */ octal_print(999); /* result: 01747 */ octal_print(-999); /* result: -01747 */ octal_print(1978); /* result: 03672 */ }

See /home/barr/Student/comp210/examples/octal.c Converting #define DIG 20 void octal_print(int x) { int i = 0, od; char s[DIG]; /* up to DIG octal digits */ if ( x < 0 ) /* treat negative x */ putchar ('-'); /* output a minus sign */ x = - x; } do od = x % 8; /* next higher octal digit */ s[i++] = (od + '0'); /* octal digits in char form */ } while ( (x = x/8) > 0); /* quotient by integer division */ putchar('0'); /* octal number prefix */ putchar(s[--i]); /* output characters on s s*/ } while ( i > 0 ); putchar ('\n'); See /home/barr/Student/comp210/examples/octal.c

Memory Contents Address What is memory (RAM)? To the processor, it’s just a big array of cells Each cell has an address Each cell contains a specific value 15213 “John” 3.14219 Sunday ‘a’ 1 2 3 4 Address Contents

Memory Contents Address Of course, addresses and content are actually in binary Memory is byte addressable i.e., every byte has an address. Address 1 000 001 010 011 100 Contents

Memory Contents Address When we look at memory in a debugger (like gdb), usually use hex notation Address 9B 39 C3 5F 09 000 001 002 003 004 Contents

Memory What we see (gdb) x/20b 0x7fffffffe45c 0x7fffffffe45c: 0x5 0x0 0x0 0x0 0x1 0x0 0x0 0x0 0x7fffffffe464: 0x0 0x0 0x0 0x0 0xffffffffffffffdd 0x5 0x40 0x0 0x7fffffffe46c: 0x0 0x0 0x0 0x0

32-bit machine means 32 wires on each bus Addressing Memory CPU must send an address to RAM how many bits in the address? depends on how many wires there are! 32-bit machine means 32 wires on each bus

Memory size limited by number of bits in address: 3 bits so 8 cells Contents 000 00000000 001 010 011 100 101 110 111 How do we talk about the size of memory? in terms of powers of 2 (addresses are binary) Bus must have 3 wires Memory size limited by number of bits in address: 3 bits so 8 cells

Range An address has a fixed number of bits. The range is the numbers that will fit in that many bits. Examples: 0 0 0 = 0 1 1 1 = 7 range is 0 to 7 0 0 0 0 = 0 1 1 1 1 = 15 range is 0 to 15

Range In general range is 0 to 2n – 1 where there are n bits in the representation Intuition: 111 = 1 x 22 + 1 x 21 + 1 x 20 Which is 1 less than 1000 = 1 x 23 + 0 x 22 + 0 x 21 + 0 x 20 Number of numbers represented: n bits can represent 2n different numbers i.e., from 0 to 2n – 1

Size In general Size is 2n where there are n bits in the representation Intuition: Range of 3 bits: 0 0 0 = 0 1 1 1 = 7 range is 0 to 7 number of numbers is 8 = 23 or 1 more than the largest number! Number of numbers represented: n bits can represent 2n different numbers i.e., from 0 to 2n – 1

Memory How do we talk about the size of memory? in terms of powers of 2 (addresses are binary) based on the number of bits in the address 20 1 21 2 22 4 23 8 24 16 25 32 26 64 27 128 28 256 29 512 210 1024 211 2048 212 4096 213 8192 214 16384 210 x 210 = 220 1,048,576 210 x 210 x 210 = 230 1,073,741,824 210 x 210 x 210 x 210 = 240 1,099,511,627,776

Memory How do we talk about the size of memory? 1 bit 8 bits 1 byte in bytes (how may bytes of memory do you have?) in terms of powers of 2 (addresses are binary) 1 bit 8 bits 1 byte 210 bytes 1024 bytes 210 x 210 = 220 1,048,576 bytes 210 x 210 x 210 = 230 1,073,741,824 bytes 210 x 210 x 210 x 210 = 240 1,099,511,627,776 bytes 1 bit 1 byte 1 Kilobyte (Kb) 1 Megabyte (Mb) 1 Gigabyte (Gb) 1 Terabyte (Tb)