computer science 516 week 4 lecture notes. addresses related to c++ pointers not consistently...

22
Computer Science 516 Week 4 Lecture Notes

Upload: lenard-jerome-hart

Post on 05-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Computer Science 516

Week 4 Lecture Notes

Page 2: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Addresses

• Related to C++ pointers• Not consistently covered in CS575• Essential to Computer Architecture

Page 3: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Where Are We?

• Pierce College?• Computer Science Building?• Room 1502?• Pierce College

6201 Winnetka Ave.Woodland Hills CA 91301?

Page 4: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Where Are We?

• How about:

34.185141, -118.575767

Page 5: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Which Is Accurate?

• All of them...• ...depending on the context in which they are

used!

Page 6: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Variable Names Versus Addresses

• C++ Variables are like "Room 1502"

• Accurate location within the context of the program

• Storage addresses are like 34.185141, -118.575767

• Accurate regardless of context

Page 7: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

C++ implementation

• Pointer *• Dereference *• Reference &• Refer to CS575 text

Page 8: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Function Pointers

• Pointers usually reference variables• Pointers may also reference a program • Called Function Pointers• Commonlyh used in operating systems

Page 9: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Addresses in Computer Architecture

• 16-bit - 65535 storage locations• 32-bit - 4,294,967,295 storage locations• 64-bit - 9.2 quintillion

Page 10: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Computer Architecture: The VAX

• History– Introduced 1979– Virtual Address eXtension for PDP-11– Actually new architecture– In production through 2005

• Many still in use

Page 11: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Key Points

• 16 Registers• 12-15 had special uses• Processor Status Register• four 1GB address regions P0, P1, S0, S1• Complex Instruction Set Computer (CISC)

Page 12: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Registers

• 12 - Argument Pointer• 13 - Frame Pointer • 14 - Stack Pointer• 15 - Program Counter

Page 13: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

VAX Characteristics

• Many, many addressing modes• Highly Orthogonal– Each instruction usable in all addressing modes

Page 14: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Computer Architecture: RISC

• Problems With CISC– Complex to build– Complexity made some things slow– Complexity increased cost

• Hence...Reduced Instruction Set Computers

Page 15: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

RISC History

• John Cocke - IBM - 1976• Several Vendors in 1980s-1990s– Sun– MIPS– Apollo/HP– IBM RS-6000, Power– DEC Alpha

Page 16: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

RISC Principles• All instructions one word• usually 32 bits• All instructions take one cycle– In CISC, only simplest instructions finish in one

cycle• Few instruction formats• More registers (usually 32)– Register 0 always zero, read-only

• Complexity moved to compiler

Page 17: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

ARM Architecture

• Advanced RISC Machines– Major vendor to mobile, tablet arena– Originally 32-bit, later 64

• 32-bit instructions, later 16-bit added• Several different families• Generally 40-60 instructions• Raspberry Pi

Page 18: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

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

Page 19: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

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”

Page 20: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

CDC 3300

Page 21: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

IBM System/360

Page 22: Computer Science 516 Week 4 Lecture Notes. Addresses Related to C++ pointers Not consistently covered in CS575 Essential to Computer Architecture

Pep-8 Architecture

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