computer systems
play

Computer Systems What the actual bits represent depends on the - PowerPoint PPT Presentation

Binary Representation Information is represented as a sequence of binary digits: Bits Computer Systems What the actual bits represent depends on the context: Numerical value (integer, floating point, fixed point) Sequence of


  1. Binary Representation Information is represented as a sequence of binary digits: Bits ■ Computer Systems What the actual bits represent depends on the context: ■ Numerical value (integer, floating point, fixed point) ❚ Sequence of characters (text) ❚ Seminar 3 Executable instruction ❚ Petru Eles petel@ida.liu.se tf: 281396 Some few slides are based on material from the course book as well as from the book “Computer Systems: A Programmer’s Perspective” by Bryant & O’Hallaron 1 of 87 2 of 87 Binary Representation Logical Computation: Boolean Algebra Information is represented as a sequence of binary digits: Bits ■ And Or Xor Not What the actual bits represent depends on the context: ■ & 0 1 | 0 1 ^ 0 1 ~ 0 0 0 0 0 1 0 0 1 0 1 Numerical value (integer, floating point, fixed point) ❚ 1 0 1 1 1 1 1 1 0 1 0 Sequence of characters (text) ❚ Executable instruction ❚ Depending on the context, operations performed are: ■ Logical computation (context: logic) ❚ 1: true Operations: And, Or, Exclusive-Or (Xor), Not 0: false Numerical Computation (context: numbers) ❚ 1 Operations: Addition, Subtraction, Multiplication, 0 Division 3 of 87 4 of 87

  2. Logical Computation: Boolean Algebra Arithmetical Computation Adding two one bit numbers And Or Xor Not & 0 1 | 0 1 ^ 0 1 ~ 0 0 0 0 0 1 0 0 1 0 1 A B C out Σ 1 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 1 0 1 0 It applies similarly to bit vectors (operations apply bitwise): ■ 1 1 0 1 11100101 11100101 11100101 & 01101101 | 01101101 ^ 01101101 ~ 01101101 01100101 11101101 10001000 10010010 5 of 87 6 of 87 How is this Done in Computers? The Basic Building Block: The Transistor Source Logic values are represented by voltage levels: ■ V out High Voltage (e.g. 3.3V):1 ❚ Low Voltage (e.g. 0V): 0 V in ❚ At the output of a circuit we can have the following signal; this circuit produces the sequence 0, 1, 0 (or false, true, false): V in Source V out H H L L H H H: high voltage level (1, true) L: low voltage level (0, false) 7 of 87 8 of 87

  3. The Basic Building Block: The Transistor Gates for Boolean Operations Gates are electronic devices that perform Boolean operations. Source Observe! ■ This implements logic Not from V in to V out ! Gates are built as small electronic circuits based on transistors; ❚ V out ~ Gates are the basic building blocks out of which VLSI (very Large Scale ❚ 0 1 Integration) circuits are built; today’s computers are implemented as V in 1 0 VLSI circuits, with up to billions of transistors on a chip . In Out In Out In Out In Out Such a circuit is called a Not gate (al- And Or Xor Not so inverter ): V in Source V out In 1 In 2 Out In 1 In 2 Out In 1 In 2 Out In Out H H L 0 0 0 0 0 0 0 0 0 0 1 L H H 0 1 0 0 1 1 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 1 1 1 1 1 1 1 0 H: high voltage level (1, true) L: low voltage level (0, false) 9 of 87 10 of 87 Gates for Boolean Operations Implementing Arithmetical Computation The one bit adder: ■ Gates are electronic devices that perform Boolean operations. ■ A B Sum C out Gates are built as small electronic circuits based on transistors; ❚ 0 0 0 0 Gates are the basic building blocks out of which VLSI (very Large ❚ 0 1 1 0 Scale Integration) circuits are built; today’s computers are implement- 1 0 1 0 ed as VLSI circuits, with up to billions of transistors on a chip. 1 1 0 1 Any logical function can be implemented as a combination if such gates. Sum = A Xor B ■ C out = A And B This is just a truth table capturing a ■ logical function; thus, it can be im- plemented with a combination of logical gates! 11 of 87 12 of 87

  4. Implementing Arithmetical Computation Implementing Arithmetical Computation The one bit adder: ■ The Full Adder (adds two bits and input carry): Here is the circuit: ■ A B Sum C out C in A Sum C out 0 0 0 0 B 0 0 0 0 0 0 1 1 0 1 0 1 0 0 0 1 1 0 1 1 0 1 0 1 0 1 0 0 1 1 0 1 C out 1 0 0 1 0 Sum = A Xor B C out = A And B 1 0 1 0 1 This is just a truth table capturing a 1 1 0 0 1 ■ This is called a Half Adder logical function; thus, it can be im- (does not consider input carry). 1 1 1 1 1 plemented with a combination of logical gates! 13 of 87 14 of 87 Implementing Arithmetical Computation Implementing Arithmetical Computation A four bits adder: adds two four bits numbers and an input carry: ■ The Full Adder (adds two bits and input carry): ■ By further cascading full ■ C in A Sum C out B adders, one can build 8, 16, 0 0 0 0 0 32, 64, ... bit adders. 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 In a similar way, circuits for ■ other arithmetic opera- 1 0 1 0 1 tions can be implemented. 1 1 0 0 1 1 1 1 1 1 15 of 87 16 of 87

  5. How to Store a BIT? Flip-Flops The circuit below has two inputs. One (called S ) for setting it to 1 (H), the ■ other (called R ) for setting to 0 (L). Circuits like those shown in the previous slides are called “combinatorial”: ■ When there arrives an input 1 to S , the output becomes 1; it will stay 1, ❚ they produce an output that only depends on the input; the output is main- until there comes an input 1 to S. tained as long as that input is applied. Once an input 1 arrived to S, the output switches 0, and stays so until ❚ an 1 arrives to R. S Out What about a circuit that is able to store a bit? ■ You can write 1 or 0 to the circuit, and the output will keep the value also af- ter the input has disappeared. R 17 of 87 18 of 87 Setting the Flip-Flop to 1 Setting the Flip-Flop to 1 1 1 1 1 1 1 0 0 19 of 87 20 of 87

  6. Setting the Flip-Flop to 1 Setting the Flip-Flop to 0 0 0 1 The input has changed 1 1 to 0, but the output still remembers 1! 1 0 1 21 of 87 22 of 87 Setting the Flip-Flop to 0 Setting the Flip-Flop to 0 0 0 0 0 0 0 0 0 0 1 1 0 The input has changed to 0, but the output still remembers 0! 23 of 87 24 of 87

  7. Flip-Flops Let’s Go Over to Computers We have seen how data (logical and numerical) is represented in a computer. ■ One flip-flop can store one bit. Using groups of several flip-flops, arbitrary ■ long sequences of bits can be stored. This is a basic technique to store data We have seen that it is possible to construct circuits that are able to operate on ■ in computers e.g. in registers. data and perform logical and arithmetical operations. We have seen that circuits can be built which are able to store data. ■ 25 of 87 26 of 87 Let’s Go Over to Computers What is a Computer/Computer-System? We have seen how data (logical and numerical) is represented in a computer. ■ A computer is a data processing machine which is operated automatically ■ under the control of a list of instructions (called a program) stored in its main We have seen that it is possible to construct circuits that are able to operate on memory. ■ data and perform logical and arithmetical operations. We have seen that circuits can be built which are able to store data. ■ Computers today are extremely complex and are built of many interconnect- ■ ed components; in addition to actual data processing, they have to perform tasks such as communicate with other computers and devices, to interact with the user and the environment, etc. Therefore we speak about Computer Systems . Now, let’s see how a computer is built and works! 27 of 87 28 of 87

  8. Computer Systems Computer Systems Internal Internal CPU CPU CPU bus CPU bus The CPU (Central Processing Unit) Registers Registers This is the hart of the system; it is ALU ALU the engine that interprets the in- structions and executes them (with IR IR the help of other components of PC PC the computer system). Control Control Unit Unit System bus Memory bus System bus Memory bus Bus in- Main Bus in- Main Bridge Bridge terface terface memory memory I/O bus I/O bus USB Graphics Disk USB Graphics Disk controller adapter controller controller adapter controller Mouse Keyboard Display Mouse Keyboard Display Disk Disk 29 of 87 30 of 87 Computer Systems Computer Systems Internal Internal CPU CPU CPU bus CPU bus The Main Memory The CPU together with the Main Memory build the core computer; Registers Registers Is a temporary storage that stores this is the minimal structure capa- ALU ALU both instructions (the program) ble of storing and executing pro- and data. grams. IR IR PC PC Control Control Unit Unit System bus Memory bus System bus Memory bus Bus in- Main Bus in- Main Bridge Bridge terface terface memory memory I/O bus I/O bus The rest of the computer system USB Graphics Disk USB Graphics Disk deals with communication, Input/ controller adapter controller controller adapter controller Output, long term storage, and in- teraction with the environment. Display Display Mouse Keyboard Mouse Keyboard Disk Disk 31 of 87 32 of 87

Recommend


More recommend