Inside the Machine: An Illustrated Introduction to Microprocessors and Computer Architecture

Inside the Machine: An Illustrated Introduction to Microprocessors and Computer Architecture by jon stokes Read Free Book Online Page A

Book: Inside the Machine: An Illustrated Introduction to Microprocessors and Computer Architecture by jon stokes Read Free Book Online
Authors: jon stokes
Tags: General, Computers, Systems Architecture, Microprocessors
or playing a media file. These ordered
    lists of instructions are called programs , and they consist of a few basic types of instructions.
    In modern RISC microprocessors, the act of moving data between
    memory and the registers is under the explicit control of the code stream, or
    program. So if a programmer wants to add two numbers that are located in
    main memory and then store the result back in main memory, he or she
    must write a list of instructions (a program) to tell the computer exactly what
    to do. The program must consist of:
    z
    a load instruction to move the two numbers from memory into the
    registers
    z
    an add instruction to tell the ALU to add the two numbers
    z
    a store instruction to tell the computer to place the result of the addition
    back into memory, overwriting whatever was previously there
    These operations fall into two main categories:
    Arithmetic instructions
    These instructions tell the ALU to perform an arithmetic calculation
    (for example, add, sub, mul, div).
    Memory-access instructions
    These instructions tell the parts of the processor that deal with main
    memory to move data from and to main memory (for example, load
    and store).
    NOTE
    We’ll discuss a third type of instruction, the branch instruction, shortly. Branch instructions are technically a special type of memory-access instruction, but they access code storage instead of data storage. Still, it’s easier to treat branches as a third category of instruction.
    Basic Computing Concepts
    11
    The arithmetic instruction fits with our calculator metaphor and is the
    type of instruction most familiar to anyone who’s worked with computers.
    Instructions like integer and floating-point addition, subtraction, multipli-
    cation, and division all fall under this general category.
    NOTE
    In order to simplify the discussion and reduce the number of terms, I’m temporarily including logical operations like AND, OR, NOT, NOR, and so on, under the general heading of arithmetic instructions. The difference between arithmetic and logical operations will be introduced in Chapter 2.
    The memory-access instruction is just as important as the arithmetic
    instruction, because without access to main memory’s data storage regions,
    the computer would have no way to get data into or out of the register file.
    To show you how memory-access and arithmetic operations work together
    within the context of the code stream, the remainder of this chapter will use a
    series of increasingly detailed examples. All of the examples are based on a
    simple, hypothetical computer, which I’ll call the DLW-1.2
    The DLW-1’s Basic Architecture and Arithmetic Instruction Format
    The DLW-1 microprocessor consists of an ALU (along with a few other units
    that I’ll describe later) attached to four registers, named A, B, C, and D for
    convenience. The DLW-1 is attached to a bank of main memory that’s laid
    out as a line of 256 memory cells, numbered #0 to #255. (The number that
    identifies an individual memory cell is called an address .)
    The DLW-1’s Arithmetic Instruction Format
    All of the DLW-1’s arithmetic instructions are in the following instruction
    format :
    instruction source1, source2, destination
    There are four parts to this instruction format, each of which is called a
    field . The instruction field specifies the type of operation being performed (for example, an addition, a subtraction, a multiplication, and so on). The
    two source fields tell the computer which registers hold the two numbers being operated on, or the operands . Finally, the destination field tells the computer which register to place the result in.
    As a quick illustration, an addition instruction that adds the numbers in
    registers A and B (the two source registers) and places the result in register C
    (the destination register) would look like this:
    Code
    Comments
    add A, B, C
    Add the contents of registers A and B and place the result in C, overwriting
    whatever was previously

Similar Books

Untamed

Pamela Clare

Spy Games

Gina Robinson

Veneer

Daniel Verastiqui

Sleeping Beauty

Maureen McGowan

Dead Man's Embers

Mari Strachan

44 Scotland Street

Alexander McCall Smith