DOC PREVIEW
Pitt CS 0447 - LECTURE NOTES

This preview shows page 1-2-3-4-5-6 out of 18 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS/COE0447 Computer Organization & Assembly LanguageExample: Chapter 1 example“C Program” Down to “Numbers”“Numbers” in MemoryStored Program ConceptStored Program Concept, Cont’dNumber RepresentationExample: Base 10 (Decimal)Numbers and Bases in GeneralExample: Base 2 (Binary)Base ConversionBase Conversion, cont’dSlide 13Slide 14Program PerformanceClock, Clock Cycle TimeSlide 17Example1CS/COE0447Computer Organization & Assembly LanguagePre-Chapter 22Example: Chapter 1 example•Question 1.48: If a computer issues 30 network requests per second and each request is on average 64 KB, will a 100 Mbit Ethernet link be sufficient? (printer, accessing files, …)•KB = 10^3 bytes•Byte = 8 bits•Mbit = 10^6•A 100 Mbit Ethernet: 10^8 bit/s “bitrate”•Answer: on board3“C Program” Down to “Numbers”swap:muli $2, $5, 4add $2, $4, $2lw $15, 0($2)lw $16, 4($2)sw $16, 0($2)sw $15, 4($2)jr $31void swap(int v[], int k){int temp;temp = v[k];v[k] = v[k+1];v[k+1] = temp;}00000000101000010…00000000000110000…10001100011000100…10001100111100100…10101100111100100…10101100011000100…00000011111000000…compilerassembler4“Numbers” in Memory00000000101000010…00000000000110000…10001100011000100…10001100111100100…10101100111100100…10101100011000100…00000011111000000…5Stored Program Conceptprocessormain memoryhard diskprogram Aprogram Bprogram Cprogram Aprogram Bdata Adata Bprogram fetchdata load/storedisk I/Oprogramcounter6Stored Program Concept, Cont’d•Programs (instructions) are stored in memory as a stream of bits (numbers)–Indistinguishable from data–More than one programs can reside in memory at the same time–Programs can be modified by the processor or I/O just as data can be modified•Instructions–Language of the machine–Describes primitive actions, supported directly by the machine•Instructions are fetched by the processor, are decoded and they determine processor actions7Number Representation•What is the natural “base” for numbers?–2? 10? 16? 27?•Unary is inefficient in space•All other bases are a compact way of re-presenting numbers…= X XX X X=X X X X X(U N A R Y)8Example: Base 10 (Decimal)•Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (10 of them)•Example:–3217 = (3103) + (2102) + (1101) + (7100)9Numbers and Bases in General•Number Base B  B unique values per digit–Base 10: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}–Base 2: {0, 1}–Base 16: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}•(Unsigned) number representation–d31d30…d1d0 is a 32-digit non-negative number–Value = d31B31 + d30B30 + … + d1B1 + d0B0•N-digit base B  BN unique values10Example: Base 2 (Binary)•Digits: 0, 1 (2 of them)•“Binary digit” = “Bit”•Example:–11010two = (124) + (123) + (022) + (121) + (020) = 16 + 8 + 0 + 2 + 0 = 26ten•Choice for machine implementation!–1 = on, 0 = off11Base Conversion•Let’s do decimal-to-binary conversion–Aten = dn-1dn-2…d1d0two–Given a base-10 number A, come up with n-digit binary number that has the same value!•X = the number•Let N be the largest power of 2 that fits into X•Put a 1 in that position•X = X – 2^N•Repeat until you are done!12Base Conversion, cont’d•From binary to decimal•From decimal to binary•From binary to hexadecimal•From hexadecimal to binary•From decimal to hexadecimal? (more complicated; later)13Base Conversion, cont’dBase 2 Base 16 Base 100000 0 00001 1 10010 2 20011 3 30100 4 40101 5 50110 6 60111 7 71000 8 81001 9 91010 A 101011 B 111100 C 121101 D 131110 E 141111 F 1514Base Conversion, cont’d•Binary to hex (base 16), or hex to binary base conversion is rather straightforward–Take 4 bits in binary and convert them into one hex digit and vice versa•Since binary notation tends to be long, hex notation is frequently used in assembly language (and in C programs).•More on binary number representation will be discussed when we study arithmetic15Program Performance•Program performance is measured in terms of time!•Program execution time has to do with–Number of instructions executed to complete a job–How many clock cycles are needed to execute a single instruction–The length of the clock cycle (clock cycle time)16Clock, Clock Cycle Time•Circuits in computers are “clocked”•At each clock rising (or falling) edge, some specified actions are done, usually within the next rising (or falling) edgeFunction block(made of circuits)clockclock cycle time17Program Performance•Time = (# of clock cycles)  (clock cycle time)•# of clock cycles = (# of instructions executed)  (average cycles per instruction) •Time = (# of instructions executed)  (average clock cycles per instruction)  (clock cycle time)•More of “program performance” issues will be discussed in Chapter 4.18Example•You have a machine with a CPU running at 1GHz. The same company releases its 2GHz CPU with 100% compatibility with the existing 1GHz CPU, and you are considering upgrading. What is the expected performance improvement from doing so? Assume that programs have 40% memory-access instructions, and each memory access takes 10ns on average. All other instructions take exactly one cycle for


View Full Document

Pitt CS 0447 - LECTURE NOTES

Download LECTURE NOTES
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE NOTES 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?