Introduction CHAPTER Computers

Size: px
Start display at page:

Download "Introduction CHAPTER Computers"

Transcription

1 Iside a Computer

2 CHAPTER Itroductio. Computers A computer is a electroic device that accepts iput, stores data, processes data accordig to a set of istructios (called program), ad produces output i desired form. As show i Figure., it ca be abstracted as a black box that accepts iput ad produces output. The output depeds o the curret program i the block box. Computer iput is the iformatio that is submitted to a computer by a huma, by aother computer, or by its eviromet. Output is the result produced by the computer, such as texts, audio, graphs, ad pictures. Accordig to the Merriam-Webster Dictioary, data is factual iformatio (as measuremets or statistics) used as a basis for reasoig, discussio, or calculatio[2]. I computer sciece, data is such factual iformatio i a form suitable for use with a computer. Sice a computer is a electroic device, the way to store data i the computer is i the form of electrical sigals. These electrical sigals typically have two states represeted by or. Thus, all data from outside a computer are trasformed ito a represetatio that uses or whe stored or processed i the computer. The represetatio is trasformed back to a desired form for output as a result of the computatio. Iput Computer Output Figure.: Computer as a black box. 5

3 6 Itroductio CPU CU ALU RAM Figure.2: The vo Neuma architecture. A bit (a cotractio of biary digit) is the fudametal uit of iformatio i computer sciece that has two possible distict values, or. Iside a computer, data is ecoded as patters of bits (i.e., s ad s). A bit patter is a sequece (or strig) of bits. The meaig of a bit patter depeds o the iterpretatio. Sometimes it is used to represet umeric values; sometimes it represets other symbols such as characters i a alphabet; sometimes a image or audio. A byte is aother uit of iformatio. It cosists of 8 bits. Historically, a byte was used to ecode a sigle character of text. While early computers were built for specific problems ad solved mathematical ad egieerig problems, moder computers are aimed at more geeral problems i a variety of domais. Today, computers are eve embedded i automobiles, airplaes, robots, refrigerators, microwave oves, mobile phoes, MP3 players, etc. A computer system cosists of hardware ad software. Hardware is the physical compoets of the system. Software is the set of programs that istructs the hardware to obtai the output. A computer program is a set of istructios tellig the computer what to do with the iput i order to produce the output. It cotrols the actios of a machie (i.e., computer). The task of writig a program for a computer is called programmig. The perso who writes the program is called a programmer..2 The vo Neuma Architecture Most of moder computers follow the vo Neuma architecture. Theterm is derived from a proposal (First Draft of a Report o the EDVAC[3]) by the early computer scietist Joh vo Neuma ad others i 945. They proposed the idea of a geeral-purpose electroic computer with a stored program. Vo Neuma is ot the first perso who proposed the stored program cocept for

4 .2 The vo Neuma Architecture 7 computers. There are other pioeers i computer sciece, such as Ala Turig, J. Presper Eckert, ad Joh Mauchly, who proposed the same cocept. However, vo Neuma receives the pricipal credit because he istructed the rest of the world about it. A computer that follows the vo Neuma architecture cosists of four basic hardware compoets (Figure.2): iput devices, output devices, mai memory, ad cetral processig uit (CPU). There are may di eret types of iput devices, icludig keyboards, mice, hard disk drives, bar code readers, etc. They trasmit iformatio from the outside world ito mai memory. For example, whe you press a key o a computer keyboard, you sed a character to the mai memory of the computer. The character is ecoded i a sequece of electrical sigals. The, the sigals are trasmitted to ad stored i mai memory. Output devices trasmit iformatio from mai memory to the outside world. They iclude screes, priters, hard disk drives, etc. For example, a character stored i mai memory is trasmitted to a moitor i a sequece of electrical sigals. The moitor decodes the sigals to display the character o its scree. Mai memory stores both the program ad the data beig processed. Data ca be both read ad writte i mai memory as bit patters ad the locatio of data does ot a ect the access speed. This type of memory is ofte referred to as RAM (radom-access memory). I additio, mai memory is typically volatile. That is, whe the power is tured o, the iformatio stored i mai memory is lost. Mai memory does ot distiguish the type of data stored. Programs or iput/output devices are resposible for iterpretig the stored bit patter as a umber, a alphabetical symbol, or some other type. Machie code is the represetatio of a program that is actually read, iterpreted, ad executed by the computer. A program i machie code cosists of a sequece of machie istructios. A machie istructio is represeted as a fiite bit strig. The CPU carries out the istructios of a computer program. Two major compoets of a CPU are the arithmetic logic uit (ALU) ad the cotrol uit (CU). The ALU performs arithmetic ad logical operatios, ad the CU fetches istructios from mai memory, decodes them, ad executes them. The CU uses the ALU to execute the istructios whe ecessary. Mai memory is treated as primary storage. Computers have secodary storage (alteratively referred to as auxiliary storage or exteral memory) that is o-volatile. It does ot lose data stored whe the power is dow. It is typically used as both iput ad output devices, ad for storig programs ad data. The computer usually accesses its secodary storage through a itermediate space i mai memory. I moder computers, hard disk drives or solid-state disk drives are used as secodary storage. The capacity of secodary storage is typically two orders of magitude bigger tha that of mai memory. Some other examples of secodary storage are flash memory (e.g., USB sticks), floppy disks, magetic tape, puched cards, ad paper tape.

5 8 Itroductio.3 The Stored Program Cocept Early computers were desiged to perform a specific computig task. They had fixed programs. To use them for a di eret task, it was ecessary to rewire, restructure, or redesig the hardware. This requires huma itervetio. For example, ENIAC (Electroic Numerical Itegrator Ad Computer) costructed by the Uiversity of Pesylvaia i 946 was programmed by settig switches ad modifyig wirig to route data ad cotrol sigals. Coceptually, programs ad data are very di eret. The stored program cocept meas that we treat programs as data, ad they ca both be stored i mai memory. With this, the program for a specific task is loaded ito mai memory (e.g., from secodary storage), ad istructios i the program are executed oe after aother without ay huma itervetio. The program is easily replaced by aother program for a di eret task whe ecessary. By storig a program i mai memory, the hours of tedious labor required to reprogram computers ca be elimiated. A moder computer ca solve almost a ifiite variety of problems by just switchig betwee di eret programs..4 Files Accordig to the Merriam-Webster Dictioary, a file is a complete collectio of data treated by a computer as a uit especially for purposes of iput ad output[2]. Computer files ca be cosidered as the couterpart of traditioal files that are kept i o ces. The primary purpose of a computer file is to store data i a more permaet form. Files are typically stored i a secodary storage device. The cotets of a file are ecoded i a sequece of bits. The meaig of the bits totally depeds o the iterpretatio by the program that accesses the file. I geeral, there are two kids of computer files: text files ad biary files. The cotets of a text file are iterpreted as character symbols. Other files tha text files are biary files. A biary file cotais ay type of data ecoded i bits. Text files are cosidered to be di eret from biary files i geeral because biary files cotai more tha just textual data, such as formattig iformatio ecoded i bits. A character is ecoded as a bit strig i a text file. ASCII (America Stadard Code for Iformatio Iterchage) developed by ANSI (America Natioal Stadards Istitute) is the most commo character codig scheme for Eglishlaguage text files. ASCII uses 7 bits for each character symbol. Thus, 28 (2 7 ) di eret character symbols ca be defied with ASCII. However, each byte i a ASCII text file cotais a sigle character. Figure.3 shows the ASCII character table. ASCII was developed a log time ago ad desiged actually for use with teletypes. The first o-pritig characters are rarely used ow. Recetly, the Uicode Cosortium has developed a character codig scheme, called Uicode, to assig a uique value to every character symbol used i every laguage i the world. This allows texts from multiple laguages to appear i

