DOC PREVIEW
Berkeley COMPSCI 150 - Lecture Notes

This preview shows page 1-2-3-4-25-26-27-51-52-53-54 out of 54 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 54 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 54 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 54 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 54 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 54 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 54 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 54 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 54 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 54 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 54 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 54 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 54 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Start with a calculator…Calculator LayoutCalculator Bit DesignQuestion: How do we subtract?Question: How do we compute two’s complement?Operations, RevisitedProblem: OverflowOverflow CircuitAdding multiplicationWhat do we need?Multiplying Calculator LayoutControl FSM: Timing is KeySlide 13What do we we haveComputer OrganizationTri-State BuffersTri-States vs. MuxRegister TransferOpen Collector ConceptStructure of a ComputerRegistersSlide 22Register FilesMemoriesInstruction SequencingInstruction TypesElements of the Control Unit (aka Instruction Unit)Instruction ExecutionData Path (Hierarchy)Data Path (ALU)Data Path (ALU + Registers)Data Path (Bit-slice)Instruction PathData Path (Memory Interface)Block Diagram of ProcessorSlide 36A Simplified Processor Data-path and MemoryProcessor ControlProcessor InstructionsTracing an Instruction's ExecutionTracing an Instruction's Execution (cont’d)Slide 42Slide 43Slide 44Register-Transfer-Level DescriptionRegister-Transfer-Level Description (cont’d)Review of FSM TimingFSM Controller for CPU (skeletal Moore FSM)FSM Controller for CPU (reset and instruction fetch)FSM Controller for CPU (decode)FSM Controller for CPU (Instruction Execution)FSM Controller for CPU (Add Instruction)FSM Controller for CPUNext Up: AddersCS 150 – Spring 2008 – Lec #12: Computer Org I - 1Start with a calculator…Integer calculator6 bitsValues 0-63Operations: +, -, Complement, bitwise logical operationsA+B, A-B, A & B, A | B, A = B, ~B (bitwise complement), -B (same as 0-A), A XOR BCS 150 – Spring 2008 – Lec #12: Computer Org I - 2Calculator Layout66A BCOperation6CS 150 – Spring 2008 – Lec #12: Computer Org I - 3Calculator Bit DesignDominated by additionHalf-AdderCS 150 – Spring 2008 – Lec #12: Computer Org I - 4Question: How do we subtract?Tied up in: how do we represent negative numbersOption 1: “Sign-and-Magnitude’’ High-order bit represents signLow-order 5 bits represent magnitude-7 = 10111Key negative: need a separate circuit for subtraction!(How would you do it?)Option 2: “Two’s Complement”Take advantage of fact that 64 = 0 (in 6-bit machine)Therefore: 64-x = -x-7 = 64-7 = 57 = 111001 (Notice 7 = 000111)Key: We can subtract by adding!CS 150 – Spring 2008 – Lec #12: Computer Org I - 5Question: How do we compute two’s complement?Positive numbers: 000001…..011111 (1 - 31)Negative numbers: 111111….100001 (-1 - -31)Notice: 111111 = -1“One’s Complement of A”: Flip each bit of A = ~AOne’s complement of 7 (000111) = 111000Notice: A + ~A = 111111 (-1) XOR of each bit is 1AND of each bit is 0Therefore: -A = ~A + 1CS 150 – Spring 2008 – Lec #12: Computer Org I - 6Operations, RevisitedADD, OR, AND, COMPLEMENT, EQUALITY, XORNegation and Subtraction implemented by manipulating inputs Per-Bit DesignCarry-in to bit 0CS 150 – Spring 2008 – Lec #12: Computer Org I - 7Problem: OverflowConsider 31+31 = 62 = 64-2 = -2!Not what we want!X+Y >= 32 (or X + Y <= -32) yield incorrect resultsNumbers >= 32 or <= -32 can’t be representedKey: detect when it happens and flag itException: “Overflow”How to detect it?Observation I:Can only happen when two positive or two negative numbers added togetherHigh-order bit of operands equalObservation II:Happens only on an AddObservation III:High-Order bit of output != high-order bit of inputsCS 150 – Spring 2008 – Lec #12: Computer Org I - 8Overflow Circuit Also Add: • Test for negative (high-order bit is 1, “N”)• Test for zero (all bits are 0, “Z”)CS 150 – Spring 2008 – Lec #12: Computer Org I - 9Adding multiplicationCombinational circuit is big! (see HW#1)Roughly N^2 elements for NxN multiplicationSo we do it sequentially…just use the algorithm we all learned in schoolPartial result = 0, multiplier = A, multiplicand = BFor I = 1 to Nbits-1 if lsb of multiplier is 1, result = result + multiplicandMultiplicand = multiplicand << 1Multiplier = multiplier >> 1What about sign?Simple algorithm (not optimal!)S = sign(A x B)C = |A|x|B|if (S) result = -C else result = CCS 150 – Spring 2008 – Lec #12: Computer Org I - 10What do we need?Minor:Shifter (too easy to spend class time on!)Test lsb for 1/0 (just run an extra wire from low-order input to ALU)Major:Place to store partial resultsPlace to store sign of resultActions dependent on valuesProgram for multiplication algorithmThese are easy, but change the character of the device!CS 150 – Spring 2008 – Lec #12: Computer Org I - 11Multiplying Calculator Layout66A BCOperation6RegistersControl FSMCS 150 – Spring 2008 – Lec #12: Computer Org I - 12Control FSM: Timing is KeyBasically the same program we saw before, BUTNeed to keep track of timing!•Compute sign of result•Load multiplier with |A|•Load multiplicand with |B|•Load partial result with 0•If lsb of multiplier is 1•Add multiplicand to partial result•Shift multiplier right•Shift multiplicand left•Negate result if neededCS 150 – Spring 2008 – Lec #12: Computer Org I - 13By This time, we’re getting close to something else…CS 150 – Spring 2008 – Lec #12: Computer Org I - 14What do we we haveControl program in FSM that sequences instructionsStorage that are loaded in response to data conditionsActions taken, or not, in response to conditionsThis is better known as a computerAll we have to add is memoryCS 150 – Spring 2008 – Lec #12: Computer Org I - 15Computer OrganizationComputer design as an application of digital logic design proceduresComputer = processing unit + memory systemProcessing unit = control + datapathControl = finite state machineInputs = machine instruction, datapath conditionsOutputs = register transfer control signals, ALU operation codesInstruction interpretation = instruction fetch, decode, executeDatapath = functional units + registersFunctional units = ALU, multipliers, dividers, etc.Registers = program counter, shifters, storage registersCS 150 – Spring 2008 – Lec #12: Computer Org I - 16Tri-State Buffers0, 1, Z (high impedance state)inoutOEif OE then Out = In else “disconnected”+inout+outOEinBasic InverterInverting BufferCS 150 – Spring 2008 – Lec #12: Computer Org I - 17Tri-States vs. MuxSel2:1 Mux0 1A


View Full Document

Berkeley COMPSCI 150 - Lecture Notes

Documents in this Course
Lab 2

Lab 2

9 pages

Debugging

Debugging

28 pages

Lab 1

Lab 1

15 pages

Memory

Memory

13 pages

Lecture 7

Lecture 7

11 pages

SPDIF

SPDIF

18 pages

Memory

Memory

27 pages

Exam III

Exam III

15 pages

Quiz

Quiz

6 pages

Problem

Problem

3 pages

Memory

Memory

26 pages

Lab 1

Lab 1

9 pages

Memory

Memory

5 pages

Load more
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?