Introduction Why and what for 2253 Levels of abstraction - - PowerPoint PPT Presentation

introduction
SMART_READER_LITE
LIVE PREVIEW

Introduction Why and what for 2253 Levels of abstraction - - PowerPoint PPT Presentation

Introduction Why and what for 2253 Levels of abstraction Instruction Set Architectures Major parts of any computer von Neumann architecture Flow of control CS2253 Goal: write a simple C program and understand how the


slide-1
SLIDE 1

Introduction

  • Why and what for 2253
  • Levels of abstraction
  • Instruction Set Architectures
  • Major parts of any computer
  • von Neumann architecture
  • Flow of control
slide-2
SLIDE 2

CS2253

  • Goal: write a simple C program and understand

how the computer actually executes it.

  • This year, we study the ARM7TDMI processor.
  • Last year, we used the fictional LC-3.
  • The Church-Turing thesis essentially states that

all systems with a certain minimal computational capability are able to compute the same things as each other. So LC3 vs ARM vs Intel x86 does not matter, at least theoretically.

  • And in actuality, LC3 and ARM etc. are

fundamentally similar.

  • Easy to pick up a second machine....
slide-3
SLIDE 3

Levels of Abstraction

  • From atoms, we build transistors. [Lowest level]
  • From transistors, we built gates (ECE courses).
  • From gates, we build microarchitectures (CS3813) that

implement machine instructions.

  • From machine instructions, we can make simple programs

directly (first part of this course).

  • Or a compiler can string together machine instructions

corresponding to our C code (second part).

  • From simple pieces of C code, we can build OSes,

databases, other complex software systems. [Highest level]

slide-4
SLIDE 4

Textbook Fig 1.9

slide-5
SLIDE 5

Why Should I Care About the Lower Levels?

  • If you want to work in the computer hardware field, it's
  • bvious.
  • If you want to work in software:

– it's sad if you aren't intellectually a little bit curious about

how things really happen.

– when things fail, you tend to need to “see behind the veil” to

understand what is going wrong. Debugging often requires a lower-level view.

– it helps you understand why some operations would be fast,

while others would be slow. (Performance debugging.)

slide-6
SLIDE 6

Microarchitecture example (block diagram, book Figure 1.4)

slide-7
SLIDE 7

Instruction Set Architecture

  • ISA is an important concept. In Java terms, it is like an

Interface to the microarchitecture (hardware).

  • It specifies all the things that you would need to know, to

write a machine-instruction program:

– what are the basic instructions? – how does the machine find the data for instructions? – what are the basic data types supported (bit lengths)? – how is memory organized? – how and where are the instructions stored?

slide-8
SLIDE 8

Multiple implementation of an ISA

  • In Java, several classes can implement the same Interface.
  • So, several microarchitectures can have the same ISA. They

can run the same machine instructions as each other.

  • IBM mainframes in the 1960s: fast implementation if you're

rich, slow ones if not.

  • Today: AMD and Intel processors can run the same code.
  • But computer designers like to extend ISAs over time.

Backward compatibility is the goal. No bad idea ever

  • dropped. Ugly messes like Intel x64 architecture.
slide-9
SLIDE 9

Textbook Fig 1.5

slide-10
SLIDE 10

Major Parts of Any Computer

  • An input and an output facility (from/to people or devices)
  • Memory/Memories to store data and programs
  • A “datapath” with the logic needed to add, multiply, store ...

binary values, etc.

  • A “controller” that goes through the program and makes the

datapath do the required operations, one at a time.

  • Controller + Datapath = Processor (aka CPU)
  • Controller is the “puppeteer” and the datapath is the “puppet”.
slide-11
SLIDE 11

Textbook Figure 1.2: Block diagram

  • f a SOC (system on chip)
slide-12
SLIDE 12

John von Neumann's architecture

  • John von Neumann was a brilliant mathematician (and

statistician and nuclear weapons guy and father of game theory and inventor of MergeSort and ...) who wrote an influential report in 1946 with a computer design.

  • A von Neumann architecture stores the program in (a

different part of) the same memory that stores the data.

  • A Harvard architecture uses separate memories.
  • Modern computers appear to be von Neumann, but behind

the scenes are a bit Harvard-ish.

  • Except for some special-purpose machines.
slide-13
SLIDE 13

Textbook Figure 1.8

slide-14
SLIDE 14

von Neumann and the IAS, 1952

slide-15
SLIDE 15

How a von Neumann Architecture Works

  • The program is a list of instructions located in memory.

Part of the control unit is the Program Counter (PC), which points to the exact place for the current instruction.

  • while (true) {

Fetch current instruction from memory Increment PC Inspect current instruction and do what it says }

  • This is the Fetch-Execute cycle.
slide-16
SLIDE 16

Be a Human CPU

Memory Address 1000 right hand in 1001 right hand out 1002 right hand in 1003 shake it all about 1004 turn yourself around 1005 go back to address 1000

  • “Hokey Pokey”

program

  • PC starts at 1000
  • Fetch and do “right

hand in”; PC ← 1001

  • Fetch and do “right

hand out”;PC ← 1002

  • ….
slide-17
SLIDE 17

Control Flow

  • Normally, when you finish one instruction you

advance to the (sequentially) next one.

  • This is called straight line flow of control. PC just

increments.

  • But there are instructions like “go back to the

instruction at address 1000” that disrupt this.

  • Good thing, since that's how we can do IF and

WHILE in a high-level language.

  • Control flow is often disrupted conditionally,

based on status flags that record what happened earlier (eg, did last addition give -ve result?)

slide-18
SLIDE 18

More Realistic Instructions

  • Instead of “right hand in”, a CPU instruction will be

something simple like a request to take two integers stored locally in the CPU, add them, and store the result in the CPU

  • Or “go to memory location 2000 and load the 8-bit

integer there into the CPU”

  • Or “go back to memory address 1000”, as in the Hokey

Pokey program. A jump or branch instr.

  • A compiler or a programmer needs a lot of simple

instructions to do something more complicated.