6 .4 Files 9 Dec Bi Char Dec Bi Char Dec Bi Char Dec Bi Char NUL SPC 96 ` SOH 33! 65 A 97 a 2 STX 34 " 66 B 98 b 3 ETX 35 # 67 C 99 c 4 EOT 36 $ 68 D d 5 ENQ 37 % 69 E e 6 ACK 38 & 7 F 2 f 7 BEL 39 ' 7 G 3 g 8 BS 4 ( 72 H 4 h 9 TAB 4 ) 73 I 5 i LF 42 * 74 J 6 j VT K 7 k 2 FF 44, 76 L 8 l 3 CR M 9 m 4 SO N 5 SI 47 / 79 O o 6 DLE 48 8 P 2 p 7 DC 49 8 Q 3 q 8 DC R 4 r 9 DC S 5 s 2 DC T 6 t 2 NAK U 7 u 22 SYN V 8 v 23 ETB W 9 w 24 CAN X 2 x 25 EM Y 2 y 26 SUB 58 : 9 Z 22 z 27 ESC 59 ; 9 [ 23 { 28 FS 6 < 92 \ GS 6 = 93 ] 25 } 3 RS 62 > 94 ^ 26 ~ 3 US 63? 95 _ 27 DEL Figure.3: The ASCII table.

7 Itroductio a sigle text file. A character symbol i Uicode uses 6 bits (2 bytes). Thus, Uicode ca represet up to 65,536 (2 6 ) symbols. Di eret sectios of Uicode are allocated to character symbols from di eret laguages..5 Operatig Systems Applicatio software (also kow as a applicatio) is a set of programs that helps the user to carry out a specific task. For example, a spreadsheet is accoutig software that helps the user to calculate umbers ad orgaize iformatio i a tabular form (e.g., colums ad rows). I cotrast, system software is a set of programs desiged to operate the computer hardware ad to provide a platform for ruig applicatios. Especially, a operatig system (also kow as a OS) is system software that cotrols the operatio of a computer ad directs the processig of programs. It maages computer hardware resources ad provides commo services for applicatio software. A applicatio software ask a service to the operatig system whe ecessary. The operatig system assigs storage spaces i mai memory, cotrols iput ad output fuctios, moitors the uderlyig computer system, etc. It is typical that a user caot ru a applicatio o the computer without a operatig system. Popular operatig systems iclude Microsoft Widows, Mac OS, Liux, Uix, etc. Utility software is system software desiged to help the user maage ad tue the computer hardware ad software. It usually focuses o how the computer hardware ad software operates. It is also referred to as utility, tool, ad service program. Examples of utility software may iclude virus scaers, data compressio utilities, disk partitio utilities, archive utilities, system moitors, text editors, assemblers, etc..6 Programmig Laguages A programmig laguage is a formal laguage i which computer programs are writte. Most programmers write their programs i a high-level programmig laguage, like Java, C, C++, FORTRAN, Scheme, ML, etc. The level of abstractio from the details of the uderlyig computer i a high-level programmig laguage is higher tha a low-level programmig laguage. It is more close to atural laguages ad more uderstadable tha a low-level laguage. Thus, a high-level programmig laguage makes the process of developig programs simpler ad easier. A assembly laguage is a typical example of low-level programmig laguages. It represets machie istructios symbolically. The represetatio is defied by the hardware maufacturer ad specific to a computer architecture. There exists a assembly istructio that correspods to a machie istructio, but ot vice versa. A program called a assembler is used to traslate assembly laguage istructios ito the target computer s machie code istructios.

8 .6 Programmig Laguages #iclude <stdio.h> 2 3 it mai() 4 { 5 pritf("hello, world\ ); 6 } Figure.4: A example C program hello. hello.c source program (text file) Compiler hello executable object program (biary file) Figure.5: The compilatio process. The defiitio of a particular programmig laguage cosists of both sytax (how the various symbols of the laguage are combied) ad sematics (the meaig of the laguage costructs). The sytax ad sematics of a programmig laguage are typically defied i its specificatio. The C programmig laguage was developed from 969 to 973 by Deis Ritchie of Bell Laboratories. It was desiged for a practical purpose to implemet the UNIX operatig system. As UNIX became popular, may software developers were exposed to C. Although it was origially desiged as a systems programmig laguage, it ca be used for writig programs i a variety of differet domais from busiess to egieerig. It is oe of the most widely used programmig laguages i these days. I 978, Bria Kerigha ad Deis Ritchie published the classical book o C, The C Programmig Laguage[]. This book was kow to programmers as K& R ad had served as a iformal specificatio of C util 989. I 989, ANSI itroduced C89 stadard for the C programmig laguage. The same stadard was adopted by ISO (Iteratioal Orgaizatio for Stadardizatio) i 99 ad called C9. The stadard was further revised, leadig to ANSI/ISO C99 stadard that was published i 999. C99 is a iteratioally recogized C laguage specificatio, ad almost all C compilers follow this stadard. The stadard promotes portability, reliability, maitaiability, ad e ciet executio of C programs o a variety of machies. Figure.4 shows a example C program hello. It is itroduced i K&R, ad prits hello, world o the scree whe executed. The programmer creates the program with a text editor ad saves it i a text file hello.c. The text file is stored i secodary storage. A fileame extesio c is used to idicate that the

9 2 Itroductio Algorithm C laguage Assembly laguage Istructio set architecture Computer Sciece ad Egieerig Computer hardware (microarchitecture) Logic gates ad Boolea logic Electroic circuits Figure.6: Abstractios i computer sciece ad egieerig. text file cotais a C program. A fileame extesio is a su x to the fileame (e.g., c that is separated from the base fileame hello by a dot). It idicates the cotet type of the file. A text editor is a utility program to create ad modify text files. Commoly used text editors iclude GNU emacs, UNIX vi, Microsoft word, etc. To ru the hello program o a computer, the C statemets i the source program must be traslated by a compiler ito a sequece of machie istructios. A compiler is a program that automatically traslates aother program from some programmig laguage to machie code. The resultig machie istructios are cotaied i a biary file called a executable object file (or simply executable). After compilig the source file hello.c, the resultig executable hello i Figure.5 is stored i secodary storage. It is ready to be loaded ito the computer s mai memory ad executed..7 Abstractios i Computer Sciece Abstractio plays a key role i computer sciece. Computer sciece is fudametally a sciece of abstractio. The cocept of abstractio is pervasive i may arts ad scieces. Abstractio is the process of cosiderig the exteral properties of a object idepedetly of its iteral details. I other words, by abstractig a object, we are iterested i what the object does without ay iterest i how the object does it. To solve a complex problem, we devise a uderstadable model for it through abstractio. The, we explore appropriate methods to solve it usig the model. For example, the behavior of electroic circuits used to build computers ca be modeled very well by logic gates ad Boolea logic. Although this modelig is ot exact, the model abstracts away may details, such as the behavior of trasistors ad electrical sigals betwee

10 .7 Abstractios i Computer Sciece 3 them. We are able to desig, aalyze, ad maage a complex computer system by applyig abstractios. I this case, abstractios are built layer upo layer. As show i Figure.6, the layer of abstractio starts from electroic circuits. Electroic circuits required to build a computer abstract away the requiremets of the particular solid-state device techology (e.g., CMOS, NMOS, gallium arseide, etc.) used to build the circuit. The, as metioed before, the behavior of the electroic circuits is modeled with logic gates ad Boolea logic. At the ext layer, each compoet of computer hardware (e.g., ALU, CU, ad mai memory) is implemeted with logic gates ad Boolea logic. There are various choices of hardware compoet implemetatios. They di er i performace, power cosumptio, ad cost. However, at the computer hardware level, we do ot worry about such implemetatio details. A istructio set architecture (ISA) is the complete specificatio of the iterface betwee the programmer ad the uderlyig computer hardware. The ISA, ot the computer hardware, is visible to the programmer whe the programmer writes a program. A ISA is implemeted by a microarchitecture that describes how the ISA should be implemeted. Similar to the hardware compoet implemetatios with logic gates, microarchitectures have trade-o s betwee performace, power cosumptio, ad cost. For example, the x86 ISA was origiated by Itel ad has bee implemeted by microprocessors from both Itel ad AMD with radically di eret microarchitectures. O top of the ISA, the assembly laguage provides oe abstractio level. It implemets a symbolic represetatio of machie istructios i the ISA to make the programmig easier. A assembler is the iterface betwee the assembly laguage ad the ISA. The assembly laguage is also abstracted to the C laguage layer i a similar maer. The C compiler is the iterface betwee the C laguage ad the assembly laguage. A C program is traslated ito a assembly laguage program by the C compiler. High-level laguages like C make writig a program simpler ad easier tha a low-level laguage, such as machie ad assembly laguages. Moreover, programs writte i highlevel laguages ca be trasferred from oe computer to aother with little modificatio as log as the target computer has a compiler for the laguage. A algorithm is a sequece of steps for carryig out a task or solvig a problem. Each step is precisely ad uambiguously specified ad ca be carried out by a computer. A algorithm is expressed formally as programs writte i programmig laguages. As show i Figure.6, a algorithm ca be implemeted with a C program.

11 CHAPTER 2 Number Systems Iside computers, iformatio is ecoded as patters of bits because it is easy to costruct electroic circuits that exhibit the two alterative states, ad. The meaig of bits depeds o the iterpretatio. Sice the iformatio is processed by the computer essetially i some umerical form, we explore the ways how a computer represet umeric data iterally i this chapter. 2. Positioal Number Systems A umber system is a system of represetig umbers. It is defied by a set of basic symbols called digits or umerals, ad the ways i which the digits ca be combied to represet the umbers i the system. A umber system ca represet itegers, fractios, or mixed umbers. A mixed umber has two parts: a iteger part that tells you the whole ad a fractio part that is less tha oe whole. A radix poit separates the iteger part ad the fractio part. Sice the decimal umber system is the most familiar umber system ad used i our everyday life, our discussio begis with it. The decimal umber system is a positioal umber system. I a positioal umber system, a umber is represeted by a strig of digits. The value of each digit i the strig is determied by the positio it occupies i the umber. That is, each digit positio has a weight associated with it. The rightmost positio i the umber has the lowest weight. The leftmost digit i the umber is called the most sigificat digit (MSD) ad the rightmost digit is called the least sigificat digit (LSD). Other examples of commoly used positioal umber systems iclude biary, octal, ad hexadecimal umber systems. I the decimal umber system, there are digits:,, 2, 3, 4, 5, 6, 7, 8, ad 9. The decimal umber of the form d p d p 2...d d.d d 2...d has the 5

12 6 Number Systems Name Base Digits Biary Octal Decimal Hexadecimal 2, 8,, 2, 3, 4, 5, 6, 7,, 2, 3, 4, 5, 6, 7, 8, 9 6,, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Table 2.: Commoly used umber systems with their bases ad digit sets. value, Xp i= d i i All the weights i the decimal system are powers of the umber. The iteger ad fractio parts are separated by the. symbol, the decimal poit. The fractio part is deoted by a sequece of digits whose weights are egative powers of. The decimal umber system is also kow as the base- umber system because the weight of each positio i the umber is a power of. For example, the decimal umber ca be decomposed as follows: = Whe we replace the base with some other whole umber r, called the base or radix, the we have base-r umber system. This umber system requires r distict digits, ad the weight i positio i is r i. Thus, the base-r umber of the form x p x p 2...x x.x x 2...x has the value, Xp i= x i r i where each x i comes from the set of r distict digits. Traditioally, the first r decimal digits serve as the digits for the base-r systems whe r apple. Whe r>, the first r uppercase letters of the alphabet are used to provide additioal symbols. For example, the three-digit umber deotes five i the biary umber system whereas it deotes oe hudred ad oe i the decimal system. Whe the base of a base-r umber N is uclear from the cotext, we apped a subscript r to it. For example, 2 represet a biary umber. Table 2. shows the bases ad digit sets for some commoly used umber systems. 2.2 Scietific Notatio Scietific otatio is a scheme of represetig decimal umbers that are very small or vary large. I scietific otatio, a umber is represeted i the form: x y

13 2.3 Biary Number System 7 Where x is called the coe ciet (also called the sigificad or matissa) ad is ay real umber, ad y is called the expoet ad must be a iteger. For example, ca be writte as. 7 i scietific otatio. Sice there are may ways to represet a umber i the form of x y, we adopt the covetio of makig the sigificad, x, always i the rage: apple x <. This otatio is ofte referred to as ormalized scietific otatio. Note that we ca ot express zero with the ormalized scietific otatio. I a positioal umber system, the sigificat digits of a umber are those digits whose removal chages the umerical value associated with the umber. Aumber sprecisio or accuracy is the umber of sigificat digits it cotais. Leadig zeroes of a umber are ay cosecutive zeroes that appear i the leftmost positios of the umber s represetatio. O the other had, trailig zeroes are ay cosecutive zeroes i the umber s represetatio after which o other digits follow. Leadig zeroes are isigificat ad do ot a ect the umerical value. Similarly, trailig zeroes that appears to the right of a radix poit do ot a ect the value. They are merely placeholders to idicate the size of the represetatio. For example, the removal of leadig ad trailig zeroes i 3.4 does ot a ect the value of the represetatio. Base-r umbers expressed with a fixed umber of digits ofte have a implicit radix poit at some fixed positio. For example, if the umber is a iteger, the radix poit is immediately to the right of its LSD. If it is a fractio, the radix poit is immediately to the left of its MSD. These umbers are referred to as fixed-poit umbers. I cotrast, floatig-poit umbers have a radix poit that ca be placed aywhere relative to their sigificat digits: the radix poit ca float. The positio of the radix poit is idicated separately ad ecoded i the umber s represetatio. Scietific otatio is closely related to the floatigpoit umbers. We will describe later how the computers express floatig-poit umbers iterally. 2.3 Biary Number System Sice it was easier to build electroic circuits that distiguish betwee two di eret values tha more tha two values, computers use Boolea logic, which is a two-valued logical system, to abstract away the details of electroic circuits. Cosequetly, the biary umber system are directly related to the Boolea logic used i the computer, ad the computer iterally represets umeric data i a biary form. As show i Table 2., the biary umber system uses ad as its digits. The geeral form of a biary umber is b p b p 2...b b.b b 2...b, ad it has the followig iterpretatio, For example, Xp i= b i 2 i 2 = = 9

14 8 Number Systems Biary Octal Hexadecimal Decimal A 3 B 4 C 2 5 D 3 6 E 4 7 F 5 Table 2.2: The correspodece betwee 4-bit biary, octal, hexadecimal, ad decimal umbers.. 2 = =5.25 Similar to the decimal umber system, the leftmost bit b p is called the most sigificat bit (MSB) ad the rightmost bit b is called the least sigificat bit (LSB). The radix poit i the biary umber system is referred to as the biary poit. The octal umber system is useful for represetig multi-bit biary umbers. Sice eight is a power of two (8 = 2 3 ), three bits i a biary umber ca be uiquely represeted with a sigle octal digit. For example, 2 = 2 = =. 2 = Similarly, the hexadecimal umber system is also useful for represetig multi-bit biary umbers. Each group of four bits i a biary umber ca be uiquely represeted by a sigle hexadecimal digit. For example, 2 = 2 =8CE 6. 2 =. 2 =2.B2C 6 Table 2.2 shows the correspodece betwee 4-bit biary, octal, hexadecimal, ad decimal umbers.

15 2.4 Number System Coversio 9 Let N be the decimal umber ad b-b-2 b be the biary umber after the coversio.. Set i to. 2. Divide N by 2 ad obtai a quotiet ad a remaider. 3. Set bi to the remaider ad N to the quotiet. 4. If N is ot zero, set i to i+ ad go to step 2. Figure 2.: A decimal to biary coversio algorithm for a iteger. i N b i 8/2 = 54 (LSB) 54/2 = /2 = 3 3 3/2 =6 4 6/2 =3 5 3/2 = 6 /2 = (MSB) Figure 2.2: Covertig 8 to biary. A biary umber system usig bits ca represet 2 di eret umbers. Whe such a fixed precisio biary umber is used to represet oly positive values, it is called a usiged umber. It is also possible to ecode siged umbers (positive umbers ad egative umbers) i biary. There are several ways to represet the siged umbers i biary. Oe way of represetig a egative umber is settig the MSB to ad usig the remaiig bits to represet the value. I this case, the MSB is referred to as the sig bit. However, to keep the computer hardware implemetatio as simple as possible, almost all today s computers iterally use twos complemet represetatio. 2.4 Number System Coversio Sice humas typically use decimal umbers, but computers use biary umbers iterally, it is importat to kow how to covert decimal umbers to biary umbers ad vice versa. A iteger N ca be coverted from decimal form to biary form by repeatedly dividig N by two ad usig the remaiders. Figure 2. shows a algorithm for such a coversio. For example, a positive iteger 8 is coverted to the biary umber 2. The coversio process that follows the algorithm described i Figure 2. is illustrated i Figure 2.2.

16 2 Number Systems Let N be the decimal fractio ad b-b-2 b- be the biary umber after the coversio.. Set i to. 2. Multiply N by 2 ad set N to the result. 3. If N is less tha, set b-i to. 4. Otherwise, set b-i to ad N to N-. 5. If i is less tha, set i to i+ ad go to step 2. Figure 2.3: A decimal to biary coversio algorithm for fractios. i N b i = = = =.76 Figure 2.4: Covertig.73 to a 4-bit biary fractio. For a mixed umber, we covert its iteger part ad fractio part to biary form separately. The, we combie the results. A algorithm for covertig a decimal fractio to biary form is show i Figure 2.3. To obtai the first bits of a biary fractio usig the algorithm, it is required to perform multiplicatios by two i geeral. For example, the process of covertig a decimal fractio.73 to a 4-bit biary fractio. 2 is illustrated i Figure 2.4. After combiig the results from the iteger coversio ad the fractio coversio, a mixed umber 8.73 i the above examples is coverted to a biary umber. 2. However, the 4-bit biary fractio obtaied i the process of Figure 2.4 is iexact. So far, we assumed that there are as may bits available as required to represet the umber, ad we did ot cosider the size of the represetatio. Whe the umber of bits used is specified to represet a umber, it determies the rage of possible umbers that ca be represeted. For example, 8 bits ca represet 256 = 2 8 distict umeric values. Word is a group of bits that are hadled as a uit by the computer. The umber of bits i a word is a importat characteristic of a computer architecture. The precisio of expressig a umerical quatity strogly depeds o the word size (i.e., the umber of bits i a word). If the word size is oly four bits, the we ca ot express the result of the above example more precisely. A dyadic fractio is a ratioal umber whose deomiator is a power of two;

17 2.4 Number System Coversio 2 i N b i 8/8 = 3 4 (LSB) 3/8 = 5 2 /8 = (MSB) i N b i = = =. 4. 8= Figure 2.5: Covertig 8.73 to a octal umber. i N b i 8/6 = 6 2(C) (LSB) 6/6 = 6 (MSB) i N b i =.76 (B) = 2.6 2(C) = = Figure 2.6: Covertig 8.73 to a hexadecimal umber. for example, /2 or 3/6, but ot /3. Dyadic decimal fractios covert to fiite biary fractios ad are represeted i full precisio if the word size is greater tha or equal to the legth of the biary represetatio. No-dyadic decimal fractios covert to ifiite biary fractios (a repeatig sequece of the same bit patter). Trucatio (also kow as choppig) is the process of discardig ay uwated digits of a umber. Roudig a umber replaces the umber with aother umber that is as close to the origial umber as possible. Decimal to octal ad decimal to hexadecimal coversios are similar to the decimal to biary coversio. A iteger ca be coverted from decimal form to octal (or hexadecimal) form by repeatedly dividig it by eight (or sixtee) ad usig the remaiders. A decimal fractio coverts a octal (or hexadecimal) fractio with digits after performig successive multiplicatios by eight (or sixtee). For example, the coversio process of a mixed umber, 8.73, to octal ( ) ad hexadecimal (6C.BC28 6 ) are illustrated i Figure 2.5 ad Figure 2.6, respectively. Aother way to perform decimal to octal or decimal to hexadecimal coversio for a decimal umber is that covertig it to a biary umber. The, the biary umber ca be coverted to a equivalet octal or hexadecimal umber. For example, 8.73 is coverted to octal ( ) ad hexadecimal (6C.BC28 6 ) i the followig way: 8.73 =. 2 = =. 2 = 6C.BC28 6

18 22 Number Systems 2.5 Usiged Biary Arithmetic Arithmetic operatios performed o usiged biary umbers are much like arithmetic i the decimal umber system that we kow very well. Additio, subtractio, multiplicatio, ad divisio ca be performed o biary umbers. A pair of usiged biary umbers ca be added bit by bit accordig to the same method used i decimal additio. Sice computers use di eret stadard to ecode a mixed umber (typically usig the IEEE 754 stadard), we will restrict our discussio to usiged whole umbers. For example, a pair of usiged 4-bit biary umbers ad ca be added as follows: carry + Whe addig two s i the same colum produces 2, (called carry) will have to be added to the left colum of more sigificat bits. Whe the result of additio exceeds oe, we carry the excess amout to the ext positio usig a carry. The positio has a weight that is higher by a factor equal to two. A overflow occurs whe a computatio produces a value that falls outside the rage of values that ca be represeted. For example, addig two usiged 4-bit biary umbers ad produces a 5-bit value, ad it is a overflow: carry + The carry bit from the MSB tell us that a overflow occurred i the additio. Usiged biary subtractio works i much the same way as decimal subtractio. For example, ca be subtracted from produces as follows: borrow Subtractig a from a i a colum produces by borrowig (called borrow) from the left colum of more sigificat bits. Whe the result of a bit by bit subtractio i a colum is less tha, we borrow from the colum o the left subtractig it from the ext higher positioal value. Usiged biary multiplicatio is also similar to the decimal multiplicatio that adds up partial products to produce the fial result. For example, two

19 2.6 Oes Complemet Represetatio 23 Positive Negative Oes complemet Decimal Oes complemet Decimal Table 2.3: 4-bit oes complemet represetatio. 4-bit usiged biary umbers ad are multiplied as follows: Note that the result ca ot be represeted with 4 bits. I geeral, a -bit biary multiplicatio requires 2 bits to represet the result. Usiged biary divisio is agai similar to the decimal divisio. For example, the process of dividig by produces a quotiet ad a remaider. ) 2.6 Oes Complemet Represetatio Oes complemet represetatio is oe of the methods to represet a egative umber. The oes complemet of a egative biary umber is the bitwise iversio (flippig s for s ad vice-versa) of its positive couterpart. For example, the oes complemet represetatio of 6( 2 ) is 2. The maximum value that ca be represeted by the oes complemet represetatio with bits is 2 ad the miimum is 2. Table 2.3 shows

20 24 Number Systems the umbers that ca be represeted i the oes complemet represetatio with 4 bits. The MSB is the sig bit. Ulike two s complemet represetatio (explaied later), it has two zeroes. For example, 2 ad 2 are the two 4-bit oes complemet represetatios of zero. Addig two biary umbers i the oes complemet represetatio is similar to the usiged biary additio, but there is a coditio called a ed-aroud carry that does ot occur i usiged biary additio. Cosider addig two biary umbers ad i oes complemet represetatio: carry (4) + ( ) (add the ed-aroud carry) (3) For the additio i the oes complemet represetatio, we perform a usiged biary additio. If there is a carry from the MSB (this is called a ed-aroud carry), the add the carry back ito the resultig sum to produce the fial result. Ulike the two s complemet represetatio, the oes complemet represetatio is ot popular i these days because of several issues like egative zero, ed-aroud carry, etc. 2.7 Two s Complemet Represetatio The twos complemet represetatio is the most commo method of represetig siged itegers iterally i computers. It simplifies the complexity of the ALU by allowig usig the same circuit that is used to implemet arithmetic operatios for usiged umbers. The major di erece is the iterpretatio of the result produced by the arithmetic operatio. To covert a umber to two s complemet represetatio, the umber is coverted to its oes complemet first. The oe is added to the result to produce its two s complemet. Aother way of ecodig a egative umber to its twos complemet is flippig all bits but the first least sigificat ad all the trailig s. For example, the twos complemet represetatio of 6 ( 2 ) is 2. The maximum value that ca be represeted by -bit two s complemet represetatio is 2 ad the miimum is 2. Table 2.4 shows the umbers that ca be represeted i the two s complemet represetatio with 4 bits. The MSB is the sig bit. Two s complemet additio is exactly the same as that of usiged biary umbers. For example, addig 4 ( 2 ) ad 5 ( 2 ) i 4-bit two s complemet represetatio gives ( 2 ). Subtractio ca be hadled by covertig it to additio: x y = x +( y)

21 2.8 Shift Operatios ad Sig Extesio 25 Positive Two s complemet Decimal Negative Two s complemet Decimal Table 2.4: 4-bit two s complemet represetatio.. Add the two operads icludig the sig bits. 2. If the carry ito the MSB is ot equal to the carry out of the MSB, a overflow has occurred. Figure 2.7: Overflow detectio i two s complemet additio. Overflow occurs if + bits are required to cotai the result from a -bit additio or subtractio. If the sig bits were the same for both umbers ad the sig of the result is di eret to them, a overflow has occurred. The process of detectig a overflow after addig two operads is show i Figure 2.7. For example, a overflow occurs i the followig 4-bit two s complemet additio: carry (7) + (7) I this case, the carry ito the MSB () is di eret to the carry () out of the MSB. 2.8 Shift Operatios ad Sig Extesio A shift operatio shifts all of the bits i its operad. Every bit i its operad is moved a give umber of positios to a specified directio. There two di eret types of shift operatios: logical shift ad arithmetic shift. A logical shift operatio moves bits to the left or right. The bits that fall o at the ed of the word are discarded. The vacat positios i the opposite

22 26 Number Systems x>>3 x<<3 Logical shift Arithmetic shift Figure 2.8: The di erece betwee 8-bit logical shift ad arithmetic shift for x =. w bits w+k bits (a) Decimal 4-bit 8-bit 6-6 (b) Figure 2.9: (a) The sig extesio process. (b) The sig-bit repetitio for -6. ed are filled with s. The arithmetic left shift is the same as the logical left shift. I the arithmetic right shift, the leftmost bits are filled with the sig bit of the origial umber. We deote a left shift operatio with << ad right shift operatio with >>. Figure 2.8 shows a example of the di erece betwee logical shift ad arithmetic shift for x =. Usig shift operatios, we ca e cietly perform usiged multiplicatio or divisio by powers of two. A -bit logical left shift operatio o usiged itegers is equivalet to multiplicatio by 2. For example, 2 (3) << 2 = = 2 (52) A -bit logical right shift is equivalet to divisio by 2, ad we obtai the quotiet of the divisio. For example, 2 (53) >> 2 = = 2 (3) Usig arithmetic shifts, we ca e cietly perform multiplicatio or divisio of siged itegers by powers of two. I two s complemet represetatio, arithmetic shift operatios exted the otio of the floor operatio. The floor of a iteger x (deoted by bxc) is defied by the greatest iteger less tha or equal to x. For example, b/2c = 5 ad b 3/2c = 2. A arithmetic shift operatio o a iteger takes the floor of the result of multiplicatio or divisio. For example, 2 ( 4) << = 2 ( 6) 2 ( 4) >> = 2 ( 2) 2 ( 4) >> 2 = 2 ( ) 2 ( 4) << 2 = 2 () Overflow 2 (4) << = 2 ( 8) Overflow

23 2.8 Shift Operatios ad Sig Extesio 27 However, i two s complemet represetatio, a arithmetic right shift is ot equivalet to divisio by a power of two. For example, whe you perform a arithmetic right shift o a 4-bit = 2, you still get = 2.The ANSI C99 stadard does ot specify the defiitio of the C laguage s right shift operator for egative values. The behavior of the right shift operator depeds o the C compiler. Whe covertig a iteger with w bits ito the oe with w + k bits ad the same value, we eed to perform sig extesio i two s complemet represetatio. The MSB (the sig bit) must be repeated i all the k extra bits. Figure 2.9(a) shows this process ad Figure 2.9(b).

24 CHAPTER 3 Logic Circuits The elemetary buildig blocks of a CPU are logic gates. The iput ad output of logic gates assume oly two values, ad. Their behavior is well modeled by laws of Boolea algebra. We start out this chapter with Boolea algebra, ad lear how a arithmetic logic uit ad mai memory are built from logic gates. 3. Boolea Algebra Boolea algebra was developed by George Boole i 854. It is a algebraic represetatio of logic ad the algebra of truth values: true ad false. Edward V. Hutigto gave the formal defiitio of Boolea algebra i 94. It is referred to as Hutigto s postulates. I 937, Claude Shao applied Boolea algebra to electrical switchig circuits to reaso about the behavior of etworks of relay switches i 937. I the rest of this book, the two-elemet Boolea algebra (also kow as switchig algebra) defied by Shao is used ad referred to as Boolea algebra. The two-elemet Boolea algebra is a set of two elemets, B = {, }, together with three operatios _ (OR), ^ (AND), ad (NOT). It satisfies the followig axioms: Axiom (Closure). For all x ad y i B both x _ y ad x ^ y are i B. Axiom 2 (Idetity elemet). There exist distict elemets ad i B such that for all x i B, x _ =x ad x ^ =x. Axiom 3 (Commutativity). For all x ad y i B, x _ y = y _ x ad x ^ y = y ^ x. Axiom 4 (Distributivity). For all x, y, adz i B, x_(y ^z) =(x_y)^(x_z) ad x ^ (y _ z) =(x ^ y) _ (x ^ z). 29

25 3 Logic Circuits OR AND NOT x y x y x y x y x x Figure 3.: The three operatios i Boolea algebra: OR, AND, ad NOT. x y z f(x,y,z) = ((x y) z ) Figure 3.2: The truth table of a Boolea fuctio f(x, y, z) =((x _ y) ^ z ). Axiom 5 (Complemet). For each x i B, there exists a elemet i B, deoted x ad called the complemet or egatio of x, such that x_x =ad x^x =. Axiom 6 (Cardiality). There are at least two distict elemets i B. The three operatios, OR (_), AND (^), ad NOT ( ) are defied as follows: x _ y = x ^ y = x = whe either x or y is, or both are otherwise whe both x ad y are otherwise whe x = otherwise Figure 3. defies these operatios with truth tables. The truth table of a Boolea operatio is a list of all combiatios of s ad s that ca be iputs to the operatio ad a list that shows the value of the operatio. There are some other properties (i.e., theorems) of Boolea algebra that ca be derived from the axioms:

26 3. Boolea Algebra 3 f(x, y) xy Commet Costat x y x ad y (AND) x y x but ot y x x x y y but ot x y y (x y ) (x y) x or y but ot both (XOR) x y x or y (OR) (x y) NOR (x y) (x y ) x equals y (XNOR) y NOT y x y If y the x x NOT x x y If x the y (x y) NAND Costat Figure 3.3: The 6 Boolea fuctios of two iput variables, x ad y Property (Uiqueess of ad ). ad are uique. Property 2 (Idempotecy). For all x i B, x _ x = x ad x ^ x = x. Property 3. For all x i B, x _ =ad x ^ =. Property 4 (Absorptio). For all x ad y i B, (x_y)^x = x ad (x^y)_x = x. Property 5 (Associativity). For all x, y, adz i B, (x _ y) _ z = x _ (y _ z) ad (x ^ y) ^ z = x ^ (y ^ z). Property 6 (The uiqueess of complemet). For all x i B, x is uique. Property 7 (Ivolutio). For all x i B, (x ) = x. Property 8 (De Morga s law). For all x ad y i B, (x _ y) = x ^ y ad (x ^ y) = x _ y. A Boolea expressio is a strig of symbols ivolvig costats ad, some variables, ad Boolea operatios _, ^, ad. A Boolea expressio i variables x, x 2,, ad x is defied iductively as follows: Each of the symbols,, x, x 2,, ad x is a Boolea expressio. If e ad e 2 are Boolea expressios, so are e,(e _ e 2 ) ad (e ^ e 2 ).

27 Logic Circuits XOR XNOR NOR NAND x y x y x y x y x y (x y) x y (x y) Figure 3.4: The truth tables of XOR, XNOR, NOR, ad NAND. The followig is some examples of Boolea expressios: ((x _ y) _ (x ^ y)) (((x ^ y) _ (x ^ z )) _ (y _ y) ) For Boolea expressios e ad e 2, e is ofte called as the egatio of e, ad (e _e 2 ) ad (e ^e 2 ) are called as the disjuctio ad cojuctio of e ad e 2,respectively.Ife is a Boolea expressio i variables x, x 2,, ad x, the e defies a Boolea fuctio mappig B ito B whose value at -tuple (a,a 2,,a ) is the elemet of B = {, } obtaied by replacig x by a, x 2 by a 2,, ad x by a i e. A truth table is the simplest way to specify a Boolea fuctio. For example, f(x, y, z) =((x _ y) ^ z ) is a Boolea fuctio defied by Boolea expressio (x _ y) ^ z. This fuctio is also defied by the truth table i Figure 3.2. The umber of di eret Boolea fuctios that ca be defied over biary variables is 2 2. Table 3.3 shows all 6 fuctios of two iput variables, x ad y. A set of Boolea operatios is fuctioally complete if its members ca costruct all other Boolea fuctios over ay give set of iput variables. We assume that these operatios ca be applied as may times as eeded. A well kow complete set of Boolea operatios is {AND, OR, NOT}. Some ew Boolea operatios show i Figure 3.3 ca be composed from these three basic operatios. For two variables x ad y, the Boolea operatios XOR ( ) ad XNOR ( ) are defied by x y = (x ^ y ) _ (x ^ y) = x y = (x ^ y) _ (x ^ y ) = whe x 6= y otherwise whe x = y otherwise XOR ad XNOR are shorthads for exclusive or ad exclusive NOT-OR, respectively. NOR is defied by (x _ y) ad a shorthad for NOT-OR. Similarly, NAND is defied by (x ^ y) ad a shorthad for NOT-AND. {NOR} ad {NAND} are also fuctioally complete. The truth tables of XOR, XNOR, NOR, ad NAND are show i Figure 3.4.

28 3.2 Logic Gates 33 Name Symbol Fuctio NOT x f f = x' OR x y f f = x y AND x y f f = x y NOR x y f f = (x y)' NAND x y f f = (x y)' XOR x y f f = x y XNOR x y f f = x y Figure 3.5: The graphic symbols of some elemetary logic gates. 3.2 Logic Gates A logic gate is a coceptual or physical device that performs oe or more Boolea operatios. A Boolea fuctio ca be implemeted with a logic gate. Logic gates are typically made from trasistors. However, we focus o the abstract otio of logic gates; we do ot worry about their implemetatio details or how electroic circuits implemet them. A logic gate ca be viewed as a black box device. If a Boolea fuctio f maps B ito B m (i.e., it has iput variables ad m outputs), the logic gate that implemets f has iput pis ad m output pis. The graphic symbols of some elemetary logic gates are show i Figure 3.5. A logic diagram is a graphical represetatio of a logic circuit that shows coectios betwee logic gates. A logic gate with more complicated fuctioality ca be implemeted by combiig ad itercoectig some elemetary logic gates. For example, Figure 3.6 shows the implemetatios of XOR, XNOR, NOR, ad NAND gates usig AND, OR, ad NOT gates. A XOR gate ca be implemeted with a OR gate, two AND gates, ad two NOT gates. Multi-iput gates ca also be made by combiig gates of the same type with less iputs. Figure 3.7 shows how a 3-iput AND gate ca be made out of 2-iput AND gates. As metioed before, a word is a group of bits that are hadled as a uit by the computer. Thus, computer hardware is typically desiged to hadle multiple bits simultaeously. A bus is a collectio of two or more related sigal lies each of which represets a bit. To avoid drawig multiple wires for a bus i logic circuit diagrams, we use the bus otatio. For example, the followig diagram shows a 4-bit bus: 4 To refer to idividual bits i a -bit bus amed data, we use the otatio

29 34 Logic Circuits x x y XOR f y f x y (a) x y XNOR f f (b) x y NOR f x y f (c) x y NAND f x y f (d) Figure 3.6: Implemetatios of XOR, XNOR, NOR, ad NAND gates with AND, OR, ad NOT gates: (a) the logic diagram of XOR; (b) the logic diagram of XNOR; (c) the logic diagram of NOR; (d) the logic diagram of NAND. data[i] to refer to the bit located at positio i (the LSB is data[]). I additio, to idicate a set of cosecutive bits i data, we use the otatio data[i : j] for j i + cosecutive bits from positio i to j iclusively. For example, the followig diagram shows that X[4] coects to Y [2] ad X[5] coects to Y [3]: X[4:5] Y[2:3] Like Boolea operatios, a set of logic gates that ca implemet ay Boolea fuctio is called a complete set of logic gates. Each of {AND, OR, NOT}, {NAND}, ad {NOR} is a complete set of logic gates. A uiversal gate is a gate that ca implemet ay Boolea fuctio without eed to use ay other gate type. Thus, NAND or NOR is a uiversal gate. Sice the implemetatio of NAND or NOR gate requires fewer trasistors ad is faster tha that of AND or OR gates, logic desigers prefer to use NAND or NOR gate to implemet their logic circuits.

30 3.2 Logic Gates 35 x y z f y z x f (b) (b) Figure 3.7: A implemetatio of a 3-iput AND gate with two 2-iput AND gates: (a) its Logic diagram; (b) its graphic symbol. x y x y x - y - (a) z z z - X Y (b) Z Figure 3.8: A implemetatio of a -bit AND gate with 2-iput AND gates: (a) its logic diagram; (b) its graphic symbol. A multi-bit(-bit) logic gate that performs a bit-wise Boolea operatio is implemeted by a array of gates each operatig separately o each bit positio of the operads. For example, as show i Figure 3.8, to implemet a -bit AND gate that performs a bit-wise AND operatio o two -bit biary values, we ca build a array of two-iput AND gates each operatig separately o a pair of bits from the two operads. x y carry sum x y sum carry (a) (b) Figure 3.9: A half adder: (a) its truth table; (b) its logic diagram.

31 36 Logic Circuits x y ci sum cout x y c i sum c out (a) (b) x y c i x sum Half adder y carry x sum Half adder y carry sum c out (c) Figure 3.: A full adder: (a) its truth table; (b) its logic diagram; (c) a implemetatio with two half adders. x - y - x -2 y -2 x -3 y -3 x y c x y Full adder c out c i c - x y Full adder c out c i x y Full adder... c -2 c out c i c -3 x y Full adder c out c i c c Overflow s - s -2 s -3 s Figure 3.: A -bit ripple carry adder. 3.3 Combiatioal Logic Circuits A combiatioal logic circuit cosists of logic gates ad performs a operatio that ca be specified by a set of Boolea fuctios. Its outputs are totally depedet o the curret iput values ad determied by combiig the iput values usig Boolea operatios. I cotrast, the outputs of a sequetial logic

32 3.3 Combiatioal Logic Circuits 37 circuit deped ot oly o the curret iput values but also o the past iputs. I additio to usig logic gates, it employs memory ad its outputs are a fuctio of the curret iput values ad the data stored i memory. Cosequetly, a sequetial logic circuit has states. The Half Adder A half adder adds two oe-bit biary umbers x ady. It has two outputs: sum ad carry. The Boolea fuctios for the sum ad carry are give as follows: sum = x y carry = x ^ y Figure 3.9 shows the truth table ad logic circuit diagram of a half adder. Whe we add two multi-bit umbers, the half adder has little practical value. All but LSB colums eed to cosider the carry from the ext least sigificat positio i additio to the two bits from the operads. Oly the LSB ca be added with a half adder. The Full Adder A full adder adds three oe-bit biary umbers x, y, ad a carry (c i ). It has two outputs: sum ad carry (c out ). The Boolea fuctios for the sum ad carry are give as follows: sum = (x y) c i carry = (x ^ y) _ (c i ^ (x y)) Two half adders ca be combied with a OR gate to make a full adder. The oe-bit full adder s truth table ad logic diagram are show i Figure 3.. We ca implemet a -bit biary adder by cascadig full adders. The carry output c out of the full adder at the ext least sigificat positio is coected to the carry iput c i of the curret full adder. We call this type of -bit adder as a ripple carry adder because each carry ripples to the ext full adder. The -bit ripple carry adder adds two -bit biary umbers X ad Y. The outputs are sum ad carry (c ) from the MSB. Figure 3. shows the logic diagram of a -bit ripple-carry-adder. I the worst case, the carry propagates from the LSB through the MSB. Gate delay (also kow as propagatio delay) is the time delay betwee the chages whe a iput chage causes a output chage. The ripple carry adder requires oe propagatio delay time for each bit positio of the operads. Thus, it is ot appropriate for high speed computig systems. The overflow detectio logic for two s complemet additio is also show i Figure 3.. Whe addig two two s complemet biary umbers, as metioed before i Chapter 2, detectig overflow is doe by comparig the carry out of the MSB with the carry ito the MSB: Overflow = c c

Computer Systems - HS

Computer Systems - HS What have we leared so far? Computer Systems High Level ENGG1203 2d Semester, 2017-18 Applicatios Sigals Systems & Cotrol Systems Computer & Embedded Systems Digital Logic Combiatioal Logic Sequetial Logic

More information

CSC 220: Computer Organization Unit 11 Basic Computer Organization and Design

CSC 220: Computer Organization Unit 11 Basic Computer Organization and Design College of Computer ad Iformatio Scieces Departmet of Computer Sciece CSC 220: Computer Orgaizatio Uit 11 Basic Computer Orgaizatio ad Desig 1 For the rest of the semester, we ll focus o computer architecture:

More information

Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Pytho Programmig: A Itroductio to Computer Sciece Chapter 1 Computers ad Programs 1 Objectives To uderstad the respective roles of hardware ad software i a computig system. To lear what computer scietists

More information

Elementary Educational Computer

Elementary Educational Computer Chapter 5 Elemetary Educatioal Computer. Geeral structure of the Elemetary Educatioal Computer (EEC) The EEC coforms to the 5 uits structure defied by vo Neuma's model (.) All uits are preseted i a simplified

More information

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig

More information

BOOLEAN MATHEMATICS: GENERAL THEORY

BOOLEAN MATHEMATICS: GENERAL THEORY CHAPTER 3 BOOLEAN MATHEMATICS: GENERAL THEORY 3.1 ISOMORPHIC PROPERTIES The ame Boolea Arithmetic was chose because it was discovered that literal Boolea Algebra could have a isomorphic umerical aspect.

More information

Chapter 3. Floating Point Arithmetic

Chapter 3. Floating Point Arithmetic COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter 3 Floatig Poit Arithmetic Review - Multiplicatio 0 1 1 0 = 6 multiplicad 32-bit ALU shift product right multiplier add

More information

Appendix D. Controller Implementation

Appendix D. Controller Implementation COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Appedix D Cotroller Implemetatio Cotroller Implemetatios Combiatioal logic (sigle-cycle); Fiite state machie (multi-cycle, pipelied);

More information

EE260: Digital Design, Spring /16/18. n Example: m 0 (=x 1 x 2 ) is adjacent to m 1 (=x 1 x 2 ) and m 2 (=x 1 x 2 ) but NOT m 3 (=x 1 x 2 )

EE260: Digital Design, Spring /16/18. n Example: m 0 (=x 1 x 2 ) is adjacent to m 1 (=x 1 x 2 ) and m 2 (=x 1 x 2 ) but NOT m 3 (=x 1 x 2 ) EE26: Digital Desig, Sprig 28 3/6/8 EE 26: Itroductio to Digital Desig Combiatioal Datapath Yao Zheg Departmet of Electrical Egieerig Uiversity of Hawaiʻi at Māoa Combiatioal Logic Blocks Multiplexer Ecoders/Decoders

More information

Behavioral Modeling in Verilog

Behavioral Modeling in Verilog Behavioral Modelig i Verilog COE 202 Digital Logic Desig Dr. Muhamed Mudawar Kig Fahd Uiversity of Petroleum ad Mierals Presetatio Outlie Itroductio to Dataflow ad Behavioral Modelig Verilog Operators

More information

Chapter 3 Classification of FFT Processor Algorithms

Chapter 3 Classification of FFT Processor Algorithms Chapter Classificatio of FFT Processor Algorithms The computatioal complexity of the Discrete Fourier trasform (DFT) is very high. It requires () 2 complex multiplicatios ad () complex additios [5]. As

More information

Lecture 1: Introduction and Strassen s Algorithm

Lecture 1: Introduction and Strassen s Algorithm 5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access

More information

Abstract. Chapter 4 Computation. Overview 8/13/18. Bjarne Stroustrup Note:

Abstract. Chapter 4 Computation. Overview 8/13/18. Bjarne Stroustrup   Note: Chapter 4 Computatio Bjare Stroustrup www.stroustrup.com/programmig Abstract Today, I ll preset the basics of computatio. I particular, we ll discuss expressios, how to iterate over a series of values

More information

Computers and Scientific Thinking

Computers and Scientific Thinking Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput

More information

Chapter 2. C++ Basics. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 2. C++ Basics. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 2 C++ Basics Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 2.1 Variables ad Assigmets 2.2 Iput ad Output 2.3 Data Types ad Expressios 2.4 Simple Flow of Cotrol 2.5 Program

More information

Fast Fourier Transform (FFT) Algorithms

Fast Fourier Transform (FFT) Algorithms Fast Fourier Trasform FFT Algorithms Relatio to the z-trasform elsewhere, ozero, z x z X x [ ] 2 ~ elsewhere,, ~ e j x X x x π j e z z X X π 2 ~ The DFS X represets evely spaced samples of the z- trasform

More information

9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence

9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence _9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to

More information

Fundamentals of. Chapter 1. Microprocessor and Microcontroller. Dr. Farid Farahmand. Updated: Tuesday, January 16, 2018

Fundamentals of. Chapter 1. Microprocessor and Microcontroller. Dr. Farid Farahmand. Updated: Tuesday, January 16, 2018 Fudametals of Chapter 1 Microprocessor ad Microcotroller Dr. Farid Farahmad Updated: Tuesday, Jauary 16, 2018 Evolutio First came trasistors Itegrated circuits SSI (Small-Scale Itegratio) to ULSI Very

More information

CS 11 C track: lecture 1

CS 11 C track: lecture 1 CS 11 C track: lecture 1 Prelimiaries Need a CMS cluster accout http://acctreq.cms.caltech.edu/cgi-bi/request.cgi Need to kow UNIX IMSS tutorial liked from track home page Track home page: http://courses.cms.caltech.edu/courses/cs11/material

More information

Chapter 4 The Datapath

Chapter 4 The Datapath The Ageda Chapter 4 The Datapath Based o slides McGraw-Hill Additioal material 24/25/26 Lewis/Marti Additioal material 28 Roth Additioal material 2 Taylor Additioal material 2 Farmer Tae the elemets that

More information

Number Systems CHAPTER Positional Number Systems

Number Systems CHAPTER Positional Number Systems CHAPTER 2 Number Systems Inside computers, information is encoded as patterns of bits because it is easy to construct electronic circuits that exhibit the two alternative states, 0 and 1. The meaning of

More information

Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Pytho Programmig: A Itroductio to Computer Sciece Chapter 6 Defiig Fuctios Pytho Programmig, 2/e 1 Objectives To uderstad why programmers divide programs up ito sets of cooperatig fuctios. To be able to

More information

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 13 Control and Sequencing: Hardwired and Microprogrammed Control

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 13 Control and Sequencing: Hardwired and Microprogrammed Control EE 459/500 HDL Based Digital Desig with Programmable Logic Lecture 13 Cotrol ad Sequecig: Hardwired ad Microprogrammed Cotrol Refereces: Chapter s 4,5 from textbook Chapter 7 of M.M. Mao ad C.R. Kime,

More information

Reversible Realization of Quaternary Decoder, Multiplexer, and Demultiplexer Circuits

Reversible Realization of Quaternary Decoder, Multiplexer, and Demultiplexer Circuits Egieerig Letters, :, EL Reversible Realizatio of Quaterary Decoder, Multiplexer, ad Demultiplexer Circuits Mozammel H.. Kha, Member, ENG bstract quaterary reversible circuit is more compact tha the correspodig

More information

Forms of Information Representation in Digital Computers.

Forms of Information Representation in Digital Computers. Chapter Forms of Iformatio Represetatio i Digital Computers.. Geeral Cosideratios There are distiguished the followig two fudametal modes of iformatio represetatio: (.) a) iteral; b) exteral; Iteral represetatios

More information

Chapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 4 Procedural Abstractio ad Fuctios That Retur a Value Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 4.1 Top-Dow Desig 4.2 Predefied Fuctios 4.3 Programmer-Defied Fuctios 4.4

More information

EE123 Digital Signal Processing

EE123 Digital Signal Processing Last Time EE Digital Sigal Processig Lecture 7 Block Covolutio, Overlap ad Add, FFT Discrete Fourier Trasform Properties of the Liear covolutio through circular Today Liear covolutio with Overlap ad add

More information

APPLICATION NOTE PACE1750AE BUILT-IN FUNCTIONS

APPLICATION NOTE PACE1750AE BUILT-IN FUNCTIONS APPLICATION NOTE PACE175AE BUILT-IN UNCTIONS About This Note This applicatio brief is iteded to explai ad demostrate the use of the special fuctios that are built ito the PACE175AE processor. These powerful

More information

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 4. The Processor. Part A Datapath Design

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 4. The Processor. Part A Datapath Design COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter The Processor Part A path Desig Itroductio CPU performace factors Istructio cout Determied by ISA ad compiler. CPI ad

More information

EE University of Minnesota. Midterm Exam #1. Prof. Matthew O'Keefe TA: Eric Seppanen. Department of Electrical and Computer Engineering

EE University of Minnesota. Midterm Exam #1. Prof. Matthew O'Keefe TA: Eric Seppanen. Department of Electrical and Computer Engineering EE 4363 1 Uiversity of Miesota Midterm Exam #1 Prof. Matthew O'Keefe TA: Eric Seppae Departmet of Electrical ad Computer Egieerig Uiversity of Miesota Twi Cities Campus EE 4363 Itroductio to Microprocessors

More information

Ones Assignment Method for Solving Traveling Salesman Problem

Ones Assignment Method for Solving Traveling Salesman Problem Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:

More information

Math 10C Long Range Plans

Math 10C Long Range Plans Math 10C Log Rage Plas Uits: Evaluatio: Homework, projects ad assigmets 10% Uit Tests. 70% Fial Examiatio.. 20% Ay Uit Test may be rewritte for a higher mark. If the retest mark is higher, that mark will

More information

Pseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance

Pseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured

More information

End Semester Examination CSE, III Yr. (I Sem), 30002: Computer Organization

End Semester Examination CSE, III Yr. (I Sem), 30002: Computer Organization Ed Semester Examiatio 2013-14 CSE, III Yr. (I Sem), 30002: Computer Orgaizatio Istructios: GROUP -A 1. Write the questio paper group (A, B, C, D), o frot page top of aswer book, as per what is metioed

More information

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 19 Query Optimizatio Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio Query optimizatio Coducted by a query optimizer i a DBMS Goal:

More information

Introduction to Computing Systems: From Bits and Gates to C and Beyond 2 nd Edition

Introduction to Computing Systems: From Bits and Gates to C and Beyond 2 nd Edition Lecture Goals Itroductio to Computig Systems: From Bits ad Gates to C ad Beyod 2 d Editio Yale N. Patt Sajay J. Patel Origial slides from Gregory Byrd, North Carolia State Uiversity Modified slides by

More information

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.

More information

Analysis of Algorithms

Analysis of Algorithms Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The

More information

. Written in factored form it is easy to see that the roots are 2, 2, i,

. Written in factored form it is easy to see that the roots are 2, 2, i, CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or

More information

Data Structures and Algorithms. Analysis of Algorithms

Data Structures and Algorithms. Analysis of Algorithms Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output

More information

Alpha Individual Solutions MAΘ National Convention 2013

Alpha Individual Solutions MAΘ National Convention 2013 Alpha Idividual Solutios MAΘ Natioal Covetio 0 Aswers:. D. A. C 4. D 5. C 6. B 7. A 8. C 9. D 0. B. B. A. D 4. C 5. A 6. C 7. B 8. A 9. A 0. C. E. B. D 4. C 5. A 6. D 7. B 8. C 9. D 0. B TB. 570 TB. 5

More information

Chapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 5 Fuctios for All Subtasks Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 5.1 void Fuctios 5.2 Call-By-Referece Parameters 5.3 Usig Procedural Abstractio 5.4 Testig ad Debuggig

More information

Analysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis

Analysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis Itro to Algorithm Aalysis Aalysis Metrics Slides. Table of Cotets. Aalysis Metrics 3. Exact Aalysis Rules 4. Simple Summatio 5. Summatio Formulas 6. Order of Magitude 7. Big-O otatio 8. Big-O Theorems

More information

South Slave Divisional Education Council. Math 10C

South Slave Divisional Education Council. Math 10C South Slave Divisioal Educatio Coucil Math 10C Curriculum Package February 2012 12 Strad: Measuremet Geeral Outcome: Develop spatial sese ad proportioal reasoig It is expected that studets will: 1. Solve

More information

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen COP4020 Programmig Laguages Fuctioal Programmig Prof. Robert va Egele Overview What is fuctioal programmig? Historical origis of fuctioal programmig Fuctioal programmig today Cocepts of fuctioal programmig

More information

COP4020 Programming Languages. Compilers and Interpreters Prof. Robert van Engelen

COP4020 Programming Languages. Compilers and Interpreters Prof. Robert van Engelen COP4020 mig Laguages Compilers ad Iterpreters Prof. Robert va Egele Overview Commo compiler ad iterpreter cofiguratios Virtual machies Itegrated developmet eviromets Compiler phases Lexical aalysis Sytax

More information

Data diverse software fault tolerance techniques

Data diverse software fault tolerance techniques Data diverse software fault tolerace techiques Complemets desig diversity by compesatig for desig diversity s s limitatios Ivolves obtaiig a related set of poits i the program data space, executig the

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 18 Strategies for Query Processig Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio DBMS techiques to process a query Scaer idetifies

More information

COMP Parallel Computing. PRAM (1): The PRAM model and complexity measures

COMP Parallel Computing. PRAM (1): The PRAM model and complexity measures COMP 633 - Parallel Computig Lecture 2 August 24, 2017 : The PRAM model ad complexity measures 1 First class summary This course is about parallel computig to achieve high-er performace o idividual problems

More information

A SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON

A SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON A SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON Roberto Lopez ad Eugeio Oñate Iteratioal Ceter for Numerical Methods i Egieerig (CIMNE) Edificio C1, Gra Capitá s/, 08034 Barceloa, Spai ABSTRACT I this work

More information

How do we evaluate algorithms?

How do we evaluate algorithms? F2 Readig referece: chapter 2 + slides Algorithm complexity Big O ad big Ω To calculate ruig time Aalysis of recursive Algorithms Next time: Litterature: slides mostly The first Algorithm desig methods:

More information

Lecture 5. Counting Sort / Radix Sort

Lecture 5. Counting Sort / Radix Sort Lecture 5. Coutig Sort / Radix Sort T. H. Corme, C. E. Leiserso ad R. L. Rivest Itroductio to Algorithms, 3rd Editio, MIT Press, 2009 Sugkyukwa Uiversity Hyuseug Choo choo@skku.edu Copyright 2000-2018

More information

UNIVERSITY OF MORATUWA

UNIVERSITY OF MORATUWA UNIVERSITY OF MORATUWA FACULTY OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING B.Sc. Egieerig 2014 Itake Semester 2 Examiatio CS2052 COMPUTER ARCHITECTURE Time allowed: 2 Hours Jauary 2016

More information

CS : Programming for Non-Majors, Summer 2007 Programming Project #3: Two Little Calculations Due by 12:00pm (noon) Wednesday June

CS : Programming for Non-Majors, Summer 2007 Programming Project #3: Two Little Calculations Due by 12:00pm (noon) Wednesday June CS 1313 010: Programmig for No-Majors, Summer 2007 Programmig Project #3: Two Little Calculatios Due by 12:00pm (oo) Wedesday Jue 27 2007 This third assigmet will give you experiece writig programs that

More information

Lecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming

Lecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis

More information

Today s objectives. CSE401: Introduction to Compiler Construction. What is a compiler? Administrative Details. Why study compilers?

Today s objectives. CSE401: Introduction to Compiler Construction. What is a compiler? Administrative Details. Why study compilers? CSE401: Itroductio to Compiler Costructio Larry Ruzzo Sprig 2004 Today s objectives Admiistrative details Defie compilers ad why we study them Defie the high-level structure of compilers Associate specific

More information

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19 CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.

More information

Improvement of the Orthogonal Code Convolution Capabilities Using FPGA Implementation

Improvement of the Orthogonal Code Convolution Capabilities Using FPGA Implementation Improvemet of the Orthogoal Code Covolutio Capabilities Usig FPGA Implemetatio Naima Kaabouch, Member, IEEE, Apara Dhirde, Member, IEEE, Saleh Faruque, Member, IEEE Departmet of Electrical Egieerig, Uiversity

More information

A New Morphological 3D Shape Decomposition: Grayscale Interframe Interpolation Method

A New Morphological 3D Shape Decomposition: Grayscale Interframe Interpolation Method A ew Morphological 3D Shape Decompositio: Grayscale Iterframe Iterpolatio Method D.. Vizireau Politehica Uiversity Bucharest, Romaia ae@comm.pub.ro R. M. Udrea Politehica Uiversity Bucharest, Romaia mihea@comm.pub.ro

More information

What are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs

What are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs What are we goig to lear? CSC316-003 Data Structures Aalysis of Algorithms Computer Sciece North Carolia State Uiversity Need to say that some algorithms are better tha others Criteria for evaluatio Structure

More information

Octahedral Graph Scaling

Octahedral Graph Scaling Octahedral Graph Scalig Peter Russell Jauary 1, 2015 Abstract There is presetly o strog iterpretatio for the otio of -vertex graph scalig. This paper presets a ew defiitio for the term i the cotext of

More information

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4

More information

Digital System Design

Digital System Design July, 22 9:55 vra235_ch Sheet umber Page umber 65 black chapter Digital System Desig a b c d e f g h 8 7 6 5 4 3 2. Bd3 g6+, Ke8 d8 65 July, 22 9:55 vra235_ch Sheet umber 2 Page umber 66 black 66 CHAPTER

More information

Creating Exact Bezier Representations of CST Shapes. David D. Marshall. California Polytechnic State University, San Luis Obispo, CA , USA

Creating Exact Bezier Representations of CST Shapes. David D. Marshall. California Polytechnic State University, San Luis Obispo, CA , USA Creatig Exact Bezier Represetatios of CST Shapes David D. Marshall Califoria Polytechic State Uiversity, Sa Luis Obispo, CA 93407-035, USA The paper presets a method of expressig CST shapes pioeered by

More information

GE FUNDAMENTALS OF COMPUTING AND PROGRAMMING UNIT III

GE FUNDAMENTALS OF COMPUTING AND PROGRAMMING UNIT III GE2112 - FUNDAMENTALS OF COMPUTING AND PROGRAMMING UNIT III PROBLEM SOLVING AND OFFICE APPLICATION SOFTWARE Plaig the Computer Program Purpose Algorithm Flow Charts Pseudocode -Applicatio Software Packages-

More information

MOTIF XF Extension Owner s Manual

MOTIF XF Extension Owner s Manual MOTIF XF Extesio Ower s Maual Table of Cotets About MOTIF XF Extesio...2 What Extesio ca do...2 Auto settig of Audio Driver... 2 Auto settigs of Remote Device... 2 Project templates with Iput/ Output Bus

More information

Analysis of Algorithms

Analysis of Algorithms Aalysis of Algorithms Ruig Time of a algorithm Ruig Time Upper Bouds Lower Bouds Examples Mathematical facts Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite

More information

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015. Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Hash Tables xkcd. http://xkcd.com/221/. Radom Number. Used with permissio uder Creative

More information

CMPT 125 Assignment 2 Solutions

CMPT 125 Assignment 2 Solutions CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address

More information

1.2 Binomial Coefficients and Subsets

1.2 Binomial Coefficients and Subsets 1.2. BINOMIAL COEFFICIENTS AND SUBSETS 13 1.2 Biomial Coefficiets ad Subsets 1.2-1 The loop below is part of a program to determie the umber of triagles formed by poits i the plae. for i =1 to for j =

More information

Computer Graphics Hardware An Overview

Computer Graphics Hardware An Overview Computer Graphics Hardware A Overview Graphics System Moitor Iput devices CPU/Memory GPU Raster Graphics System Raster: A array of picture elemets Based o raster-sca TV techology The scree (ad a picture)

More information

Task scenarios Outline. Scenarios in Knowledge Extraction. Proposed Framework for Scenario to Design Diagram Transformation

Task scenarios Outline. Scenarios in Knowledge Extraction. Proposed Framework for Scenario to Design Diagram Transformation 6-0-0 Kowledge Trasformatio from Task Scearios to View-based Desig Diagrams Nima Dezhkam Kamra Sartipi {dezhka, sartipi}@mcmaster.ca Departmet of Computig ad Software McMaster Uiversity CANADA SEKE 08

More information

Solutions to Final COMS W4115 Programming Languages and Translators Monday, May 4, :10-5:25pm, 309 Havemeyer

Solutions to Final COMS W4115 Programming Languages and Translators Monday, May 4, :10-5:25pm, 309 Havemeyer Departmet of Computer ciece Columbia Uiversity olutios to Fial COM W45 Programmig Laguages ad Traslators Moday, May 4, 2009 4:0-5:25pm, 309 Havemeyer Closed book, o aids. Do questios 5. Each questio is

More information

CSE 305. Computer Architecture

CSE 305. Computer Architecture CSE 305 Computer Architecture Computer Architecture Course Teachers Rifat Shahriyar (rifat1816@gmail.com) Johra Muhammad Moosa Textbook Computer Orgaizatio ad Desig (The Hardware/Software Iterface) David

More information

1. SWITCHING FUNDAMENTALS

1. SWITCHING FUNDAMENTALS . SWITCING FUNDMENTLS Switchig is the provisio of a o-demad coectio betwee two ed poits. Two distict switchig techiques are employed i commuicatio etwors-- circuit switchig ad pacet switchig. Circuit switchig

More information

top() Applications of Stacks

top() Applications of Stacks CS22 Algorithms ad Data Structures MW :00 am - 2: pm, MSEC 0 Istructor: Xiao Qi Lecture 6: Stacks ad Queues Aoucemets Quiz results Homework 2 is available Due o September 29 th, 2004 www.cs.mt.edu~xqicoursescs22

More information

CMSC Computer Architecture Lecture 12: Virtual Memory. Prof. Yanjing Li University of Chicago

CMSC Computer Architecture Lecture 12: Virtual Memory. Prof. Yanjing Li University of Chicago CMSC 22200 Computer Architecture Lecture 12: Virtual Memory Prof. Yajig Li Uiversity of Chicago A System with Physical Memory Oly Examples: most Cray machies early PCs Memory early all embedded systems

More information

Lesson 1. The datapath

Lesson 1. The datapath Lesso. Computers Structure ad Orgaizatio Graduate i Computer Scieces / Graduate i Computers Egieerig Computers Structure ad Orgaizatio. Graduate i Computer Scieces / Graduate i Computer Egieerig Automatic

More information

Baan Tools User Management

Baan Tools User Management Baa Tools User Maagemet Module Procedure UP008A US Documetiformatio Documet Documet code : UP008A US Documet group : User Documetatio Documet title : User Maagemet Applicatio/Package : Baa Tools Editio

More information

Improving Information Retrieval System Security via an Optimal Maximal Coding Scheme

Improving Information Retrieval System Security via an Optimal Maximal Coding Scheme Improvig Iformatio Retrieval System Security via a Optimal Maximal Codig Scheme Dogyag Log Departmet of Computer Sciece, City Uiversity of Hog Kog, 8 Tat Chee Aveue Kowloo, Hog Kog SAR, PRC dylog@cs.cityu.edu.hk

More information

Lecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions

Lecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions U.C. Berkeley CS170 : Algorithms Midterm 1 Solutios Lecturers: Sajam Garg ad Prasad Raghavedra Feb 1, 017 Midterm 1 Solutios 1. (4 poits) For the directed graph below, fid all the strogly coected compoets

More information

Computer Architecture. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

Computer Architecture. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff Computer rchitecture Microcomputer rchitecture ad Iterfacig Colorado School of Mies Professor William Hoff Computer Hardware Orgaizatio Processor Performs all computatios; coordiates data trasfer Iput

More information

CMSC Computer Architecture Lecture 3: ISA and Introduction to Microarchitecture. Prof. Yanjing Li University of Chicago

CMSC Computer Architecture Lecture 3: ISA and Introduction to Microarchitecture. Prof. Yanjing Li University of Chicago CMSC 22200 Computer Architecture Lecture 3: ISA ad Itroductio to Microarchitecture Prof. Yajig Li Uiversity of Chicago Lecture Outlie ISA uarch (hardware implemetatio of a ISA) Logic desig basics Sigle-cycle

More information

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1 COSC 1P03 Ch 7 Recursio Itroductio to Data Structures 8.1 COSC 1P03 Recursio Recursio I Mathematics factorial Fiboacci umbers defie ifiite set with fiite defiitio I Computer Sciece sytax rules fiite defiitio,

More information

Structuring Redundancy for Fault Tolerance. CSE 598D: Fault Tolerant Software

Structuring Redundancy for Fault Tolerance. CSE 598D: Fault Tolerant Software Structurig Redudacy for Fault Tolerace CSE 598D: Fault Tolerat Software What do we wat to achieve? Versios Damage Assessmet Versio 1 Error Detectio Iputs Versio 2 Voter Outputs State Restoratio Cotiued

More information

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3

More information

Τεχνολογία Λογισμικού

Τεχνολογία Λογισμικού ΕΘΝΙΚΟ ΜΕΤΣΟΒΙΟ ΠΟΛΥΤΕΧΝΕΙΟ Σχολή Ηλεκτρολόγων Μηχανικών και Μηχανικών Υπολογιστών Τεχνολογία Λογισμικού, 7ο/9ο εξάμηνο 2018-2019 Τεχνολογία Λογισμικού Ν.Παπασπύρου, Αν.Καθ. ΣΗΜΜΥ, ickie@softlab.tua,gr

More information

Polynomial Functions and Models. Learning Objectives. Polynomials. P (x) = a n x n + a n 1 x n a 1 x + a 0, a n 0

Polynomial Functions and Models. Learning Objectives. Polynomials. P (x) = a n x n + a n 1 x n a 1 x + a 0, a n 0 Polyomial Fuctios ad Models 1 Learig Objectives 1. Idetify polyomial fuctios ad their degree 2. Graph polyomial fuctios usig trasformatios 3. Idetify the real zeros of a polyomial fuctio ad their multiplicity

More information

FPGA IMPLEMENTATION OF BASE-N LOGARITHM. Salvador E. Tropea

FPGA IMPLEMENTATION OF BASE-N LOGARITHM. Salvador E. Tropea FPGA IMPLEMENTATION OF BASE-N LOGARITHM Salvador E. Tropea Electróica e Iformática Istituto Nacioal de Tecología Idustrial Bueos Aires, Argetia email: salvador@iti.gov.ar ABSTRACT I this work, we preset

More information

Appendix A. Use of Operators in ARPS

Appendix A. Use of Operators in ARPS A Appedix A. Use of Operators i ARPS The methodology for solvig the equatios of hydrodyamics i either differetial or itegral form usig grid-poit techiques (fiite differece, fiite volume, fiite elemet)

More information

CIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8)

CIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8) CIS 11 Data Structures ad Algorithms with Java Fall 017 Big-Oh Notatio Tuesday, September 5 (Make-up Friday, September 8) Learig Goals Review Big-Oh ad lear big/small omega/theta otatios Practice solvig

More information

From last week. Lecture 5. Outline. Principles of programming languages

From last week. Lecture 5. Outline. Principles of programming languages Priciples of programmig laguages From last week Lecture 5 http://few.vu.l/~silvis/ppl/2007 Natalia Silvis-Cividjia e-mail: silvis@few.vu.l ML has o assigmet. Explai how to access a old bidig? Is & for

More information

The Magma Database file formats

The Magma Database file formats The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,

More information

A Generalized Set Theoretic Approach for Time and Space Complexity Analysis of Algorithms and Functions

A Generalized Set Theoretic Approach for Time and Space Complexity Analysis of Algorithms and Functions Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, 2006 316 A Geeralized Set Theoretic Approach for Time ad Space Complexity Aalysis of Algorithms

More information

Lecture 2. RTL Design Methodology. Transition from Pseudocode & Interface to a Corresponding Block Diagram

Lecture 2. RTL Design Methodology. Transition from Pseudocode & Interface to a Corresponding Block Diagram Lecture 2 RTL Desig Methodology Trasitio from Pseudocode & Iterface to a Correspodig Block Diagram Structure of a Typical Digital Data Iputs Datapath (Executio Uit) Data Outputs System Cotrol Sigals Status

More information

BOOLEAN DIFFERENTIATION EQUATIONS APPLICABLE IN RECONFIGURABLE COMPUTATIONAL MEDIUM

BOOLEAN DIFFERENTIATION EQUATIONS APPLICABLE IN RECONFIGURABLE COMPUTATIONAL MEDIUM MATEC Web of Cofereces 79, 01014 (016) DOI: 10.1051/ mateccof/0167901014 T 016 BOOLEAN DIFFERENTIATION EQUATIONS APPLICABLE IN RECONFIGURABLE COMPUTATIONAL MEDIUM Staislav Shidlovskiy 1, 1 Natioal Research

More information

WYSE Academic Challenge Sectional Computer Science 2005 SOLUTION SET

WYSE Academic Challenge Sectional Computer Science 2005 SOLUTION SET WYSE Academic Challege Sectioal Computer Sciece 2005 SOLUTION SET 1. Correct aswer: a. Hz = cycle / secod. CPI = 2, therefore, CPI*I = 2 * 28 X 10 8 istructios = 56 X 10 8 cycles. The clock rate is 56

More information

Name of the Student: Unit I (Logic and Proofs) 1) Truth Table: Conjunction Disjunction Conditional Biconditional

Name of the Student: Unit I (Logic and Proofs) 1) Truth Table: Conjunction Disjunction Conditional Biconditional SUBJECT NAME : Discrete Mathematics SUBJECT CODE : MA 2265 MATERIAL NAME : Formula Material MATERIAL CODE : JM08ADM009 (Sca the above QR code for the direct dowload of this material) Name of the Studet:

More information

Sorting in Linear Time. Data Structures and Algorithms Andrei Bulatov

Sorting in Linear Time. Data Structures and Algorithms Andrei Bulatov Sortig i Liear Time Data Structures ad Algorithms Adrei Bulatov Algorithms Sortig i Liear Time 7-2 Compariso Sorts The oly test that all the algorithms we have cosidered so far is compariso The oly iformatio

More information