1 / 28

COE 205

COE 205. Lectures 2 & 3: Computer Organization. Memory. Storage Device Stores Programs and Data coded in binary format. Technically “similar” to a two-dimensional array of “switches” A “switch” called a bit (abbr. for bi nary dig it ) n Address lines means 2 n words of m bits each.

Download Presentation

COE 205

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. COE 205 Lectures 2 & 3: Computer Organization COE 205

  2. Memory • Storage Device • Stores Programs and Data coded in binary format. • Technically “similar” to a two-dimensional array of “switches” • A “switch” called a bit (abbr. for binarydigit) • n Address lines means 2n words of m bits each 2n n Address m 1 Data 0 COE 205

  3. Memory • 2 Operations: • Read: Copy Data stored in word of Address (on Address lines) to Data Bus • Write: Store Data on Data Bus into word of Address (on Address lines) n Memory Addr Read Write m Data COE 205

  4. Concept of Address • It is an index in the memory • It represents a “geographic” location of a word in the memory • Number of Address lines and Word size determine Memory Capacity (Size) • Most of the time: • Memory size = 2n words = 2n * m bits COE 205

  5. Random Access • Access to Memory locations is equal delay. • Means access to any word which address picked “randomly” will take the SAME amount of access time. • Think about it as structurally different than a tape structure. • In a tape: unequal access time to information stored in different locations (beginning of tape, middle or end of tape) COE 205

  6. RAM • RAM: Random Access Memory • Although the name is about the way memory is accessed. Historically, volatile memory has been called RAM. • Volatile (do not retain information on power off) • Used mainly as Central Memory for CPUs • Two types of RAM • Static: Continuous Retention of Information • Dynamic (DRAM): needs refresh cycle to maintain information COE 205

  7. ROM • Non Volatile • Used to store data (programs) that do not change often (fixed) • Many types • Mask ROM: Values set at fabrication stage. Values cannot be changed • Fuse PROM: Values set at burning phase. Values cannot be changed • EPROM: Can be erased (UV) • EEPROM: Electrically erased • Flash EEPROM: Easily reprogrammable. • New: NVRAM (Non Volatile RAM): Fast access time. COE 205

  8. Disk Drives • Hard Drive: suite of magnetic disks. Mechanically read and write data by moving a set of magnetic head over the disks • CD-ROM, DVD-ROM: Suite of optical disks read by measuring the time of laser reflexion between “1” and “0” N S “0” “1” COE 205

  9. Instruction 1 Instruction 2 Instruction 3 Instruction n Program Execution • A Program is a suite of instructions • Program Execution is Sequential • Program is stored in Memory • Program is executed by CPU COE 205

  10. CPU • Executes Programs Stored in Memory • Executes Instructions ONE by ONE • Only “knows” instructions: Instruction Set • DO NOT know any notion of Program as a single entity. • Everything is a suite of instructions COE 205

  11. CPU Structure (1) Is Mainly a Data Processing Unit Controlled by a Control Unit. • Data Processing Unit: Datapath • Registers (Scratch pad working space or temporary data storage) • ALU: Arithmetic and Logic Unit • Internal Buses • Control Unit: Generates Commands to “drive” Datapath operations COE 205

  12. CPU Structure (2) Data Path is Similar to a Pipe Structure where valves are controlled by the Control Unit Control Unit ALU Datapath Register Register COE 205

  13. Master Clock • Instructions Executed step by step • Need a “Rhythm” Generator to move forward in the steps: Time Clock Cycle Clock Frequency = 1/Clock Cycle Period : MHz Every CPU needs a Clock to control the transition from one execution step to the next COE 205

  14. Instruction Set • Instruction Set is the Catalog of the CPU • Defines what are ALL the possible operations that the CPU can execute • Only Instructions are recognized by CPU. • CPU does NOT “understand” High Level Language (text). • CPU understands instructions coded in numbers called machine code. COE 205

  15. Instruction parameters • Each Instruction specifies an action or a suite of actions: • Action(s) “identifier” or Operation Code or Opcode • Action arguments or operands • Methods specifying how to access the operands, called addressing modes Instruction specified as: <Opcode> <Operand 1, addr_mode1> <Operand 2, addr_mode2> …. COE 205

  16. Addressing Modes • Direct • Indirect • Indexed • Immediate • Register • Inherent • Combination of the above (some) COE 205

  17. Number of Operands • Many types of Instruction Sets • Instruction Set with One Operand: Implicit Register Called Accumulator. Everything goes to and from the accumulator: • Instruction Set with Two Operands: Many registers can be used as accumulators • Instruction Set with Three Operands: Mainly Register Based. COE 205

  18. Instruction Format • Specifies the map of the instruction at the code machine level. • Formatted scheme for the instruction word(s) • Considers a word (or multiple words) in memory as a single instruction composed of different contiguous bit-fields containing the opcode and the different operands and their addressing modes • Many formats can co-exist in the same instruction set • Opcode value determines remaining format Opcode Reg Immediate COE 205

  19. CPU Execution • Executes Instruction by Instruction • Instructions stored in Memory • Capable of doing a certain number of operations (Defined by Instruction Set) • Get Instruction from Memory • Recognize What instruction it is • Activates the associated set of commands (step-by-step) COE 205

  20. Fetch – Decode - Execute Fetch Address of next Instruction Cpu Memory Fetch Instruction Read Command Opcode Reg Immediate Decode Instruction Decoder Decode Execute Execute COE 205

  21. Address of Programs • Where the Address of next instruction is Stored ? Need for an Instruction Pointer Called: “Program Counter” PC • Critical Component of CPU • Conveniently useful for changing program sequence (Branch instructions) COE 205

  22. Instruction Register • Where is the current instruction going to be stored during its execution ? Need for a Register Called: “Instruction Register” Data Bus • Critical Component of CPU • Internal Register. Cannot be used (accessed) by instructions • Holds the current instruction until its execution is completed • Tightly Coupled to the decoding portion of the control unit • Connected to the datapath (to transfer operand fields) Opcode Op1 Op2 Instruction Decoder COE 205

  23. Program in Memory • Binary code (machine code). Memory (8-bit) B8 MOV AX,5 00 05 03 ADD AX,BX C3 EB JMP Next E7 COE 205

  24. High Level Languages • Machine independent. • Cannot be run directly on the target machine • Need to be translated to machine language • Compiler: program that translates a HLL program to a machine language program of a specific platform • The Machine language program produced by the compiler is the executable program. • Translating HLL programs to machine language programs is not a one-to-one mapping • A HLL statement translated to one or more machine language instructions • Usually, machine language programs produced by compilers are not efficient • Deals with Data types (integer, real, complex, user-defined) vs. machine language: no data types only binary words. COE 205

  25. Assembly Language • Text version of machine language • Human friendly representation of machine language • Based on mnemonics (easy to memorize abbreviations of actions) instead of dealing with opcode numbers. • Complicated format simplified with some conventions • Text file translated into machine code by the Assembler COE 205

  26. Assembler • Program that assemble the programs written in assembly language into machine language • Because there is a ONE to ONE mapping between instructions written in assembly language and machine language instructions, the process is called: assembly rather than translation. • Disassembly (reverse process) is also easy because of the ONE to ONE relation between the assembly language instructions and the machine language instructions COE 205

  27. Linker • Program used to link together separately assembled/compiled programs into a single executable code • Allows the programmers to develop different parts of a large program separately, test them separately and ‘freeze’ them for future use. • Allows the programmer to develop store portions of programs that have been intensively tested and used into a “program library” for anyone to re-use them. • Produces modular programs and greatly enables the management of large programming projects COE 205

  28. Debugger/Monitor These are tools that allow the assembly programmers to: • Display and alter the contents of memory and registers while running their code, • Perform disassembly of their machine code (show the assembly language equivalent), • Permit them to run their programs, stop (or halt) them, run them step-by-step or insert break points. • Break points: Positions in the program that if are encountered during run time, the program will be halted so the programmer can examine the memory and registers contents and determine what went wrong. COE 205

More Related