Branch Call Delay
Branch Call Delay
Branch Call Delay
BRANCH,CALL,AND
TIMEDELAYLOOP
Chapter3
DrUsmanAli,NUSTCollegeofE&ME
DrUsmanAli,NUSTCollegeofE&ME
Looping in microprocessors
Loopinginmicroprocessors
Repeating
Repeatingasequenceofinstructionsoran
a sequence of instructions or an
operationacertainnumberoftimes
Commonlyusedinstructions
Commonly used instructions
DECFSZ
BNZ
DrUsmanAli,NUSTCollegeofE&ME
DECFSZ instruction
DECFSZinstruction
decrementfileRegskipzero
decrement file Reg skip zero
Format DECFSZfileReg,d
DrUsmanAli,NUSTCollegeofE&ME
DrUsmanAli,NUSTCollegeofE&ME
BNZ instruction
BNZinstruction
branch
branchifnotzero
if not zero
Itbranches(jumps)backtothetargetaddress
referred to by the label
referredtobythelabel
DrUsmanAli,NUSTCollegeofE&ME
DrUsmanAli,NUSTCollegeofE&ME
Nestedloop
DrUsmanAli,NUSTCollegeofE&ME
Nestedloop
DrUsmanAli,NUSTCollegeofE&ME
Conditional/unconditionalshort/long
jumps
Short,conditionaljumps
Short, conditional jumps
Long,unconditionaljumps
GOTO,32bit,covers1Mmemoryspace
BRA(branch),16bit,covers1Kspace
DrUsmanAli,NUSTCollegeofE&ME
Instructionsstructure
DrUsmanAli,NUSTCollegeofE&ME
DrUsmanAli,NUSTCollegeofE&ME
CALLinstructions
Usedtocallasubroutine
CALL,RCALL
Workwithreturninstruction
4bytes,2bytessize
4 bytes, 2 bytes size
DrUsmanAli,NUSTCollegeofE&ME
DrUsmanAli,NUSTCollegeofE&ME
DrUsmanAli,NUSTCollegeofE&ME
Example CALLinstruction
DrUsmanAli,NUSTCollegeofE&ME
Example CALLinstruction
DrUsmanAli,NUSTCollegeofE&ME
DrUsmanAli,NUSTCollegeofE&ME
Delay calculation
Delaycalculation
Twomajorfactors
Two major factors
Crystalfrequency
Microprocessorinstructionexecutioncycles
Microprocessor instruction execution cycles
Pipelinevs nonpipelinedarchitecture
Instruction size
Instructionsize
DrUsmanAli,NUSTCollegeofE&ME
Pipelining
DrUsmanAli,NUSTCollegeofE&ME
DrUsmanAli,NUSTCollegeofE&ME
Appendix A
Appendix
A
DrUsmanAli,NUSTCollegeofE&ME
Example instructionsexecutiondelays
Example
instructions execution delays
DrUsmanAli,NUSTCollegeofE&ME
Example subroutineexecutiondelay
Example
subroutine execution delay
Crystalfreq.=4MHz
Crystal freq = 4MHz
DrUsmanAli,NUSTCollegeofE&ME