25
Computer Science 516 Week 3 Lecture Notes

Computer Science 516 Week 3 Lecture Notes. Computer Architecture - Common Points This lecture will cover some common things which characterize computer

Embed Size (px)

Citation preview

Computer Science 516

Week 3 Lecture Notes

Computer Architecture - Common Points

• This lecture will cover some common things which characterize computer architectures

• We will also look at two computer families in this lecture

• Two or three more to cover next week• First, the basics…

Von Neumann Architecture

Also called Princeton or IAS (Institute For Advanced Studies)

Harvard Architecture

Based on 1944 Mark I computer

• Note separate memories for data and for instructions

And the winner is...

• Many designs today use a modified Harvard design– Single memory rather than separate data and

instruction memories– Separate data and instruction caches

• Generally not a programmer-visible feature

Arithmetic

• Generally Binary arithmetic– Arithmetic performed in registers– Many designs offer decimal arithmetic– Decimal may be performed in storage rather than

registers

Registers

• Very high speed storage area• Input to/Output from Adder circuit, etc.• Defines word size

Word size

• The number of bits in the basic binary arithmetic unit

• Many sizes– Generally 16, 32, 64 bits– Some older machines used different sizes

Memory

• May be word addressable or byte/character addressable

• Actual size of transfers to/from memory is called Data Path Size– Generally not a programmer visible feature

• Memory size generally limited to largest number a register holds– May be smaller– May be bigger

Programmer Visible Features

• Programmer Visible means a program can see or change it

• Typical Programmer Visible Features– Registers– Storage contents– Program counter (current instruction address)– Status bits (Zero, Overflow, Negative, Carry)

Many Features Not Visible To Programmers

• Storage Address Register (SAR - also MAR)• Storage Data Register (SDR - also MBR)• Storage Parity Bits• Instruction Register• Many others

Instruction Result Status

• When an instruction completes, status may be set

• Status used to implement if statements• Status carried in status bits– AKA status flags– AKA condition code

Instruction Result Status Example

C++ Example:• // if (a = 1)• // b = 1;• // else• // b = 2;

In assembler, might be : LDA a CMP 1 JNE E1 MOV b,1 J I3E1 MOV b,2I3 NOP

Typical Status Bits

• Many variations among architectures• Some commonly used status bits:– Zero = last result was zero– Carry = last result was larger than word size– Negative - last result less than zero– Overflow - last result was larger than word size– Equal - may be Zero renamed

• May be others• IBM System/360 – status in “condition code”

Interrupts

• How do you know an outside event is finished?

• Examples:– I/O operation– Interval timer– Other external source

Interrupts versus Polling

• Polling simpler– ...but much slower– Example:

Picking up your telephone every minute to see if you have a call

• Interrupt– Outside event hardware tells CPU it is done– Example:

Doing your homework while waiting for a phone call

Exception Interrupts

• Interrupts may also signal a problem– Example: storage parity error

• Interrupts may also signal internal event– program exception (overflow, underflow, etc.)– Generally program related

• Interrupts may also signal service request– Some instructions are restricted– Require state change from normal to executive, etc.– Example: opening a file

Operation Code

• Part of each instruction• Tells the control unit what to do next• May be fixed size:– six bits (CDC 3300)– eight bits (IBM System/360)– Often longer

• May be multiple bytes, split into two or more sections, et cetera

Instruction Set• Set of low-level operations the computer can perform• Sometimes called Instruction Repetoire• Categories:– Arithmetic– Control and branching– Bit manipulation– Character operations– Floating-point arithmetic– Decimal arithmetic– …and more

• Instruction set grows over time

Instruction Format

• Most machines have several formats• Generally one word in simpler designs• CDC 3300 – one word• May be multibyte:– IBM System/360 - 2, 4, or 6 bytes– Intel x86 - 1 to 15 bytes

• As designs mature, instruction formats may be added

Addressing Modes• How does an instruction specify what memory location holds

the data to be used?• Examples:

– Direct – actual memory address carried as part of the instruction• More prevalent in older, smaller designs

– Indexed – adds a value in an index register to formulate the actual address

– Indirect – Memory location has the address of the data rather than the actual data

– Register – address is in a register– Register with displacement – instruction holds a value added to a

register value to arrive at the actual data address– Program-counter relative addressing – instruction holds the offset

(difference) from the current instruction address• Common for jump/branch instructions

Examples Of Computer Architecture

• CDC 3300 - simple accumulator architecture– Typical 1960s design– Used at CSUN – early 1970s– Typical CDC – both positive and negative zero

• - IBM System/360 - multiple register design– Introduced 1964– 8-bit characters– Still in production 50 years later – “the

mainframe”

CDC 3300

IBM System/360

Pep-8 Architecture

• Defined in course text• Simulated architecture• Similar to DEC PDP-8• See book for details