Compsci 210 Tutorial Four
agenda Last week homework Sequential circuit - difficult Lc-3 simulator
Exercise 2.8 Determine the truth table for this decoder (Solution on Piazza) CompSci 210 - Semester One 2016
Two type of logic circuits Combinational Circuit for computing always gives the same output for a given set of inputs Decoders – convert S into control signals Multiplexers – select inputs and outputs ALU (Arithmetic and Logic Unit) – operations on data Sequential Circuit for storing stores information State machine – coordinate control signals and data movement Registers and latches – storage elements CompSci 210 - Semester One 2016
Latches The SR Latch (NOR) Consider the following circuit Q R Q Q S S Q Q S Q Symbol Circuit R S Q 0 0 Qprev (HOLD) 0 1 1 1 0 0 1 1 ? Q represents current output Qprev represents previous output. (at last time) Not allowed Function Table Why we need “HOLD” state? Although SR LAtch is one of the most important fundamental methods of didgital storage,it is not often used in practice (because of undefined state) - However forms the basis of the more complex latches that we will be dicussing
You ought to be able to figure this one out yourself! Latches The SR Latch(NAND) NAND Form produces similar result from inverted inputs R R S Q 0 0 ? 0 1 0 1 0 1 1 1 Qprev Q R R Q Q Not allowed Q S S S Q Q Hold Function Table Circuit Symbol You ought to be able to figure this one out yourself!
Master-Slave Flip flop Reduce the current noise on the circuit D CK Qcurrent Qnext ↑ X 1 At the beginning of each clock cycle Again: To reduce the noise possibility
Von Neumann Model
Instruction Processing
LC-3 an assembly language (low-level programming language) a type of educational programming language CompSci 210 - Semester One 2016
Why assembly language Human logic: We are here Circuit: CompSci 210 - Semester One 2016
High level languages Assembly language Machine code CompSci 210 - Semester One 2016
LC-3 simulator & LC-3 editor CompSci 210 - Semester One 2016
LC-3 simulator & LC-3 editor You can edit your program here using binary code, hexadecimal code and assembly code. After finish editing, you can export to .obj file which can be run by LC3 simulator.
LC-3 simulator & LC-3 editor virtual computer which execute assembly code Simulator CompSci 210 - Semester One 2016
LC-3 Notes The simulator and the editor are separate programs The simulator is available for Windows (also Linux/Java/etc) The lab computers should have LC-3 included The LC-3 software can be executed from a flash drive Download from : Goolge: lc-3 simulator canvas if needed CompSci 210 - Semester One 2016
The LC-3 Files CompSci 210 - Semester One 2016
The LC-3 Files After installation, you will see 2 exe programs (windows): LC3Edit.exe and Simulate.exe.
LC-3 Editor CompSci 210 - Semester One 2016
LC-3 Editor The editor is used to enter your LC-3 instructions You will save your programs into the .asm format The editor will also assemble your .asm files into .obj files which can be run on the simulator
example.asm .ORIG x3000 LD R2, ZERO LD R0, M0 LD R1, M1 LOOP BRz DONE ADD R2, R2, R0 ADD R1, R1, -1 BR LOOP DONE ST R2, RESULT HALT RESULT .FILL x0000 ZERO .FILL x0000 M0 .FILL x0004 M1 .FILL x0803 .END CompSci 210 - Semester One 2016
LC-3 Simulator
LC-3 Simulator The simulator is used to execute your assembled LC-3 machine code You will load the .obj files you create into the editor The editor gives you a very detailed view of what is happening as your machine code is executed
Lc-3 simulator CompSci 210 - Semester One 2016
Example: LC-3 ADD Instruction CompSci 210 - Semester One 2016
Demonstration Complete the following tasks in LC-3. Write a program in the LC-3 Editor. Assemble a program in the LC-3 Editor. Load and execute a program in the LC-3 Simulator. Set breakpoints in the simulator to pause execution. Step forward through your executing program one line at a time. Modify a register value during program execution.