2 15 2008
play

2/15/2008 Pro g ra mming Anno unc e me nts FIT100 FIT100 FIT100 - PDF document

2/15/2008 Pro g ra mming Anno unc e me nts FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 Why is pro g ra mming fun? No c la sse s a t UW o n Mo nda y Pre side nt s Da y F ina lly, the re is the de lig ht o f wo rking


  1. 2/15/2008 Pro g ra mming Anno unc e me nts FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 • Why is pro g ra mming fun? • No c la sse s a t UW o n Mo nda y ∗ Pre side nt’ s Da y • F ina lly, the re is the de lig ht o f wo rking in suc h a tra c ta b le me dium. T he pro g ra mme r, like the • Se e the c o urse c a le nda r fo r upda te s • Se e the c o urse c a le nda r fo r upda te s po e t, wo rks o nly slig htly re -mo ve d fro m pure t k l li htl d f to re a ding s tho ug ht-stuff. He b uilds his c a stle s in the a ir, fro m a ir, c re a ting b y e xe rtio n o f the • Ne w e xtra -c re dit la b 9 ha s b e e n ima g ina tio n. F e w me dia o f c re a tio n a re so linke d fle xib le , so e a sy to po lish a nd re wo rk, so re a dily c a pa b le o f re a lizing g ra nd c o nc e ptua l • T W la b s fo r the ne xt two we e ks: struc ture s. wo rk o n pro je c ts, whic h a re due o n Source: Frederick P. Brooks, Jr. The Mythical Man-Month Essays on We dne sda ys a t 11pm. Software Engineering. I nstruc tio n E xe c utio n E ng ine s FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 • Wha t c o mpute rs c a n do ∗ Pe rfo rm o r e xe c ute instruc tio ns to pro c e ss F o llo wing I nstruc tio ns info rma tio n • T T he c o mpute r must ha ve instruc tio ns to fo llo w he c o mpute r must ha ve instruc tio ns to fo llo w Princ iple s o f Co mpute r Ope ratio n, o r H o w Co mpute rs Short list! Wo rk 9-4 I nstruc tio n E xe c utio n Ana to my o f a Co mpute r E ng ine s FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 • Wha t c o mpute rs c a n't do • Co mpute rs ha ve five b a sic pa rts o r sub syste ms ∗ Me mo ry, c o ntro l unit, a rithme tic / lo g ic unit ∗ Ha ve no ima g ina tio n o r c re a tivity (AL U), input unit, o utput unit ∗ Ha ve no intuitio n ∗ Ha ve no se nse o f iro ny, sub tle ty, pro po rtio n, de c o rum, o r humo r ∗ Are no t vindic tive o r c rue l ∗ Are no t purpo se ful Long list! ∗ Ha ve no fre e will ∗ Re c e nt mo vie s: T e rmina to r, Ma trix, AI 9-5 9-6 1

  2. 2/15/2008 Byte -Size Me mo ry Me mo ry L o c a tio n FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 • Me mo ry sto re s the pro g ra m running a nd the • A c o mmo nly use d dia g ra m o f c o mpute r da ta o n whic h the pro g ra m o pe ra te s me mo ry re pre se nts the disc re te lo c a tio ns a s b o xe s (1 b yte e a c h). • Pro pe rtie s o f me mo ry: • Addre ss o f lo c a tio n is displa ye d a b o ve ∗ Disc re te lo c a tio ns—1 b yte pe r lo c a tio n! the b o x. ∗ Addre sse s—F o r e ve ry me mo ry lo c a tio n (b yte ) • Va lue o r c o nte nts o f lo c a tio n is sho wn in • who le numb e rs sta rting with ze ro the b o x. ∗ Va lue s—Me mo ry lo c a tio ns sto re va lue s. ∗ F inite c a pa c ity—L imite d size —d a ta ma y no t "fit" in the me mo ry lo c a tio n. • Ove rflo w c o nditio ns, b uffe r o ve rruns 9-7 9-8 Ra ndo m Ac c e ss Me mo ry Me mo ry (c o nt'd) (RAM) FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 • 1-b yte me mo ry lo c a tio ns c a n sto re • "Ra ndo m a c c e ss" me a ns the c o mpute r c a n re fe r to (a c c e ss) the me mo ry o ne ASCI I c ha ra c te r, o r a numb e r lo c a tio ns in a ny o rde r le ss tha n 256 (0 - 255) • Ofte n me a sure d in • Pro g ra mme rs use a se q ue nc e o f me g a b yte s (MB) – millio ns o f b yte s o r me mo ry lo c a tio ns to g e the r, ig no ring g ig a b yte s (GB) – b illio ns o f b yte s the fa c t tha t the y a ll ha ve diffe re nt • L a rg e me mo ry is pre fe ra b le b e c a use a ddre sse s the re is mo re spa c e fo r pro g ra ms a nd ∗ Blo c ks o f fo ur b yte s a re use d a s a unit da ta (whic h usua lly e q ua te s to le ss I / O) so fre q ue ntly tha t the y a re c a lle d 9-9 9-10 me mo ry "wo rds" Co ntro l Unit FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 • I ts c irc uitry fe tc he s a n instruc tio n fro m me mo ry, de c o de s the instruc tio n, a nd fe tc he s the o pe ra nds use d in it ∗ A typic a l instruc tio n mig ht ha ve the fo rm yp g ADD 4000, 2000, 2080 op dest, sr c1, sr c2 ∗ T his instruc tio n a sks tha t the numb e rs sto re d in lo c a tio ns 2000 a nd 2080 b e a d d e d to g e the r, a nd the re sult sto re d in lo c a tio n 4000 [4000] = [2000] + [2080] ∗ Da ta / Ope ra nd F e tc h ste p must g e t the se two va lue s a nd a fte r the y a re a dde d, Re sult Re turn/ Sto re ste p will sto re the a nswe r in lo c a tio n 4000 9-11 9-12 2

  3. 2/15/2008 Arithme tic / L o g ic Unit I nput Unit a nd Output Unit (AL U) (I / O) FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 • Pe rfo rms the ma th • T he wire s a nd c irc uits thro ug h whic h ∗ A c irc uit in the AL info rma tio n mo ve s into a nd o ut o f a U c a n a d d two numb e rs c o mpute r ∗ Othe r c irc uits do multiplic a tio n, c o mpa riso ns, e tc . • I nstruc tio ns tha t just tra nsfe r da ta usua lly do n't i j f • Pe riphe rals use the AL U ∗ Co nne c t to the c o mpute r input/ o utput po rts. • Da ta / Ope ra nd F e tc h ste p o f the Cyc le g e ts the ∗ No t c o nside re d pa rt o f the c o mpute r, b ut va lue s tha t the AL U ne e ds to wo rk o n (o pe ra nd s) spe c ia lize d g a dg e ts tha t e nc o de o r de c o de • Afte r the AL U c o mple te s a n o pe ra tio n, the info rma tio n b e twe e n the c o mpute r a nd the a nswe r is mo ve d fro m the AL U to the de stina tio n physic a l wo rld. me mo ry a ddre ss spe c ifie d in the instruc tio n • Mo de ms, mo nito rs, sc a nne rs, printe rs, ke yb o a rd, ∗ ta xDue = ta xRa te [WA] * sub to ta l; mo use , dig itizing pa d, mic , spe a ke rs 9-13 9-14 A De vic e Drive r fo r T he Pe riphe ra ls E ve ry Pe riphe ra l FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 • K e yb o a rd e nc o de s ke ystro ke s we type • "Dumb " de vic e s pro vide b a sic physic a l into b ina ry fo rm fo r the c o mpute r tra nsla tio n to o r fro m b ina ry sig na ls. • Mo nito r de c o de s info rma tio n fro m the • Additio na l info rma tio n fro m the c o mpute r c o mpute r's me mo ry a nd displa ys it o n a is ne e de d to ma ke it o pe ra te inte llig e ntly. lig hte d, c o lo re d sc re e n • e .g ., c o mpute r re c e ive s info rma tio n tha t • Disks drive s a re use d fo r b o th input a nd use r type d shift a nd w a t the sa me time . I t o utput—sto ra g e de vic e s whe re the c o nve rts to a c a pita l W. T he so ftwa re tha t c o mpute r puts a wa y info rma tio n whe n it c o nve rts is c a lle d the de vic e drive r. is no t ne e de d, a nd c a n re trie ve fro m whe n it is ne e de d a g a in 9-15 9-16 Bra nc h a nd T he Pro g ra m Co unte r: T he Pc 's PC Jump I nstruc tio ns FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 • Ho w do e s the c o mpute r de te rmine whic h ste p • T he instruc tio n ma y inc lude a n to e xe c ute ne xt? a ddre ss to g o to ne xt. T his c ha ng e s • Addre ss o f the ne xt instruc tio n is sto re d in the the PC, so inste a d o f g o ing to PC +4 Co ntro l Unit in the pro gram c o unte r (PC). Co ntro l Unit in the pro gram c o unte r (PC) a uto ma tic a lly, the c o mpute r "jumps" t ti ll th t "j " • Be c a use instruc tio ns use 4 b yte s o f me mo ry, the o r "b ra nc he s" to the spe c ifie d ne xt instruc tio n must b e a t PC + 4, 4 b yte s furthe r lo c a tio n. a lo ng in the se q ue nc e (in g e ne ra l). • Co mpute r a dds fo ur to the PC, so whe n the F / E Cyc le g e ts b a c k to I nstruc tio n F e tc h ste p , the PC is "po inting a t" the ne xt instruc tio n. 9-17 9-18 3

  4. 2/15/2008 I nstruc tio n I nte rpre ta tio n FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 • Pro c e ss o f e xe c uting a pro g ra m ∗ Co mpute r is inte rpre ting o ur c o mma nds, b ut in its o wn la ng ua g e • Be fo re the F / E Cyc le b e g ins, so me o f the me mo ry lo c a tio ns a nd the PC a re visib le in the c o ntro l unit 9-19 9-20 T he F e tc h/ E xe c ute Cyc le Anima tio n FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 • A five -ste p c yc le : • F e tc h/ E xe c ute Cyc le 1. I nstruc tio n F e tc h (I F ) 2 2. I I nstruc tio n De c o de (I nstruc tio n De c o de (I D) D) 3. Da ta F e tc h (DF) / Ope ra nd F e tc h (OF ) 4. I nstruc tio n E xe c utio n (E X) 5. Re sult Re turn (RR) / Sto re (ST ) 9-21 Ho w I mpo rta nt is Clo c k Cyc ling the F / E Cyc le Spe e d? FIT100 FIT100 FIT100 FIT100 FIT100 FIT100 • Co mpute rs g e t the ir impre ssive • Mo de rn c o mpute rs try to sta rt a n instruc tio n o n e a c h c lo c k tic k c a pa b ilitie s b y e xe c uting ma ny o f • Pa ss o ff finishing instruc tio n to o the r c irc uitry the se simple instruc tio ns pe r se c o nd ( pipe lining ) ( pipe lining ) ∗ F ive instruc tio ns c a n b e in pro c e ss a t the sa me time • T he Co mpute r Clo c k: De te rmine s • Do e s a 1 GHz c lo c k re a lly e xe c ute a b illio n ra te o f F / E Cyc le instruc tio ns pe r se c o nd? ∗ Me a sure d in g ig a he rtz (GHz), o r b illio ns ∗ No t a pre c ise me a sure me nt. Co mpute r ma y no t b e a b le to sta rt a n instruc tio n o n e a c h tic k, b ut ma y o f c yc le s pe r se c o nd so me time s b e a b le to sta rt mo re tha n o ne instruc tio n a t a time 9-23 9-24 4

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend