Chapter 8 machine instructions
This presentation is the property of its rightful owner.
Sponsored Links
1 / 8

Chapter 8 – Machine Instructions PowerPoint PPT Presentation


  • 57 Views
  • Uploaded on
  • Presentation posted in: General

Chapter 8 – Machine Instructions. These are lecture notes to accompany the book SPARC Architecture, Assembly Language Programming, and C , by Richard P. Paul, 2 nd edition, 2000. By Michael Weeks & Abinashi Dhungel. Decoding Instructions. SPARC Instructions are 32 bits long

Download Presentation

Chapter 8 – Machine Instructions

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Chapter 8 machine instructions

Chapter 8 – Machine Instructions

These are lecture notes to accompany the book SPARC Architecture, Assembly Language Programming, and C,

by Richard P. Paul, 2nd edition, 2000.

By Michael Weeks &Abinashi Dhungel

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C


Decoding instructions

Decoding Instructions

  • SPARC Instructions are 32 bits long

  • Bits <31:30> specify the “op” field

  • These first 2 bits indicate how the other bits should be handled.

op

31 30 29 0

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C


Decoding instructions1

Decoding Instructions

  • Instructions are classified according to “op”

op

31 30 29 0

opInstruction class

00Branch instructions

01 Call instructions

10Format Three instructions

11Format Three instructions

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C


Format 1 instructions

Format 1 Instructions

  • Call instruction

  • The displacement must be word aligned

  • Address is calculated by right shifting displacement 2 positions

01

30 bit displacement

31 30 29 0

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C


Format 2 instructions

Format 2 Instructions

  • branch

0 0 a cond op2 22 bit immediate

31 30 29 28 25 24 22 21 0

  • sethi

0 0 rd 1 0 0 22 bit immediate

31 30 29 25 24 22 21 0

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C


Branch instructions

Branch Instructions

  • The branch is (or is not) taken based on the “cond” (condition) field.

  • op2 = 010 means integer condition code

condbranch type

0000never

0001if equal to zero

0010if less than or equal to zero

0011if less than zero

0100if less or equal, unsigned

0101if carry set

0110if negative

0111if overflow is set

condbranch type

1000always

1001if not equal to zero

1010if greater than zero

1011if greater than or equal to zero

1100if greater, unsigned

1101if carry is clear

1110if positive

1111if overflow is clear

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C


Format 3 instructions

Format 3 Instructions

  • 2 source registers

  • Immediate constant

op = 10

op3Instruction000000add000001and000010or000011xor000100sub000101andn000110orn000111xnor001000addx111100save111101restore111110<unused>111111<unused>

op = 11

op3Instruction000000ld000001ldub000010lduh000011ldd000100st000101stb000110sth000111std001000<unused>

See page 235 and 236for a complete list of the instructions

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C


Classwork

Classwork

  • Decode the following commands:

  • 0x9de3bfa0

  • 0xd007bfec

  • 0x92102004

  • 0x90020009

  • 0xd027bfec

save %sp, -96, %sp

ld [%fp-20], %o0

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C


  • Login