March R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class Connecting Hardware to InstructionsConnecting Hardware to Instructions A bunch of diagramsA bunch of diagrams Assembly language programmingAssembly language programming Homework assignmentHomework assignment Note: this presentation includes copyrighted material of McGraw-Hill, the textbook publisher, and is intended for the exclusive use of ENGR 330 at UST (Fall 2007). Some slides are based on slides from NC State University, Introduction to Computer Organization (ECE 206) course, and from UC Riverside’s CS 061, a lower division computer science and engineering course.Note: this presentation includes copyrighted material of McGraw-Hill, the textbook publisher, and is intended for the exclusive use of ENGR 330 at UST (Fall 2007). Some slides are based on slides from NC State University, Introduction to Computer Organization (ECE 206) course, and from UC Riverside’s CS 061, a lower division computer science and engineering course.
March R. Smith - University of St Thomas - Minnesota The von Neumann Model Memory: holds both data and instructions Processing Unit: carries out the instructions Control Unit: sequences and interprets instructions Input: external information into the memory Output: produces results for the user Memory Processing Unit Input Output MARMDR ALUTEMP Control Unit PCIR (keyboard) (monitor)
March R. Smith - University of St Thomas - Minnesota The LC-3 as a von Neumann machine Control unitControl unit –PC and its inputs –IR feeds the FSM –FSM’s combinatorial logic feeds the rest ALU/ProcessingALU/Processing –Register file –MUX to feed ALU Grand BusGrand Bus –RAM access –ALU to Registers Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
March R. Smith - University of St Thomas - Minnesota The Instruction Cycle as FSM
March R. Smith - University of St Thomas - Minnesota LD data path LD R2, x1AF
March R. Smith - University of St Thomas - Minnesota LD (PC-Relative)
March R. Smith - University of St Thomas - Minnesota LDR (Base+Offset)
March R. Smith - University of St Thomas - Minnesota LEA (Immediate)
March R. Smith - University of St Thomas - Minnesota LEA data path LEA R5, # -3
March R. Smith - University of St Thomas - Minnesota ST (PC-Relative)
March R. Smith - University of St Thomas - Minnesota STR (Base+Offset)
March R. Smith - University of St Thomas - Minnesota ADD/AND (Immediate) Note: Immediate field is sign- extended. this one means “immediate mode”
March R. Smith - University of St Thomas - Minnesota ADD/AND (Register) this zero means “register mode”
March R. Smith - University of St Thomas - Minnesota ADD Immediate data path ADD R1, R4, # -2
March R. Smith - University of St Thomas - Minnesota NOT (Register) Note: Src and Dst could be the same register.
March R. Smith - University of St Thomas - Minnesota NOT data path NOT R3, R5
March R. Smith - University of St Thomas - Minnesota BR (PC-Relative) What happens if bits [11:9] are all zero? All one?
March R. Smith - University of St Thomas - Minnesota BR data path BR data path BRz x0D9
March R. Smith - University of St Thomas - Minnesota JMP (Register) Jump is an unconditional branch -- always taken.Jump is an unconditional branch -- always taken. –Target address is the contents of a register. –Allows any target address.
March R. Smith - University of St Thomas - Minnesota LC-3 Data Path –Global Bus 16-bit, data & address16-bit, data & address connects all componentsconnects all components is shared by allis shared by all –Memory Memory Address Register: MARMemory Address Register: MAR –address of location to be accessed Memory Data Register: MDRMemory Data Register: MDR –data loaded or to be stored Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
March R. Smith - University of St Thomas - Minnesota Using Operate Instructions With only ADD, AND, NOT…With only ADD, AND, NOT… –How do we subtract? –How do we OR? –How do we copy from one register to another? –How do we initialize a register to zero?
March R. Smith - University of St Thomas - Minnesota Assembly language programming All the power of machine languageAll the power of machine language Less hassleLess hassle LC-3 assembler/simulatorLC-3 assembler/simulator –Link on the course home page –Download it to use for the assignment Sample problemSample problem –A list of numbers in RAM – add them up