1 / 23

Digital Computers and Information

Digital Computers and Information. Digital computers Number representations Arithmetic operations Alphanumeric codes. Read MK 3-26. Network Interface. Graphics Card. Disk Controller. monitor. Peripheral Bus Interface. microprocessor. Main Memory. keyboard. FPU. MMU. External

karan
Télécharger la présentation

Digital Computers and Information

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Digital Computers and Information Digital computers Number representations Arithmetic operations Alphanumeric codes Read MK 3-26

  2. NetworkInterface GraphicsCard DiskController monitor PeripheralBus Interface microprocessor MainMemory keyboard FPU MMU External Cache CPU InternalCache What’s in a Computer? • Microprocessor • Central Processing Unit • Floating Point Unit • Memory Mgmt. Unit • Internal Cache Memory • Main Memory • stores running programs and associated data • typically 64-512 Mbytes • Dynamic RAM

  3. NetworkInterface GraphicsCard DiskController monitor PeripheralBus Interface microprocessor MainMemory keyboard FPU MMU External Cache CPU InternalCache What’s in a Computer? Control movement of data between memory and I/O devices • External Cache • small, fast memory • stores recently used data Memory Bus

  4. NetworkInterface GraphicsCard DiskController monitor PeripheralBus Interface microprocessor MainMemory keyboard FPU MMU External Cache CPU Internalcache What’s in a Computer? Transfer data between external network & memory Peripheral Bus Read/write data on proper physical location on disk Convert text & graphics to video

  5. Intel 80286 Microprocessor(www.micro.magnet.fsu.edu/chipshots) NEC/MIPS R4400 Microprocessor(www.micro.magnet.fsu.edu/chipshots) What’s in a Chip? • Photomicrographs made using colored filters.

  6. Processor Memory Address 0123...ffff PC 10 50 AddressDecode 11 ACC 21 read/write InstructionDecoder Arithmetic& Logic Unit -3 65 Data 56 Basic Processor & Memory • Memory stores programs and data. • organized as set of numbered storage slots • each storage slot (memory word) can hold a number • processor can read from or write to any word • Fetch & execute cycle • read word whose address is in Program Counter (PC) and increment PC • interpret stored value as instruction (decoding) • perform instruction using Accumulator (ACC) and Arithmetic & Logic Unit (ALU)

  7. Instruction Set 0000halt- halt execution 0001negate-ACC := -ACC 1xxximmediate load– if sign bit of xxx is 0 then ACC := 0xxx else ACC := fxxx 2xxxdirect load-ACC := M[0xxx] 3xxx indirect load-ACC := M[M[0xxx]] 4xxx direct store-M[0xxx] := ACC 5xxx indirect store –M[M[0xxx]] := ACC 6xxx branch - PC := 0xxx 7xxx branch if zero - if ACC = 0 then PC := 0xxx 8xxx branch if positive - if ACC > 0 then PC := 0xxx 9xxx branch if negative - if ACC < 0 then PC := 0xxx axxx add-ACC := ACC + M[0xxx]

  8. Simple Program Address InstructionComment 0000 (start)1000 (ACC := 0000) initialize sum 0001 4010 (M[0010] := ACC) 0002 1020 (ACC := 0020) initialize pointer 0003 4011 (M[0011] := ACC) 0004 (loop) 1030 (ACC := 0030) if pointer = 030, quit 0005 0001 (ACC := -ACC) 0006 a011 (ACC :=ACC+M[0011]) 0007 700f (if 0 goto 000f) 0008 3011 (M[M[0011]] := ACC) sum = sum + *pointer 0009 a010 (ACC :=ACC+M[0010]) 000a 4010 (M[0010] := ACC) 000b 1001 (ACC := 0001) pointer = pointer + 1 000c a011 (ACC :=ACC+M[0011]) 000d 4011 (M[011] := ACC) 000e 6004 (goto 0004) goto loop 000f (end) 0000 (halt) halt 0010 Store sum here 0011 Pointer to next value • Add the values in locations 20-2f and write sum in 10.

  9. Representing Information in Computers • Electronic computers represent information as voltage levels. • To make the computer hardware simple and reliable, computers represent information in binary form. • example: voltages greater than 3V are interpreted as representing one value (called “1”), voltages less than 2V are interpreted as representing another value (called “0”). • In principle, could use more voltage levels. • example: 0 to .75V represents “0”, 1 to 1.75V represents “1”, 2 to 2.75V represents “2”, and so forth. • In practice, this is rarely done. • requires more complex circuits • circuits are more susceptible to noise, hence less reliable

  10. 5v 4v 3v 2v 1v 0v Undefined High Undefined High Low Low noise margin 3 V noise margin 1 V Noise in Computer Systems • Computers, like all electronic systems, are affected by noise. • noise has various sources (nearby signal changes, thermal vibrations of molecules in semiconductor materials, . . . ) • in computers, noise can cause binary signals to be misinterpreted • The noise margin is the amountof noise that a system cantolerate and still correctlyidentify a logic high or low.

  11. Number Representation • Standard decimal number representation 243.83 = 2´102 + 4´101 + 3´100 + 8´10-1 + 3´10-2 • Generalization to base r An. . .A1A0.A-1. . .A-m =An´rn + . . . + A1´r1 +A0´r0 + A-1´r-1 + . . . + A-m´r-m • Binary number representation 110.01 = 1´22 + 1´21 + 0´20 + 0´2-1 + 1´2-2 • Converting binary numbers to decimal (easy). write binary expansion, replace powers of 2 with decimal values, and add up the values 110.01 = 1´22 + 1´21 + 0´20 + 0´2-1 + 1´2-2 = 4 + 2 + 1/4 = 6.25 Note: it helps to know your powers of 2 (hint)

  12. Decimal-Binary Conversion • Repeated division by 2 625/2 = 312 with remainder of 1 least significant bit 312/2 = 156 with remainder of 0 156/2 = 78 with remainder of 0 78/2 = 39 with remainder of 0 39/2 = 19 with remainder of 1 19/2 = 9 with remainder of 1 9/2 = 4 with remainder of 1 4/2 = 2 with remainder of 0 2/2 = 1 with remainder of 0 1/2 = 0 with remainder of 1 So, (625)10 = (10 0111 0001)2 • Works similarly for other number bases.

  13. Octal and Hexadecimal • Octal (base 8) and hexadecimal (base 16) provide more convenient way for people to write binary numbers. • 110101100010 = 110 101 100 010 = (6542)8 1101 0110 0010 = (d62)16 octal conversionhexadecimal conversion 000 = 0 0000 = 0 1000 = 8 001 = 1 0001 = 1 1001 = 9 010 = 2 0010 = 2 1010 = 10 = a 011 = 3 0011 = 3 1011 = 11 = b 100 = 4 0100 = 4 1100 = 12 = c 101 = 5 0101 = 5 1101 = 13 = d 110 = 6 0110 = 6 1110 = 14 = e 111 = 7 0111 = 7 1111 = 15 = f

  14. Finite Data Representations • Computer hardware is generally designed to operate on words with a fixed number of bits (e.g. 16 bits). • Places a limit on the number of discrete values that can be stored in a single word (e.g. 216). • If we use words to represent positive integers then with n bits, we can represent integers 0 up to 2n-1 • Larger integers can be represented by multiple words. • computer hardware operates on single words • software must combine results from single word operations to produce desired result • Or, use floating pointrepresentation for large (and small) values; typically supported by computer hardware.

  15. How Computers Add • Binary long addition similar to decimal long addition. decimalbinary carry 1100 111100 augend 2565 10110 addend 6754 11011 sum 9319 110001 • Binary addition algorithm - add an-1...a0 to bn-1...b0and put result in sn...s0 c0=0 // ci are carry bits for i = 0 to n-1 if one or three of ai, bi or ci are = 1 then si = 1 else si = 0 if at least two of ai, bi or ci are = 1, then ci+1 = 1 else ci+1 = 0 sn = cn

  16. 1111+0011=0010 1111+0011=0010 0000 0000 1111 1111 0001 0001 1110 1110 0010 0010 0 0 1 1 -1 15 2 2 1101 1101 -2 14 0011 0011 3 3 13 -3 1100 1100 0100 0100 4 4 12 -4 5 5 11 -5 1011 1011 0101 0101 10 -6 6 6 9 -7 7 7 -8 8 0110 0110 1010 1010 0011+0110 =1001 0111 0111 1001 1001 1000 1000 Modular and Signed Arithmetic • Computers use modular arithmetic in which values wrap around circularly. • to add A+B, start at position for A and then count clockwise B positions • modular arithmetic is just like “clock arithmetic” • Associating certain bit patterns with negative values yields signed arithmetic. • Negate a given value by flipping all bits and adding 1. • Must pay attention to overflow.

  17. Representing Text • Computers use numbers to represent alphabetic characters, numerals and punctuation. • Most common encoding is ASCII (American Standard Code for Communication Interchange) • characters represented by 7 bit values • numerals start at (30)16 • upper case letters start at (41)16 • lower case letters start at (61)16 • see Table 1-4 in Mano for details • Unicode uses 16 bits per character, allowing it to represent far more distinct characters.

  18. Convert Numeric String to Internal Value Address InstructionComment 0000 (start)1000 (ACC := 0000) result = 0 0001 401f (M[001f] := ACC) 0002 1020 (ACC := 0020) pointer = 020 0003 401d (M[001d] := ACC) 0004 (loop)1025 (ACC := 0025) if pointer = 025, quit 0005 0001 (ACC := -ACC) 0006 a01d (ACC := ACC + M[001d]) 0007 7015 (if 0 goto 0015) 0008 100a (ACC := 000a) result = 10 * result 0009 b01f (ACC := ACC*M[001f]) New multiply inst. 000a 401f (M[001f] := ACC) • ASCII character codes for decimal integer stored in locations 20-24 with M.S.D. at location 20. Write internal value in location 1f.

  19. Convert Numeric String (continued) Address InstructionComment 000b 1fd0 (ACC := -30) result = result 000c 401e (M[001e] := ACC) + (*pointer-‘0’) 000d 301d (ACC := M[M[001d]]) 000ea01e (ACC += ACC+M[001e]) 000f a01f (ACC += ACC+M[001f]) 0010 401f (M[001f] := ACC) 0011 1001 (ACC := 0001) pointer = pointer + 1 0012 a01d (ACC := ACC+M[001d]) 0013 401d (M[001d] := ACC) 0014 6004 (goto 0004) goto loop 0015 (end) 0000 (halt) halt .... 001d Pointer to next char 001e Temporary value 001f Store result here 0020 ASCII digits

  20. Convert Internal Value to Numeric String • Write ASCII character codes for value in location 1f into words 20..24 with L.S.D. in word 20. pointer = 20 loop if pointer = 25 then quit *pointer = (value modulo 10) + ‘0’ value = value / 10 pointer = pointer + 1 goto loop • Exercise: write corresponding machine program; assume two new instructions cxxx divide value in accumulator by value in location xxx and leave quotient in accumulator dxxx divide by value in xxx & put remainder in ACC

  21. Address Bus Memory Controller 0000000100020003000400050006000700080009000affff PC IREG IAR ACC Data Bus ALU read/write . . . Another Look at Basic Computer • Program Counter (PC) stores address of next instruction. • Instruction Register & Decoder (IREG) stores current instruction. • Indirect Address Register (IAR) stores indirect addresses. • Accumulator (ACC) stores arithmetic operands and results. • Arithmetic & Logic Unit (ALU) implements arithmetic functions. • Controller coordinates actions of other components. • Data & Address Buses carry data between components.

  22. Execution of a Computer Program reset(initialization) systemclock program counter,instruction register, accumulator, . . . timeaxis monitoredsignals waveforms& buses

  23. resetperiod execute firstinstruction - mload fetch secondinstruction execute secondinstruction – dload fetch firstinstruction Execution of a Computer Program

More Related