Computer Architecture Lecture 12 by Engineer A. Lecturer Aymen Hasan AlAwady 25/3/2014 University of Kufa - Information Technology Research and Development.

Slides:



Advertisements
Similar presentations
8085 Architecture & Its Assembly language programming
Advertisements

The 8051 Microcontroller and Embedded Systems
Final Project : Pipelined Microprocessor Joseph Kim.
8085 Architecture & Its Assembly language programming
1 Chapter 3 Jump, Loop, and Call Instructions. 2 Sections 3.1 Loop and Jump Instructions 3.2 Call Instructions 3.3 Time Delay Generation and Calculation.
Programming with Microsoft Visual Basic th Edition
The 8085 Microprocessor Architecture
Timing Diagram is a graphical representation
CS0004: Introduction to Programming Repetition – Do Loops.
Programming Logic and Design, Third Edition Comprehensive
Repeating Actions While and For Loops
Executes a statement or statements for a number of times – iteration. Syntax for(initialize; test; increment) { // statements to be executed } Initial.
TK2633: MICROPROCESSOR & INTERFACING
ECE122 L9: While loops March 1, 2007 ECE 122 Engineering Problem Solving with Java Lecture 9 While Loops.
Nested Loops. Nesting Control Structures One if statement inside another one An if statement inside a loop A loop inside an if statement Control structures.
Lecture – 5 Assembly Language Programming
CHAPTER TIMER PROGRAMMING Timers The 8051 has two timers/counters, they can be used as ◦ Timers to generate a time delay ◦ Event counters.
1 Chapter 4 Timer Operation (I. Scott MacKenzie).
D75P 34 – HNC Computer Architecture Lecture 14 Clock Cycles and Program Analysis. © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College.
Computer Architecture
Computer Architecture Lecture 8 by Engineer A. Lecturer Aymen Hasan AlAwady 30/12/2013 University of Kufa - Informatics Center for Research and Rehabilitation.
Computer Architecture Lecture 13 – part 2 by Engineer A. Lecturer Aymen Hasan AlAwady 7/4/2014 University of Kufa - Information Technology Research and.
Computer Architecture Lecture 9 by Engineer A. Lecturer Aymen Hasan AlAwady 10/2/2014 University of Kufa - Information Technology Research and Development.
Chapter 4 - Implementing Standard Program Structures in 8086 Assembly Language from Microprocessors and Interfacing by Douglas Hall.
Repetition Chapter 7. Overview u For Loop u Do Loop  Do While Loop  Do Until Loop  Do Loop While  Do Loop Until u Nested Loops.
Computer Architecture Lecture 4 Sequential Circuits Ralph Grishman September 2015 NYU.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 4 Looping.
Computer Architecture Lecture 12 by Engineer A. Lecturer Aymen Hasan AlAwady 17/3/2014 University of Kufa - Information Technology Research and Development.
Computer Architecture Lecture 13 – part 1 by Engineer A. Lecturer Aymen Hasan AlAwady 31/3/2014 University of Kufa - Information Technology Research and.
The 8051 Microcontroller and Embedded Systems
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 5A Repetition (Concepts)
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
1 Chapter 9. To familiarize you with  Simple PERFORM  How PERFORM statements are used for iteration  Options available with PERFORM 2.
Computer Architecture Lecture 11 by Engineer A. Lecturer Aymen Hasan AlAwady 10/3/2014 University of Kufa - Information Technology Research and Development.
Computer Architecture Lecture 6 by Engineer A. Lecturer Aymen Hasan AlAwady 1/12/2013 University of Kufa - Informatics Center for Research and Rehabilitation.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Introduction to Microprocessors - chapter3 1 Chapter 3 The 8085 Microprocessor Architecture.
Computer Architecture Lecture 5 by Engineer A. Lecturer Aymen Hasan AlAwady 25/11/2013 University of Kufa - Informatics Center for Research and Rehabilitation.
Interfacing Data Converters. D/A converters Design an O/P port with the address FFh to interface the 1408 D/A converter that is calibrated for 0 to 10V.
Computer Architecture Lecture 4 by Engineer A. Lecturer Aymen Hasan AlAwady 17/11/2013 University of Kufa - Informatics Center for Research and Rehabilitation.
Computer Architecture Lecture 14 by Engineer A. Lecturer Aymen Hasan AlAwady 14/4/2014 University of Kufa - Information Technology Research and Development.
Lecture 41 CSE 341 – Microprocessors Lecture 4 Md. Omar Faruqe UB 1228
Tutorial 9 Iteration. Reminder Assignment 8 is due Wednesday.
JUMP, LOOP, AND CALL INSTRUCTIONS
2/22/20161 Assembly Language (continue). 2/22/20162 Assembly Language Format LabelOpcodeOperandComment Start:LXISP,3FF0H;Initialize stack pointer DelimiterPlacement.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
A Brief Introduction to Recursion. Recursion Recursive methods … –methods that call themselves! –They can only solve a base case –So, you divide a problem.
© Mike Stacey 2008 Single Chip Microcontrollers 7765J Mount Druitt College of TAFE Lesson 6 Instruction Timing and Control Loops.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
Department of Electronic & Electrical Engineering Lecture 4. ➢ Loops ➢ Delays ➢ Conditional instructions ➢ Simple clock example.
P ROGRAMMING T ECHNIQUES : L OOPING, C OUNTING AND I NDEXING L ECTURE 7 Gunjeet Kaur Dronacharya group of Institutions.
Chapter 5: Looping. Using the while Loop Loop – A structure that allows repeated execution of a block of statements Loop body – A block of statements.
Gunjeet Kaur Dronacharya Group of Institutions COUNTERS AND TIME DELAYS LECTURE 3.
Computer Programming -1-
PROGRAMMING OF 8085 PROCESSOR
Introduction to Analysis of Algorithms
The 8085 Microprocessor Architecture
Assembly Language (continue)
Assembly Language Programming of 8085
Counters & Time Delays.
Presented by: Chi Yan Hung
Microprocessor and Assembly Language
EMT 348: Microcontroller Timer/counter
Control Structure Senior Lecturer
CS-401 Computer Architecture & Assembly Language Programming
Iteration: Beyond the Basic PERFORM
TK2633: MICROPROCESSOR & INTERFACING
Performance Cycle time of a computer CPU speed speed = 1 / cycle time
CS-401 Assembly Language Programming
Presentation transcript:

Computer Architecture Lecture 12 by Engineer A. Lecturer Aymen Hasan AlAwady 25/3/2014 University of Kufa - Information Technology Research and Development Center 1 1

1. Delays To calculate the delays, we need to know how many T- States an instruction requires, and keeping in mind that a T-State is one clock cycle long, we can calculate the time using the following formula: Delay = No. of T-States / Frequency For example a “MVI” instruction uses 7 T-States. Therefore, if the Microprocessor is running at 2 MHz, the instruction would require 3.5 μSeconds to complete. 2

1.2 Delay loops We can use a loop to produce a certain amount of time delay in a program. The following is an example of a delay loop: MVI C, FFH 7 T-States LOOP DCR C 4 T-States JNZ LOOP 10 T-States The first instruction initializes the loop counter and is executed only once requiring only 7 T-States. The following two instructions form a loop that requires 14 T-States to execute and is repeated 255 times until C becomes 0. 3

1.2 Delay Loops (Contd.) We need to keep in mind though that in the last iteration of the loop, the JNZ instruction will fail and require only 7 T-States rather than the 10. Therefore, we must reduce 3 T-States from the total delay to get an accurate delay calculation. To calculate the delay, we use the following formula: Tdelay= TO+ TL Tdelay= total delay TO= delay outside the loop TL= delay of the loop TO is the sum of all delays outside the loop. 4

2.1 Delay Loops (Contd.) Using these formulas, we can calculate the time delay for the previous example: TO= 7 T-States Delay of the MVI instruction TL= (14 X 255) -3 = 3567 T-States Tdelay= = 3574 T-State 14 T-States for the 2 instructions repeated 255 times (FF H = 255 D) reduced by the 3 T-States for the final JNZ. Total Delay T Delay = 3574 X 0.5 μSec = mSec µSec (Microsecond)= mSec (Milisecond) =

3. Using a Register Pair as a Loop Counter The following is an example of a delay loop set up with a register pair as the loop counter. LXI B, 1000H 10 T-States LOOP DCX B 6 T-States MOV A, C 4 T-States ORA B 4 T-States JNZ LOOP 10 T-States 6

3.1 Using a Register Pair as a Loop Counter Using the same formula from before, we can calculate: TO= 10 T-States The delay for the LXI instruction TL= (24 X 4096) -3 = T-States Tdelay= = T-State 24 T-States for the 4 instructions in the loop repeated 4096 times (1000 H= 4096 D) reduced by the 3 T-States for the JNZ in the last iteration. Total Delay T Delay = X 0.5 μSec = mSec 7

4. Nested Loops 8 Nested loops can be easily setup in Assembly language by using two registers for the two loop counters and updating the right register in the right loop. In the figure, the body of loop2 can be before or after loop1.

4.1 Nested Loops for Delay Instead (or in conjunction with) Register Pairs, a nested loop structure can be used to increase the total delay produced. MVI B, 10H 7 T-States LOOP2 MVI C, FFH 7 T-States LOOP1 DCR C 4 T-States JNZ LOOP1 10 T-States DCR B 4 T-States JNZ LOOP2 10 T-States 9

4.1 Delay Calculation of Nested Loops The calculation remains the same except that it the formula must be applied recursively to each loop. Start with the inner loop, then plug that delay in the calculation of the outer loop. Delay of inner loop T O1 = 7 T-States MVI C, FFH instruction T L1 = (255 X 14) -3 = 3567 T-States 14 T-States for the DCR C and JNZ instructions repeated 255 times (FF H= 255 D) minus 3 for the final JNZ Tdelay for loop1= =

4.1 Delay Calculation of Nested Loops Delay of outer loop T O2 = 7 T-States MVI B, 10H instruction T L1 = (16 X ( )) -3 = T-States 14 T-States for the DCR B and JNZ instructions and 3574 T-States for loop1 repeated 16 times (10 16 = ) minus 3 for the final JNZ. T delay = = T-States Total Delay T Delay = X 0.5 μSec = mSec 11

5. Increasing the delay The delay can be further increased by using register pairs for each of the loop counters in the nested loops setup. It can also be increased by adding dummy instructions (like NOP) in the body of the loop. 12

13 End of lecture 12