Micro 133 Prelim Lecture 5 - Intel ΜP Instruction Encoding and Decoding

download Micro 133 Prelim Lecture 5 - Intel ΜP Instruction Encoding and Decoding

of 16

Transcript of Micro 133 Prelim Lecture 5 - Intel ΜP Instruction Encoding and Decoding

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    1/16

    INTEL P INSTRUCTIONENCODING AND

    DECODING

    Micro 133: Microprocessor Systems

    Prelim Lecture 5

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    2/16

    IntroductionIntel P Instruction Encoding and Decoding

    Machine LanuaeIt is the native binary code that the microprocessor understand.

    A!!e"#$erIt is use to translate assembly instruction to a machine code.

    O%code &O%eration Code'Selects the operation performed by the microprocessor such as M!" #DD" I$%" &MP" ' etc.

    It is either one or t(o byte in length for most machine language instruction.

    Decodin

    It is a processes representing entire assembly instruction as a binary value or he)adecimalformat *human perspective+

    EncodinIt is the process of converting he)adecimal format to assembly language *machine

    perspective+

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    3/16

    (iure 1, -he format of the /0 , /10 Instruction a+203bit instruction" b+ 43bit instruction

    )*)+ , )*-)+ In!truction (or"atIntel P Instruction Encoding and Decoding

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    4/16

    (iure ., /6/0 Instruction 7ormat

    )*))/)*)+ In!truction (or"atIntel P Instruction Encoding and Decoding

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    5/16

    In!truction!consist of8operation *opcode+ e.g. M!

    operands *number depends on operation+

    O%erand!specified using addressing modes

    Addre!!in "odemay include addressing

    information9egisters

    %onstant values

    !ariable

    In!truction EncodinInte$ 0P In!truction Encodin and Decodin

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    6/16

    Encodinof instruction must includes8pcode

    perands

    #ddressing information

    Encodin is processrepresenting entire instruction as a#inar2a$ue$umber of bytes needed depends on ho( much information must be

    encoded .

    Instructions are encoded by a!!e"#$er:O45file *lin:" then loaded by loader+

    Instructions are decodedby processor during e)ecution cycle

    In!truction EncodinInte$ 0P In!truction Encodin and Decodin

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    7/16

    O2erride Pre6i7e!It is the first bytes of a 43bit instruction format

    -hese bytes are not al(ays used

    Divided in -(o Parts8Addre!! Si8e, modifies the si;e of the address

    used the instruction and this byte is e

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    8/16

    O%erand Si8e3 modifies the si;e of theregister.If the /406/10 is operating as 203bit instruction

    mode machine *real or protected mode+ and 43bit

    instruction" byte is e

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    9/16

    (ir!t #te: pcode" Direction" ' =ord bitsO%code, select the operation performed by the

    microprocessor *use the lists of opcodes+

    Direction &D', indicates the flo( of data D > 2" data flo( from *96M+ field to 9E? field D > /" if data flo( from 9E? field to 96M field.

    ord &', determine the si;e of data orregister

    = > 2" 203 or 43bit data (idth *(ord or d(ord+

    = > /" 3bit data (idth *byte+

    Note:= bit appear in most of theinstruction but D bit mainly appears (ithM! and some other instructions.

    In!truction EncodinInte$ 0P In!truction Encodin and Decodin

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    10/16

    Second 4te:Mode" 9egister" ' 9egister6Memory

    Mode field -his field specifies the addressing modes for selected

    instruction.

    -his selects the type of addressing and (hether adisplacement is present or (ith the selected instruction.MD > 22" selects data addressing modes

    MD > //" /2" or 2/" selects memory addressing modes

    REGfield

    7ield for register assignment

    96M *9egister or Memory+ 7ield for register act as a memory or memory location

    assignment.

    ;o< to Encode In!truction! a!4inar =a$ue!>Inte$ 0P In!truction Encodin and Decodin

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    11/16

    (iure 3, -able for MD field a+ 203bit" b+ 43bit

    In!truction EncodinInte$ 0P In!truction Encodin and Decodin

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    12/16

    (iure -, 9E? field for (>/ ' (>2

    In!truction EncodinInte$ 0P In!truction Encodin and Decodin

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    13/16

    (iure ?, 203 and 43bit 96M field" segment register field" and

    scaled factor.

    ;o< to Encode In!truction! a!4inar =a$ue!>Inte$ 0P In!truction Encodin and Decodin

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    14/16

    Rei!ter Addre!!inIt uses the 96M field to specify a register instead of memory location

    S%ecia$ addre!!in "ode!-his addressing modes occurs (henever memory data are referenced by only the

    displacement mode of addressing for 203bit instructions.

    M! @2///hA" DL M! $BMC" DL

    MOD> // and R/M>22/

    Scaled3Inde) Cyte Indicates the additional forms of scaled3inde) addressing.

    ccurs (hen 96M > 2//

    In!truction EncodinInte$ 0P In!truction Encodin and Decodin

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    15/16

    Determine the e

  • 7/24/2019 Micro 133 Prelim Lecture 5 - Intel P Instruction Encoding and Decoding

    16/16

    ?iven the follo(ing machine code *he)code+" determine the e