1 / 38

Dr. Travis Doom Wright State University Computer Science and Engineering

Dr. Travis Doom Wright State University Computer Science and Engineering. A beginning engineer’s guide to the digital computer. What is computation? There are many sorts of computing devices, they fall into two categories:

lowell
Download Presentation

Dr. Travis Doom Wright State University Computer Science and Engineering

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. Dr. Travis Doom Wright State University Computer Science and Engineering A beginning engineer’s guide to the digital computer

  2. What is computation? There are many sorts of computing devices, they fall into two categories: Analog: machines that produce an answer that measures some continuous physical property such as distance, light intensity, or voltage. Examples? Digital: machines that perform computations by manipulating a fixed finite set of elements. Examples? The difficulty with analog devices is that it is very hard to increase their accuracy. Before modern digital computers, the most common digital machines were adding machines. Adding machines perform exactly one sort of operation. Computers also perform one operation… but their operation is to accept a set of instructions that tell it how to do any sort of computation. What is a computer?

  3. Universal computing devices • Turing’s Thesis: Computer scientists believe that ANYTHING that can be computed, can be computed by a computer (provided that it has enough time and enough memory). • What does this imply? • All computers (from the least expensive to the most expensive) are capable of computing EXACTLY the same things IF they are given enough time and enough memory. • Some computers can do things faster, but none can do more than any other computer. • All computers can do exactly the same same things! • Thus, any given problem is either computable or it is not computable • Problems may be computable, but still not feasible (NPC)

  4. We describe our problems in English or some other natural language. Computer problems are solved by electrons flowing around inside the computer. It is necessary to transform our problem from a natural language to the voltages that influence the flow of electrons. This transformation is really a sequence of systematic transformations, developed and improved over the last 50 years, which combine to give the computer the ability to carry out what may appear to be very complicated tasks. In reality, these tasks must be simple and straight-forward. How do we get the electrons to do the work?

  5. The principle of design abstraction • General model for Engineering (Byrne, 1992) Alteration Reverse Engineering Abstraction Con- ceptual re-think Con- ceptual Forward Engineering Refinement re-specify Requirements Requirements re-design Design Design re-build Implementation Implementation Existing System Target System

  6. The Problem Algorithm & Language ISA & Microarchitecture Circuits & Devices Levels of abstraction in digital computation • Design Process Computer Science Software level Computer Engineering Hardware level Computer/Elect. Engineering Logic level

  7. The Problem Algorithm & Language ISA & Microarchitecture Circuits & Devices The statement of the problem • We describe problems that we wish to solve with a computer in a “natural language.” • Natural languages are fraught with a lot of things unacceptable for providing instructions to a computer. • The most important of these unacceptable attributes is ambiguity. To infer the meaning of a sentence, a listener is often helped by context that the computer does not have. • Example: “Time flies like an arrow.” • How fast time passes • Track meet • Gossip • A computer is an electronic idiot and can not deal with any ambiguity, thus…

  8. The Problem Algorithm & Language ISA & Microarchitecture Circuits & Devices The algorithm • The first step in the sequence of transformations is to transform the natural language description of the problem to an algorithm. • An algorithm is a step-by-step procedure: • That transforms an input (possibly NULL) into some output (or output action) • That is guaranteed to terminate • Definiteness: Each step is precisely stated. • Effective computability: Each step must be something the computer can perform • Finiteness: The procedure must terminate • For any computable problem, there are an infinite number of algorithms to solve it. • Which solution is best?

  9. The Problem Algorithm & Language ISA & Microarchitecture Circuits & Devices The programming language • The next step is to transform the algorithm into a computer program • Programming languages are unambiguous “mechanical” languages • There are two kinds of programming languages: • High-level languages are machine independent. They are “far above” the (underlying) computer • Low-level languages are machine dependent. They are tied to the computer on which the program will execute. There is generally only one such language per machine (referred to as its ASSEMBLY language).

  10. The Problem Algorithm &Language ISA & Microarchitecture Circuits & Devices The instruction set architecture (ISA) • The next step is to translate the program into the instruction set of the particular computer that will be used to carry out the work of the program. • The Instruction Set Architecture (ISA) is the complete specification of the interface between programs that have been written and the underlying hardware that must carry out the work of those programs. • Examples: IA-32 (Intel, AMD, and others), PowerPC (Motorola) • Programs are translated from high languages in to the ISA of the computer on which they will be run by a program called a compiler (specific to the ISA). • Programs are translated from assembly to the ISA by an assembler • Analogy: A car • The car’s ISA describes what the driver sees/uses.

  11. The Problem Algorithm &Language ISA & Microarchitecture Circuits & Devices The microarchitecture • The next step is to transform the ISA into an implementation. The detailed organization of an implementation is called its microarchitecture. • The IA-32 has been implemented by several different processors over the past twenty years 8086 (Intel, 1979), 8286, 8386, 8486, Pentium, PentiumII, Athlon, PentiumIII. • Each implementation is an opportunity for computer designers to make different trade-offs between cost and performance. [Computer design is always an exercise in trade-offs.] • Analogy: A car • The implementation of a car’s ISA is what goes on under the hood. Here all automobiles makes and models are different. Some with fuel injection, some have eight cylinders, some are turbocharged… in each case the “microarchitecture” of a specific automobile is the result of the automobile designers’ decisions regarding cost and performance.

  12. The Problem Algorithm &Language ISA & Microarchitecture Circuits & Devices The logic circuit • The next step is to implement each element of the microprocessor out of simple logic circuits. • Here there are also choices, as the logic designer decides how to best make the trade-offs between cost and performance. • Even in the case of addition, there are several choices of logic circuits to perform this operation and differing speeds and corresponding costs.

  13. Vcc Rc The Problem Vout Rb Vin GND Algorithm &Language ISA & Microarchitecture Circuits & Devices The devices • Finally, each basic logic circuit is implemented in accordance with the requirements of the particular device technology used. • So, CMOS circuits are different from NMOS circuits, which are different, in turn, from gallium arsenide circuits.

  14. Vcc Rc Vout Rb Vin GND Electronic aspects of digital design • Vin low  Ib = 0 • transistor cut off: Vout = Vcc • Vin high  Ib > 0 • transistor “on”: Vout = GND Vout Vcc VOHmin Abnormal except for switching VOLmax VCESat Vin GND VOLmax VIHmin Vcc VOLmax: max output voltage in low state VOHmin: min output voltage in high state VILmax: max input voltage recognized as low VIHmin: min input voltage recognized as high

  15. v v t t Digital devices • Analog characteristics • Continuous signal levels • Very small, smooth level changes • Digital characteristics • Discrete signal levels (voltage usually) • Two levels: on/off, high/low 1/0 (binary) • Disjoint or quantized level changes • Digital Concepts and Devices • Digital Design also called Logic Design • Logic Gates - the most basic digital devices • Digital devices have analog electronic aspect

  16. /A F / B Basic logic circuits • AND gate • Output Z = 1 only when inputs A and B are both 1 • OR gate • Output Z = 1 only when inputs A or B or both are 1 • NOT gate or inverter • Output Z = 1 only when input A is 0 • Simple alone, but combine a few million gates and… A Z B A Z B A Z

  17. Complex logic circuits • Logic circuits divide into two major types: • Combinational Logic • Current output depends on current input only • Examples: gates, decoders, multiplexors (MUXs), ALUs • Sequential Logic • Current output depends on past inputs as well as current input • Thus has a memory (usually called the state) • Examples: latches, flip-flops, state machines, counters, shift registers Design: avg (w,x,y,z) a^2+2ab+b^2 m + n * p p * (m + n)

  18. Sequential logic definitions • STATE- A collection of state variables whose values at any one time contain all the information about the past values necessary to account for future behavior. • Example: A TV tuner could have a current channel stored internally, so the next channel can be predicted as a function of the inputs, i.e. the UP button increases the channel by one, the DOWN button decreases the channel by one. What is the state of this TV tuner? • Digital sequential logic • State variables are binary values • Circuit with n binary state variables has 2npossible states • Also known as a finite state machine (FSM). • Changes usually synchronized with a system clock

  19. Vout1 Vin1 Q Vin2 /Q Vout2 Bistable Element • The simplest possible feedback sequential logic circuit is shown below: • It is bistable because it has two stable states: • State 1: If Q (Q=Vout1=Vin2) is high, the bottom inverter output(/Q =Vout2=Vin1) is low, which keeps the top inverter output Q high. • State 2: If Q is low, the bottom inverter output /Q is high, which keeps the top inverter output Q low.

  20. S R Q /Q S Q 0 0 1 1 0 1 0 1 Last Q 0 1 0 Last /Q 1 0 0 R Q R Q /Q S S-R Latch Function Table Symbol Set Hold Reset Set ILLEGAL Reset Schematic Characteristic Equation: Q(t+1) = S + R’Q(t)

  21. Clocked Synchronous State-machine Structure (Mealy machine) Next-state Logic F State Memory clock Output Logic G inputs excitation current state outputs R clock

  22. 2n x b RAM Address Data outputs n b Random Access Memory (RAM) • A circuit with n + b inputs and b outputs: Write Enable b / Data inputs • Memory ¾ values determined by user • Volatile ¾ contents lost without power • Uniform (Random) Access ¾ delay is uniform for all addresses

  23. -processor RAM 4 Address Out Address 4 16 Instruction Data Out Data In Data Out Write Enable Write Start Reset 4 Data In Clock > Ready A simple microprocessor Instruction Format: Opcode [15:12], Op A [11:8], Op B [7:4], Op C [3:0] Example Instruction: x2021 Opcode 2 Format: M[A] M[B] Instruction: M[0]  M[2] Ram Contents (Before) ADDR DATA x0 x4 x1 xF x2 x9 … ... Ram Contents (After) ADDR DATA x0 x9 x1 xF x2 x9 … ...

  24. -processor Data Unit Control Unit 4 4 4 4 4 Control Word 16 Instruction Address Out 14 Start Data Out Constant Data In VNCZ > Write Enable Reset > Ready Clock A simple microarchitecture • R0  Constant B • Address Out  R0, R1  Data In • R0  Constant A • Address Out  R0, Data Out  R1, Write Enable • Return to IDLE state (Sequencing Instruction) Example Instruction: x2021 Opcode 2 Format: M[A] M[B] Instruction: M[0]  M[2]

  25. Constant Operand Select 16 12:0 Instruction 16:13 ? ? 4 4 Start Control Word Generate Data Signal Logic Generate Load Signal Logic 14 Mode Condition Code Next Address Operand Select VNCZ CONTROL STORE (ROM) Reset CLR DATA LD/CNT’ CAR Clock > microinstruction Address Data Write Enable Generate Ready Ready A simple microarchitecture • R0  Constant B • Address Out  R0, R1  Data In • R0  Constant A • Address Out  R0, Data Out  R1, Write Enable • CAR  x00 (IDLE STATE)

  26. A simple microprocessor • Central Processing Unit • Control Unit, Integer Datapath (Load/Store, Integer ALU) • Floating Point Unit • Floating Point Datapath • Internal Cache • SRAM for Instruction Cache (i-cache) and Data Cache (d-cache) • Memory Management Unit • Controls communication with Main Memory and other I/O FPU Internal Cache Bus CPU MMU

  27. Processor ASIC ASIC Bus Memory I/O Device I/O Device A simple computer architecture • Generic Computer System. • Current architectures are performance driven, and vary widely. • Processor • Uniprocessor systems • ASIC (Application Specific Integrated Circuit) • Performs a specific task, not a general purpose processor (e.g. Voodoo) • I/O Device • Accesses data devices (e.g. Graphics Adapter, Disk Controller, et al.)

  28. A contemporary architecture Front Side Bus 100 MHz? Main Memory Microprocessors Memory Chipset Bridge External Cache Back Side Bus PCI - 33MHz Disk Interface (EIDE,uSCSI-2) AGP Registers 2ns L1 On-chip 4ns L2 On-chip 5ns L3 Off-chip 30ns Memory 220ns Paged VM > 1 ms! Graphics Adapter (non-AGP) Network Interface Card (NIC) ISA devices Compatibility Bridge (South-side, ISA) Serial/Parallel I/O (keyboard, mouse, printer)

  29. The instruction set • High-Level Language - C • A = B + C; • Memory-Transfer Equivalent • Mem[A]  Mem[B] + Mem[C] • Mem[EA00]  Mem[EA08] + Mem[EA10] • Machine-Level Equivalent • Assembly (human readable) ex: Machine (for a simple architecture) • Load R2, B E2EA08 • Load R3, C E3EA10 • R2  R2 + R3 0223 • Store A, R2 F2EA00 • The bits of a machine instruction are divided into fields • eg: E2EA08 • E: Operation “Load”; 2: Destination Address R2; EA08: Address Field • The operation field (opcode) defines the format for the instruction

  30. The instruction set • There are three basic types of computer instructions • Register Instructions: operate on values stored in registers • Arithmetic, Shift, and Logic instructions • Move Instructions: move data between memory and registers • Load/Store instructions • Move/Copy portions of memory • Branch Instructions: select one of two possible next instructions to execute • Branch on condition, Unconditional branch (Jump) • Only one address is explicit, the other operand is implict • e.g.: Beq R2, R3, A • If the contents of R2 = R3 then execute the instruction at location A next (explict) • otherwise, execute the next instruction in the normal order (using the PC) (implict)

  31. The Von Neumann architecture • The Von Neumann model of computer processing • Program and data are both stored as sequences of bits in the computer’s memory. • The program in executed on instruction at a time under the direction of the control unit. • The instruction-execution cycle • Instruction Fetch (IF) stage • Get next instruction from the memory address referenced by the PC • Place the new instruction in the Instruction Register • Increment the PC to the next instruction address • Execute operation (EX) stage • Execute the operation specified in the opcode • Branch instructions may update the PC • Repeat

  32. How do we specify the program? • Contemporary languages • C, C++, Perl, Java, and hundreds more. • Languages of Yore • Fortran, COBOL, and scores more. • Specialty languages • VHDL, simulation languages, and thousands more. • There are over 1,000 “standardized” programming languages today. • The only goal of these languages is to help humans implement their algorithms in the instructions available for a particular ISA

  33. How do we execute the program? APPLICATION PROGRAMS Compilers Databases Games Productivity Tools HARDWARE CPU Memory I/O Devices U S E R S How do we use the resources? OS SOFTWARE Many Demands Limited Resources

  34. What is an Operating System? • Do we want all programs to have access to all instructions? • The OS is a program that acts as an intermediary between the application programs and the hardware resources • All communication requires hardware resources, thus the OS is also an intermediary between users and applications • The purpose of any OS is to provide an environment in which: • users can (conveniently) execute programs and access data • application programs can (efficiently and fairly) access system resources (processor time, memory, file space, I/O devices, etc.) • The OS need not perform any other useful function: it is a control environment (kernel) controls access to all resources • All other software is an application program • How does the existence of an OS simplify coding an app? • Do you trust others to protect your rights and data?

  35. The algorithm • Developing an algorithm to solve a problem is non-trivial • As with many issues in engineering, there are trade-offs to be made between performance (the correctness of the solution) and cost (the time it takes for the algorithm to complete. • Consider the Traveling salesman problem: • You must visit, by car, n different cities. From each city, you can get to any other city – but the distances between them vary. • Your “Problem” is to find the shortest route that visits every city exactly once.

  36. Exponential growth • 10^1 • 10^2 • 10^3 Number of students in the college of engineering • 10^4 Number of students enrolled at Wright State University • 10^6 Number of people in Dayton • 10^8 Number of people in Ohio • 10^10 Number of stars in the galaxy • 10^20 Total number of all stars in the universe • 10^80 Total number of particles in the universe • 10^100 << Number of possible solutions to traveling salesman (100) • Travelling saleman (100) is computable but it is NOT feasible.

  37. The knapsack problem You stumble across some valuable artifacts while out in the wild. Unfortunately, you can only add ten lbs to your pack and still make it back to civilization. What do you take? Item Value Weight $/lb A $150 10 lbs. 15 B $140 7 lbs. 14 C $100 5 lbs. 10 D $60 3 lbs. 20 E $45 3 lbs. 15 Optimization algorithms

  38. Bug brain demo • Your laboratory assignment this week is to gain some familiarity with the concept of solving relatively complex problems with very simple primitives.

More Related