0 index
1 Machine Language Instructions
2 Format
3 Instruction Format
4 Addressing Modes
5 Indirect addressing
6 Compare
7 Compare Example
8 Branch
9 Branch Example
10 Label
11 Op code mnemonic
12 Address field
13 Comment
14 Instruction Set

outline
created using slideshow.cgi by Andy Harris















CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
1. Machine Language Instructions
  • Instructions that can be decoded and executed by the control unit of a computer
  • Operation code (op code) is a unique unsigned-integer code assigned to each machine language operation
  • Address field(s) - the memory addresses of the values on which this operation will work



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
2. Format
  • Typical Machine Language Format - 16 bits



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
3. Instruction Format
  • Assume the op code for ADD is a decimal 9
  • Cell X correspond to address 99 (decimal)
  • op code (6bits or 26)
    address (10 bits or 210)
  • Putting it all together
  • op code
    address
    001001
    0001100011



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
4. Addressing Modes
  • Direct addressing - regular addressing (ADD)
  • Constant addressing - ADD-C



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
5. Indirect addressing
  • The ten data bits of the instruction (parameter) give the address of a location in memory. That location does not contain the data to be used in the instruction, but it contains the address of another memory location that does contain the data.



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
6. Compare
  • These operations compare two values and set an indicator on the basis of the results of the compare
  • Most Von Neumann machines have a special set of bits inside the processor called condition codes and these bits are set by the compare operations



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
7. Compare Example
  • Operation
    Meaning
    COMPARE X, Y
    Compare the contents of memory cell X to the contents of memory cell Y and set the condition codes accordingly
  • Condition
    How the condition codes are set
    CON (X) > CON (Y)
    GT = 1
    EQ = 0
    LT = 0
    CON (X) = CON (Y)
    GT = 0
    EQ = 1
    LT = 0
    CON (X) < CON (Y)
    GT = 0
    EQ = 0
    LT = 1



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
8. Branch
  • The normal mode of operation of a Von Neumann machine is sequential
  • The branch instructions alter the normal sequential flow of control - based typically on the current settings of the condition codes
  • Branch is almost always proceded by either a compare instruction or some other instruction that sets the condition codes



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
9. Branch Example
  • Operation
    Meaning
    JUMP X
    Take the next instruction unconditionally from memory cell X
    JUMPGT X
    If the GT indicator is a 1, take the next instruction from memory cell X. Otherwise, take the next instruction from the next sequential location
    HALT
    Stop program execution. Don't go on to the next instruction



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
10. Label
  • Attached to any instruction or piece of data in the program
  • Becomes a permanent identification for this instruction or data, regardless of where it appears in the program or where it may be moved in memory
  • Name followed by a colon placed at the beginning of an instruction
    -   BEGIN:     LOAD X



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
11. Op code mnemonic
  • Allows the programmer to refer to op codes using the symbolic name rather than by a number
    -   LOAD, ADD, STORE



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
12. Address field
  • Lets the programmer use symbolic addresses in addition to numeric addresses
    -   JUMP 17



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
13. Comment
  • Helpful explanation added to the instuction by a programmer and intended for someone reading the program
  • Ignored during translation and execution



































CSCI N301 Fundamental CS Concepts: n301/cs17machinelang
14. Instruction Set



































outline

Machine Language Instructions

  • Instructions that can be decoded and executed by the control unit of a computer
  • Operation code (op code) is a unique unsigned-integer code assigned to each machine language operation
  • Address field(s) - the memory addresses of the values on which this operation will work

Format

  • Typical Machine Language Format - 16 bits

Instruction Format

  • Assume the op code for ADD is a decimal 9
  • Cell X correspond to address 99 (decimal)
  • op code (6bits or 26)
    address (10 bits or 210)
  • Putting it all together
  • op code
    address
    001001
    0001100011

Addressing Modes

  • Direct addressing - regular addressing (ADD)
  • Constant addressing - ADD-C

Indirect addressing

  • The ten data bits of the instruction (parameter) give the address of a location in memory. That location does not contain the data to be used in the instruction, but it contains the address of another memory location that does contain the data.

Compare

  • These operations compare two values and set an indicator on the basis of the results of the compare
  • Most Von Neumann machines have a special set of bits inside the processor called condition codes and these bits are set by the compare operations

Compare Example

  • Operation
    Meaning
    COMPARE X, Y
    Compare the contents of memory cell X to the contents of memory cell Y and set the condition codes accordingly
  • Branch

    • The normal mode of operation of a Von Neumann machine is sequential
    • The branch instructions alter the normal sequential flow of control - based typically on the current settings of the condition codes
    • Branch is almost always proceded by either a compare instruction or some other instruction that sets the condition codes

    Branch Example

    Condition
    How the condition codes are set
    CON (X) > CON (Y)
    GT = 1
    EQ = 0
    LT = 0
    CON (X) = CON (Y)
    GT = 0
    EQ = 1
    LT = 0
    CON (X) < CON (Y)
    GT = 0
    EQ = 0
    LT = 1
    Operation
    Meaning
    JUMP X
    Take the next instruction unconditionally from memory cell X
    JUMPGT X
    If the GT indicator is a 1, take the next instruction from memory cell X. Otherwise, take the next instruction from the next sequential location
    HALT
    Stop program execution. Don't go on to the next instruction

Label

  • Attached to any instruction or piece of data in the program
  • Becomes a permanent identification for this instruction or data, regardless of where it appears in the program or where it may be moved in memory
  • Name followed by a colon placed at the beginning of an instruction
    -   BEGIN:     LOAD X

Op code mnemonic

  • Allows the programmer to refer to op codes using the symbolic name rather than by a number
    -   LOAD, ADD, STORE

Address field

  • Lets the programmer use symbolic addresses in addition to numeric addresses
    -   JUMP 17

Comment

  • Helpful explanation added to the instuction by a programmer and intended for someone reading the program
  • Ignored during translation and execution

Instruction Set