Sunday, May 31, 2009

Machine Structures 1: What do you need to build a computer

What do you need to build a computer

– Memory

• To store program instructions

• To store intermediate data values

– Calculator

• To carry out calculations

• Commonly called an “ALU”, which stands for Arithmetic / Logic Unit

– Instruction Set Architecture

• Describes format of program instructions

– One example: SICP RML (not very practical)

– Another example: the “Beta” (more representative of real machines)

– Control Machine

• To interpret the instructions and tell the data memory and ALU what

to do.

What else do we need?

• A PC or Program Counter to keep track of where we are in

the program memory.

• A way of controlling the PC depending on if statements

(conditionals).

• Some method of remembering where we’ve been when

doing recursive calls, because the PC isn’t enough

• Some method of managing memory for subroutine calls,

heap storage, etc ...

High Level to Assembly Conversion

Java Code:

z = x + y;

Instruction:

(assign (reg z) (op +) (reg x) (reg y))

Representation of the Instruction:

Reg Y

Reg X

Reg Z

OP Code







Memory Architecture:





What’s Wrong with this?

• If we have lots of data, the pointers into

data memory can become very Wide

• If the pointers are very Wide, then the

instructions will need to be very Wide.

• Other problems: The nature of memory

systems.

Why Big Data Memories are Slow?

• The more selection a chip needs to do, the longer

it takes to find the data being selected.

• Big memories are off-chip, and communications

within an integrated circuit are fast, communications between chips are slow.

A good idea:

• Invent a small “register file” which most instructions will point to for

data source and destination.

• Invent new Memory-type instructions for

– Loading data from the bigger data memory to the register file

– Storing data to the bigger data memory from the register file

• New ALU-type instruction format

e.g. ADD R0 R1 R2

e.g. LD 43264, R0

LD 932643, R1

ST R2, 43265

Instruction Set Design

• Wide choice in # of addresses specified

– 0 address (stack) machines (e.g. Java virtual machine) – 0 Registers e.g., add [uses stack to get the data]

– 1 address (accumulator) (e.g. 68hc11) – 1 Registers e.g., add r1

– 2 address machines (e.g. Dec PDP-11) – 2 Registers e.g., add r1, r2

– 3 address machines (e.g. Beta) – 3 Registers e.g., add r1, r2, r3

• Wide choice of complexity of instructions

CISC vs. RISC (e.g. I86 vs. Beta)

Note: CISC is Complex Instruction Set Computer and RISC is Reduced Instruction Set Computer. As the name suggests CISC is more complex than RISC and the category of RISC and CISC is based on the number of instructions needed to perform an operation and the time taken to perform an instruction.


No comments:

Post a Comment