The Basic Instruction Set - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

The Basic Instruction Set

Description:

CUSP instructions are 24 bits wide, and have two formats. operand format and operate format ... 10 addressing modes are used in CUSP. if C2 and C1 are both ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 17
Provided by: sahrase
Category:
Tags: basic | cusp | instruction | set

less

Transcript and Presenter's Notes

Title: The Basic Instruction Set


1
The Basic Instruction Set
  • Handout 4

2
  • terms
  • instruction set
  • machine language
  • instruction format
  • operand format
  • operate format
  • addressing modes
  • instruction mnemonics
  • direct addressing instructions
  • arithmetic/logical instructions
  • jump instructions
  • immediate addressing instructions

3
Operand Type Instructions
  • instruction set
  • instructions that the machine understands
  • also known as machine language
  • machine language programs
  • programs written using sequences of machine
    language instructions
  • instruction format
  • CUSP instructions are 24 bits wide, and have two
    formats
  • operand format and operate format
  • operand format
  • OOMAAA
  • OO is an 8-bit opcode (identifies operation to be
    performed)
  • AAA is a 12-bit addressy thing
  • M is a 4-bit addressing mode (tells how to use
    the addressy thing to get the operand)

4
Operand Type Instructions Examples And Such
  • 002004
  • opcode 00 (tells the control unit to load a
    value into ACC)
  • addressing mode 2 (tells CU that the addressy
    thing is actually a memory address)
  • address 004
  • 002004 is equivalent to the following two forms
  • load into ACC the contents of memory location
    004
  • LDA 004 (this form is called a mnemonic)
  • how many operand type instructions are there?
  • depends on the number of bits in the opcode
  • FF is not allowed to begin an operand type
    instruction
  • this leaves 255 possibilities of which 56 are
    valid

5
Operate Type Instructions
  • these do not need an operand to be specified
  • examples
  • FFF020 tells the control unit to negate the
    contents of ACC
  • if ACC is 000 001, it becomes FFF FFF
  • FFF021 tells the control unit to invert the
    contents of ACC
  • if ACC is 000 001, it becomes FFF FFE
  • in both examples, ACC is the only operand and is
    implicitly specified
  • the most significant 12 bits are always 1
  • operate instructions always start with FFFOOO
  • OOO can have 2124096 possible combinations
  • only 38 of them represent valid operate
    instructions

6
Addressing Modes
  • tells the CU how to use the addressy thing to get
    the operand
  • two major addressing modes
  • direct the addressy thing is the address of a
    memory location from where the operand can be
    retrieved
  • 002004 OOMAAA LDA 004
  • M 2 tells the CU that direct addressing mode is
    being used, and that the operand is available at
    memory location 004
  • immediate the addressy think is actually the
    operand
  • 000004 OOMAAA LDA 004
  • M 0 tells the CU that immediate addressing mode
    is being used, and that the operand is available
    immediately and is equal to 004
  • immediate mode is indicated in the mnemonic by a
    symbol

7
Instruction Mnemonic Rules For CUSP
  • operand type instructions
  • format is XXXC1 C2value
  • XXX is the opcode mnemonic such as LDA
  • value is the addressy thing
  • C1 and C2 determine which addressing mode is
    being used
  • 10 addressing modes are used in CUSP
  • if C2 and C1 are both blank, it is direct
    addressing mode
  • if C2 is blank and C1 is , it is immediate
    addressing mode
  • operate type instructions
  • format is XXXX
  • XXX is the opcode mnemonic such as NEGA or COMA

8
Assembler
  • mnemonic representation of instructions is easier
    to read
  • must be converted to the hexadecimal
    representation before it can be stored in the
    computer
  • the software that converts mnemonics into
    hexadecimal is called an assembler

9
A Simple Program
At the start of the program, PC 000.
Memory (after)
Addr Contents000 002004001 102005002 0420
06003 FFFFFF004 000011005 000008006 00
0019
10
Program Flow Control Instructions
  • sometimes next instruction executed is not the
    next stored instruction
  • such transfer of flow control is supported
    through flags and jump instructions
  • flags
  • EQ, OV and LT are set or cleared as a result of
    execution of most of the instructions
  • EQ is set if the result of an operation results
    in 0
  • OV is set if an operation causes an overflow
  • LT is set if the result of an operation results
    in a negative numberi.e., if the result has a 1
    in the leftmost bit position

11
Flag Modification Example 1
  • Assume thatACC 000 00CMem010 FFF
    FF2IR ADA 010
  • the instruction to be executed is ADA 010, i.e.,
    add the contents of memory location 010 to the
    contents of ACC and store the result in ACC
  • new value of ACC 12-14 -2
  • since the result
  • is less than 0, LT flag will be set to 1
  • is not zero, EQ (or equal-to-zero) flag will be
    set to 0
  • has not caused an overflow, OV flag will be set
    to 0

12
Jump Instructions
  • JMP AAA (or 402AAA in hexadecimal)
  • meaning load the PC with address AAA, or PC
    AAA
  • no flags affected
  • JEQ AAA (or 482AAA in hexadecimal)
  • meaning load the PC with address AAA if EQ 1
  • no flags affected
  • JLT AAA (or 4A2AAA in hexadecimal)
  • meaning load the PC with address AAA if LT 1
  • no flags affected
  • CMA AAA (or 202AAA in hexadecimal)
  • sets EQ and LT flags after comparing MemAAA and
    ACC
  • EQ (ACC MemAAA)
  • LT (ACC lt MemAAA)

13
An Example CUSP Program With Jumps
14
The Data Transfer Instructions The MOVes
15
The Control Transfer Instructions Jumps and
Branches
16
The Arithmetic Instructions
Write a Comment
User Comments (0)
About PowerShow.com