Unformatted text preview:

Computer architecture, part 1:Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Putting it all together,Slide 11Slide 12Slide 13Boolean logicSlide 15Digital LogicTransistorLogic GatesNOT gateNAND gate (NOT AND)NOR gate (NOT OR)Slide 22Slide 23Slide 24What about other operations?Slide 26Slide 27Slide 28COMP 4—Power Tools for the Mind1What’s in the box?Computer architecture, part 1: What we’ll cover for this lecture topic:–What is a CPU? –How is a program executedby the CPU?–Boolean logic–Binary circuits that can add!COMP 4—Power Tools for the Mind2What’s in the box?Central Processing Unit (CPU): –Carries out the program’s instructions! •Operates on data it finds in the computer’s memory.–Also called Microprocessor•Includes all binary circuits that carry out arithmetic & logic operations---reduced to a single IC.– CPU has four key parts that we will examine:•Control Unit•Arithmetic & Logic Unit•Registers •ClockAnd, of course, wires that connect everything together.COMP 4—Power Tools for the Mind3What’s in the box?—CONTROL UNIT (CU): circuitry for coordinating machine’s activities. Controls sequence of operations.—ARITHMETIC & LOGIC UNIT (ALU): circuitry to perform data manipulation (arithmetic & logic).—Registers: Temporary storage areas. Holds information applicable to the current operation. —Clock: Triggers start and stop of all CPU operations. (heartbeat)CPUCU ALUTwo mainfunctional units:clockRegistersCOMP 4—Power Tools for the Mind4What’s in the box?•CPUs support a set of very simple instructions that typically fall into the following categories:•Data movement (load, store, copy…)•Arithmetic/logical (add, subtract, compare..)•Program control (branch, halt…)–Very primitive commands (operations) executed by the CPU [logical structure]–These commands are implemented as electronic binary circuits [physical structure] which can transform the 0s and 1s. BASIC INSTRUCTION SETCOMP 4—Power Tools for the Mind5What’s in the box?Sample of a partial Basic instruction set Instr: Meaning:STO Store data in a particular memory locationADD Add two numbers togetherSUB Subtract one number from anotherMUL Multiply two numbersDIV Divide two numbersINC Increment a number by adding 1CMP Compare two numbers to see if they are equalJMP Jump to a specific position in the instruction code•Instructions are given to the processor in the form of a program … so it knows what circuits to use, in what order; and from where the data should be read or to where it should be stored.COMP 4—Power Tools for the Mind6What’s in the box?More specifically:•A program consists of a sequence of instructions.•EACH instruction specifies both:–The operation to perform–The address of the data it will transform in that operation (if necessary).•Instructions are stored and processed in machine language--also called microcode. •Like everything else (e.g. like ASCII characters, pixels of an image, …) machine language consists solely of bit patterns.COMP 4—Power Tools for the Mind7What’s in the box? Machine language or Machine Code a/k/a microcode–ML bit patterns are based directly on CPU’s instruction set (on its binary circuits). So who created them?–CPU chip: designed to recognize certain bit patterns as representing certain ML instructions, which correspond directly to certain available binary circuits. –Each ML instruction contains a fixed-length instruction code that:•Identifies the operation to perform: op code•Tells the CPU how to determine the operandsFor example:assume a 4-bit op-code + two 6-bit operands = one 16 bit instructionCOMP 4—Power Tools for the Mind8What’s in the box?E.G.: An ADD instruction in a 16-bit machine language: 0101 110011 111100 Op-code: Operands: (RAM or Register addresses) 0101 110011 111100•Before it can process a M.L. instruction, the CPU must fetch it from main memory. •The CPU must keep track of its position in the instruction code. It uses a bookmark of sorts.•The offset at which the next instruction starts is stored in a special register, called the Program Counter or Instruction Pointer. Important digression…–who knows if bits in memory are data or program … ? –increments to memory address of next instruction ...Putting it all togetherProcessor: simple minded! repeats same steps over & over...1. FETCH•Fetches instruction (from memory) at address given by instruction pointer; copies it into CU storage register.2. COPY & DECODE•Copies op code into instruction register, operands into address registers. •Interprets instruction. ALU is invoked to perform decoded operation for any ALU ops (enters Execution Cycle)3. ADVANCE INSTRUCTION POINTER (counter)•Pointer incremented; contains memory address of next instruction that will be fetched. Instruction Cycle: in the Control UnitMACHINE CYCLE: “Instruction-Execution cycle”Processing of a single machine-level instruction (one Op Code) in a basic machine.9,A single Instruction cycle (Add)CONTROL UNITCONTROL UNITPointerStorage registerAddress regAddress reg000001PROCESSORInstr. reg.Imprecise data representation, and a vast simplification--but general concepts are correct.2b Enter execute cycleALUALU3000011 Advance pointerMEMORYMEMORY0101 1100 1111 110085 data shown in base 1065 data shown in base 10#000001#000011#110011 ….10#0000100111 1110 0111 1110#000100#111100 ….0101110011111100Copy & Decode2a0101 110011 111100Fetch1,Another single Inst Cycle (Divide)CONTROL UNITCONTROL UNITPointerStorage registerAddress regAddress reg000011PROCESSORInstr. reg.Imprecise data representation, and a vast simplification--but general concepts are correct.2b Enter execute cycleALUALU3000101 Advance pointer110111111001111110Copy & Decode2aMEMORYMEMORY0101 1100 1111 110085 data shown in base 1065 data shown in base 10#000001#000011#110011 ….#0000100111 1110 0111 1110#000100#111100 ….0111 111001 111110Fetch1–Execution cycles vary, depending on the op code.•Eg: load register R03 with contents of memory cell 47: Just for culture: The CU causes the load to occur.•CU activates ALU circuitry, which performs the actual Op Code. EG: MUL, ADD, DIV, … Execution Cycle: by the CU/ALUE.G: an arithmetic operation: ADD1. LOAD•Data copied from memory to ALU register.2. ADD•Data values are added in ALU adder circuitry.3. COPY•Result stored


View Full Document

UNC-Chapel Hill COMP 004 - LECTURE NOTES

Download LECTURE NOTES
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE NOTES 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?