name all the 4 parts of the fetch execute ?· instruction format operation code, a.k.a. opcode...

Download Name all the 4 parts of the fetch execute ?· Instruction Format Operation code, a.k.a. opcode Specifies…

Post on 19-Jul-2018

212 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • QUIZ

    Name all the 4 parts of the fetch-execute cycle.

    1

  • Solution

    Name all the 4 parts of the fetch-execute cycle.

    2

  • Name two fundamental differences between magnetic drives and optical drives:

    3

    QUIZ

  • Define Embedded Systems

    4

    QUIZ

  • 5

    QUIZ

    What are two ways to create a non-vNarchitecture?

    What are the 3 parallel architectures we covered?

  • What are two ways to create a non-vNarchitecture? A: By using more than one MM, or by using more than one CPU.

    What are the 3 parallel architectures we covered?

    6

    Solution

    Pipelined CPUs

    Synchronous CPUs

    Parallel (non-synchronous)

    CPUs

  • QUIZ Pipelining

    A computer pipeline has 4 processors, as shown above. Each processor takes 15 ms to execute, and each instruction must go sequentially through all 4 processors.

    A program has 10 instructions. Calculate how long it takes to run it:

    without pipelining

    with pipelining

    7

  • 8

    Extra-credit QUIZ

  • Low-level software

    Components

    Circuits

    Gates

    Transistors

  • Abstractions and more abstractions

    10You are here

  • 6.1 Computer Operations

    Computer = programmable electronic device that can store, retrieve, and process data

    Von Neumann architecture:

    Data and instructions to manipulate the data are represented in the same way (binary) and are stored in the same place (memory)

    For processing, both data and

    instructions have to be brought

    into the CPU (fetch-execute cycle)

    11

  • 6.2 Machine Language

    Machine language = The language made up of binary coded instructions built into the hardware of a particular computer and used directly by the computer

    Why would anyone use machine language?

    (Hint: they had no choice. Why?)

    12Image source: http://www.alpcentauri.info/chapter_18.html

  • Remember: The Fetch-Execute Cycle

    13

    According to the CPUs

    machine language

  • Characteristics of machine language:

    Every processor type has its own set of specific machine instructions

    The relationship between the processor and the instructions it can carry out is completely integrated

    Each machine-language instruction does only one very low-level task

    14

  • Pep/8 Virtual Computer

    Virtual computer

    A hypothetical machine designed to contain the important features of a real machine

    Pep/8

    A virtual computer designed by Stanley Warford that has 39 machine-language instructions

    (Were going to cover only a few of them!)

    15

  • Extra-credit

    16

  • Pep/8 Registers

    The program counter (PC) (contains the address of the next instruction to be executed)

    The instruction register (IR) (contains a copy of the instruction being executed)

    The accumulator (register A)

    The memory unit is made up of 65,636 Bytes of storage

    17

    Can you figure out how long the Pep/8 address is?

  • QUIZ

    The previous version of Pep, Pep/7, could use only 12 bits for memory addresses.

    How many memory cells could Pep/7 address?

    18

  • 19

    Explain the

    address format!

    16 bits

    24

    bits

  • 20

    Explain the

    address format!

    Can you show what

    instructions look like

    in memory?

  • Instruction Format

    21

  • Instruction Format

    Operation code, a.k.a. opcodeSpecifies which instruction is to be carried outRegister specifierSpecifies which register is to be used (only use A in

    this chapter)Addressing-mode specifierSays how to interpret the operand part of the

    instruction: Direct Immediate

    22

    Say that again?!?

  • Instruction Format

    Addressing-mode specifierSays how to interpret the operand part of the

    instruction: Direct Immediate

    2 + 3 ImmediateA + B Direct

    23

    ??

  • 24

    Immediate and direct addressing modes

  • Immediate and direct addressing modes

    25

    Example:

    ADD 42 to accumulator A

    What exactly am I to add?

  • Instruction Format

    26

    Addressing modes:

    immediate

    direct

    Is there something we are not telling you

    about Peps addressing modes?

  • PEP/8 machine instructions

    27

  • 28

    What does this instruction mean, what is

    its hex code, and what exactly does it do?

    EOL 1

  • QUIZ

    Name all the 4 parts of the fetch-execute cycle.

    What do IR, A, and PC stand for in the computers architecture?

    Name and explain the 2 addressing modes weve covered.

    29

  • QUIZ: Immediate vs. direct addressing

    30

    We have this Pep instruction:

    SUB 30 from accumulator A

    What exactly will Pep subtract?

  • 31

    Solution

    A: It depends on the addressing

    mode!

    If immediate (000), then the

    integer 30 goes in A.

    If direct (001), then the

    content of the memory

    address 30 goes in A.

    We have this Pep instruction:

    SUB 30 from accumulator A

    What exactly will Pep subtract?

  • 32

    We have this Pep instruction:

    LOAD 20 (decimal) into

    accumulator A

    What exactly will Pep load?

    QUIZ: Immediate vs. direct addressing

  • 33

    What does this instruction mean, what is

    its hex code, and what exactly does it do?

  • 34

    What does this instruction mean, what is

    its hex code, and what exactly does it do?

  • 35

    What do these instructions mean, what are

    their hex codes, and what exactly do they do?

  • Wait a second ...

    36

  • ConclusionsIt is useless to write operands into IR.

    IR is written only in the FETCH stage of the Fetch-Execute cycle, when the 3 bytes of the instruction are brought from memory.

    Operands can be written only to:

    Accumulator

    Memory

    Some instructions cannot have the immediate addressing mode

    37

  • 38

    What do these instructions mean, what are

    their hex codes, and what exactly do they do?

  • Why is there only one on this page?

    What does this instruction mean, what is

    its hex code, and what exactly does it do?

  • 40

    What do these instructions mean, what are

    their hex codes, and what exactly do they do?

  • Problem 17 / 190

    41

    The PEP/8 memory has the following contents:

    0001 A2

    0002 11

    0003 00

    0004 FF

    What are the contents of reg. A after this instruction

    is executed:

    C1 00 02

    The first step is

  • Problem 17 / 190

    42

    The PEP/8 memory has the following contents:

    0001 A2

    0002 11

    0003 00

    0004 FF

    What are the contents of reg. A after this instruction

    is executed:

    C1 00 02

    1100 0001 0000 0000 0000 0010

  • Problem 16 / 189

    43

    The PEP/8 memory has the following contents:

    0001 A2

    0002 11

    0003 00

    0004 FF

    What are the contents of reg. A after this instruction

    is executed:

    C1 00 01

  • 44

    0001 A2

    0002 11

    0003 00

    0004 FF

    Instruction

    executed:

    C1 00 01

  • 6.3 Program to write "Hello"

    45

    Every program ends with this!

  • Your turn!

    What does this program do?

    1111

    0000

    1111

    1 0000

  • 47

    Steps for executing a machine-language

    program

    Loader

    Program

    in

    memoryExecute

    Machine

    code

    program

    in a file

    on disk

  • SKIP Pep/8 Simulator

    48EOL 2

  • Problem 33 / 191

    49

    The PEP/8 memory has the following program in

    memory (in hex):

    0001 49

    0002 00

    0003 08

    0004 51

    0005 00

    0006 08

    0007 00

    Convert the program to binary and

    explain in your own words what it does.

  • Fact: Writing programs in machine language sucks!

    (i.e. it is time-consuming, boring, error-prone, unintuitive, etc.)

    50

  • thats why we invented

    assembly language

    51

  • 6.4 Assembly Language

    Assembly language

    A language that uses mnemonic codes to represent machine-language instructions

    AssemblerA program that reads each of the instructions in mnemonic form and translates it into the machine-language equivalent

    52

  • 53

    Steps for executing anassembly-language program

    Loader

    Program

    in

    memoryExecute

  • Pep/8 Assembly Language

    54

    Opcodeis 31

    Opcodeis 38

    Opcodeis 39

    Opcodeis 04

  • Hello program in assembly

    CHARO 0x0048, i ;Outputs character 'H'

    CHARO 0x0065, i

    CHARO 0x006C, i

    CHARO 0x006C, i

    CHARO 0x006F, i

    STOP

    .END

    55

    mnemonic operand addressing

    modecomments

    What in the

    world is this?!

  • A New Program

    56

    Problem: Read and sum three

    values and print the sum

    How would you do it by hand?

  • Declaring variables in assembly:We simply reserve space in memory for them!

    57

    Labels they are just

    placeholders for

    memory addresses

  • Assembler directives, a.k.a. pseudo-ops

    58

    What is the difference between

    operations and pseudo operations

Recommended

View more >