SEMJUL08 - LECT11 - M68K CONDITIONAL OPERATORS COMPLETED

SEMJUL08 - LECT11 - M68K CONDITIONAL OPERATORS COMPLETED -...

Info iconThis preview shows pages 1–30. Sign up to view the full content.

View Full Document Right Arrow Icon
Program Control ECE511: Digital System & Microprocessor
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
What we are going to learn in this session: Program Control: What are they. Available instructions. How they effect program flow.
Background image of page 2
Introduction
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Program Control Group Instructions that perform Conditional execution. Unconditional execution. Subroutine handling. Achieves this through branching. Manipulate PC.
Background image of page 4
The Program Control Group Program Control Conditional Branch Branch Always Conditional Set Branch to Subroutine Jump to Subroutine Unconditional Jump Return from Subroutine Return from Subroutine & Restore CCR
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Unconditional Branch
Background image of page 6
BRA (Branch Always) Performs unconditional branching . Used to create infinite loops . Repeats the same instructions over and over. Doesn’t stop until M68k resets/turned off.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
BRA (Branch Always) Uses relative addressing mode: Has limitations. 16-bit signed displacement: -32,768 to 32,767.
Background image of page 8
BRA Format BRA <ea> BRA $001000 BRA LABELNAME BRA THERE Example:
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Unconditional Branching Example Instruction #1 Instruction #2 BRA HERE Instruction #3 Instruction #4 HERE Instruction #5 Instruction #6 Never executed.
Background image of page 10
Infinite Loop Example LABELNAME Instructions #1 Instructions #2 Instructions #n BRA LABELNAME
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
BRA Example START ORG $1000 BRAHERE MOVE.B #9,D0 MOVE.B #19,D1 ADD.B D1,D0 BRA BRAHERE END START
Background image of page 12
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 14
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 16
Background image of page 17

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 18
BRA Limitations Can address maximum 32,768 addresses back, and 32,767 addresses forward. Max forward = Address + 32,767. Max backward = Address – 32,768. If need to be farther, can use Jump (JMP).
Background image of page 19

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
BRA Limitations Find the allowed range when BRA address is at $030000. $030000 = 196,608 Max forward = 196,608 + 32,767 = 229,375 = $37FFF. Max backward = 196,608 – 32,768 = 163,840 = $28000. $28000 < Range < $37FFF
Background image of page 20
Background image of page 21

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
JMP (Unconditional Jump) Similar to BRA, but without limitations: Jumps to any location in program. Not limited to 16-bit displacements anymore.
Background image of page 22
Background image of page 23

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Conditional Branch
Background image of page 24
Bcc
Background image of page 25

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Bcc (Conditional Branch) Conditional branching : Branch if condition is TRUE. Execute/skip instructions results. Addressing limitations similar to BRA: 16-bit displacement . -32,768 to 32,767.
Background image of page 26
Bcc (Conditional Branch) Conditions tested using CMP . (Antonakos, pg. 83) Results stored in CCR . Used to create: Finite loops. Do…while loops. If…else blocks.
Background image of page 27

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Conditions (cc) Bcc Unsigned Signed BGT BGE BEQ BNE BLE BLT BHI BCC BEQ BNE BLS BCS D0.B > D1.B D0.B ≥ D1.B D0.B = D1.B D0.B ≠ D1.B D0.B ≤ D1.B D0.B < D1.B D0.B > D1.B D0.B ≥ D1.B D0.B = D1.B D0.B ≠ D1.B D0.B ≤ D1.B D0.B < D1.B CMP.B D1,D0 *(Antonakos, pg. 84)
Background image of page 28
conditions? Signed/unsigned numbers carry different
Background image of page 29

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 30
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 101

SEMJUL08 - LECT11 - M68K CONDITIONAL OPERATORS COMPLETED -...

This preview shows document pages 1 - 30. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online