DOC PREVIEW
UCSC CMPE 012 - Lecture Notes

This preview shows page 1-2-17-18-19-35-36 out of 36 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 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 36 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 36 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 36 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 36 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 36 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 36 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CMPE12 Cyrus Bazeghi1LC-3 Architecture(Ch4’ish material)CMPE12 Cyrus Bazeghi2CISC vs. RISCCISC : Complex Instruction Set ComputerLots of instructions of variable size, very memory optimal, typically less registers.RISC : Reduced Instruction Set Computer Less instructions, all of a fixed size, more registers, optimized for speed. Usually called a “Load/Store” architecture.CMPE12 Cyrus Bazeghi3What is “Modern”For embedded applications and for workstations there exist a wide variety of CISC and RISC and CISCy RISC and RISCy CISC.Most current PCs use the best of both worlds to achieve optimal performance.CMPE12 Cyrus Bazeghi4LC-3 Architectureo Very RISC, only 15 instructionso 16-bit data and addresso 8 general purpose registers (GPR)o Program Counter (PC)o Instruction Register (IR)o Condition Code Register (CC)o Process Status Register (PSR)CMPE12 Cyrus Bazeghi5Instruction Fetch / Execute CycleIn addition to input & output a program also: • Evaluates arithmetic & logical functions to determine values to assign to variable.• Determines the order of execution of the statements in the program.In assembly this distinction is captured in the notion of Arithmetic, logical, and controlinstructions.CMPE12 Cyrus Bazeghi6Arithmetic and logical instructions evaluate variables and assign new values to variables.Control instructions test or compare values of a variable and makes decisions about what instruction is to be executed next.Program Counter (PC)Basically the address at which the current executing instruction exists.Instruction Fetch / Execute CycleCMPE12 Cyrus Bazeghi71. load rega, 102. load regb, 203. add regc, rega, regb4. beq regc, regd, 85. store regd, rege6. store regc, regd7. load regb, 158. load rega, 30PCInstruction Fetch / Execute CycleAddress*Note: This is just pseudo assembly codeCMPE12 Cyrus Bazeghi8The CPU begins the execution of an instruction by supplying the value of the PC to the memory & initiating a read operation (fetch).The CPU “decodes” the instruction by identifying the opcode and the operands.PC increments automatically unless a control instruction is used.Instruction Fetch / Execute CycleCMPE12 Cyrus Bazeghi9For example:PC  ADD A, B, Co CPU fetches instructiono Decodes it and sees it is an “add” operation, needs to get values for the variables “B” & “C”o Gets the variable “B” from a register or memoryo Does the same for variable “C”o Does the “add” operation and stores the result in location register for variable “A”Instruction Fetch / Execute CycleCMPE12 Cyrus Bazeghi10Branch – like a goto instruction, next instruction to be fetched & executed is an instruction other than the next in memory.Instruction Fetch / Execute CycleADD A, B, CBRn fredADD A, D, 3fred ADD A, D, 4If A is negative then next instruction to be executed is at “fred”, which is just an address*Note: This is almost real LC-3 assemblyCMPE12 Cyrus Bazeghi11Breaking down an instructionADD a, b, ca b caddOpcodeDestination registerSource registers/immediateCMPE12 Cyrus Bazeghi12The Stored Program Computer1943: ENIAC– Presper Eckert and John Mauchly -- first general electronic computer. (or was it John V. Atanasoff in 1939?)– Hard-wired program -- settings of dials and switches.1944: Beginnings of EDVAC– among other improvements, includes program stored in memory1945: John von Neumann– wrote a report on the stored program concept, known as the First Draft of a Report on EDVACFor more history, see http://www.maxmon.com/history.htmCMPE12 Cyrus Bazeghi13The basic structure proposed in the draft became known as the “von Neumann machine” (or model). This machine/model had five main components:– a memory, containing instructions and data– a processing unit, for performing arithmetic and logical operations– a control unit, for interpreting instructions– and input and output to get data into and out of the system.First Draft of a Report on EDVACCMPE12 Cyrus Bazeghi14Von Neumann Model*MEMORYCONTROL UNITMAR MDRIRPROCESSING UNITALUTEMPPCOUTPUTMon itorPrinterLEDDiskINPUTKeyboardMou seScannerDisk* A slightly modified version of Von Neumann’s original diagramCMPE12 Cyrus Bazeghi15Locality of referenceWe need techniques to reduce the instruction size. From observation of programs we see that a small and predictable set of variables tend to be referenced much more often than other variables.Basically, locality is an indication that memory is not referenced randomly.This is where the use of registers comes into play.CMPE12 Cyrus Bazeghi16Memory2kx marray of stored bits:•Address– unique (k-bit) identifier of location•Contents–m-bit value stored in locationBasic Operations:•LOAD– read a value from a memory location•STORE– write a value to a memory location•••00000001001000110100010101101101111011110010110110100010addresscontentsVon Neumann ModelCMPE12 Cyrus Bazeghi17Interface to MemoryHow does the processing unit get data to/from memory?MAR: Memory Address RegisterMDR: Memory Data RegisterTo LOAD a location (A):1. Write the address (A) into the MAR.2. Send a “read” signal to the memory.3. Read the data from MDR.To STORE a value (X) to a location (A):1. Write the data (X) to the MDR.2. Write the address (A) into the MAR.3. Send a “write” signal to the memory.MEMORYMAR MDRVon Neumann ModelCMPE12 Cyrus Bazeghi18Processing UnitFunctional Units– ALU = Arithmetic and Logic Unit– could have many functional units.some of them special-purpose(multiply, square root, …)– LC-3 performs ADD, AND, NOTRegisters– Small, temporary storage– Operands and results of functional units– LC-3 has eight registers (R0, …, R7), each 16 bits wideWord Size– number of bits normally processed by ALU in one instruction– also width of registers– LC-3 is 16 bitsPROCESSING UNITALUTEMPVon Neumann ModelCMPE12 Cyrus Bazeghi19Input and OutputDevices for getting data into and out of computer memoryEach device has its own interface,usually a set of registers like thememory’s MAR and MDR– LC-3 supports keyboard (input) and monitor (output)– keyboard: data register (KBDR) and status register (KBSR)– monitor: data register (DDR) and status register (DSR)Some devices provide both input and output– disk, networkThe program that controls access to a device is usually called a driver.INPUTKeyboardM ouseScannerDiskOUTPUTM onitorPrinterLEDDiskVon Neumann ModelCMPE12 Cyrus Bazeghi20Control UnitControls the execution of


View Full Document

UCSC CMPE 012 - 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?