CS 126 Lecture A1: TOY Machine Outline Introduction Toy machine - - PowerPoint PPT Presentation

cs 126 lecture a1 toy machine outline
SMART_READER_LITE
LIVE PREVIEW

CS 126 Lecture A1: TOY Machine Outline Introduction Toy machine - - PowerPoint PPT Presentation

CS 126 Lecture A1: TOY Machine Outline Introduction Toy machine Machine language instructions Example machine language programs Conclusions CS126 9-1 Randy Wang Brief History Leading to the Dominance of von Neumann


slide-1
SLIDE 1

CS 126 Lecture A1: TOY Machine

slide-2
SLIDE 2

CS126 9-1 Randy Wang

Outline

  • Introduction
  • Toy machine
  • Machine language instructions
  • Example machine language programs
  • Conclusions
slide-3
SLIDE 3

CS126 9-2 Randy Wang

Brief History Leading to the Dominance of von Neumann Architecture

  • 1940s, Atanasoff, Iowa State, first special-purpose electronic

computer, binary representation of numbers

  • ~1946, ENIAC, Eckert and Mauchly, UPenn, first general-purpose

electronic computer

  • 100 ft long, 8.5 ft high, several ft wide, 18000 vacuum tubes
  • conditional jumps, programmable
  • code: setting switches, data: punch cards
  • Used to compute artillery firing tables
  • 1944, von Neumann, visited ENIAC, the “von Neumann Memo”,

concept of a “stored-program” computer

  • 1949, Wilkes, EDSAC, first stored-program computer
  • 1946, von Neumann, Goldstine, Burks, IAS machine, Princeton, the

report pioneered most modern computer architecture concepts

slide-4
SLIDE 4

CS126 9-3 Randy Wang

Why Study Machine Language Programming Today

  • Learn how computers really work
  • There are still (a few) situations where machine language

programming is necessary

  • The first step towards understanding how to build better

computers

slide-5
SLIDE 5

CS126 9-4 Randy Wang

Outline

  • Introduction
  • Toy machine
  • Machine language instructions
  • Example machine language programs
  • Conclusions
slide-6
SLIDE 6

CS126 9-5 Randy Wang

Toy Machine

slide-7
SLIDE 7

CS126 9-6 Randy Wang

Inside the Box

  • ALU (arithmetic logic unit) -- executes instructions to

manipulate date

  • 8 registers -- the fastest form of storage, on-chip in modern

computers, used as scratch space during computation

  • PC (program counter) -- a register with special meaning,

keeps track of the next instruction to be executed

  • 256 16-bit words of memory -- stores both code and data

Registers ALU PC CPU chip Memory chips

slide-8
SLIDE 8

CS126 9-7 Randy Wang

Binary Numbers

slide-9
SLIDE 9

CS126 9-8 Randy Wang

Hexadecimal Numbers

slide-10
SLIDE 10
slide-11
SLIDE 11

CS126 9-10 Randy Wang

Program and Data

slide-12
SLIDE 12

CS126 9-11 Randy Wang

How to Use the TOY Machine

slide-13
SLIDE 13

CS126 9-12 Randy Wang

How to Use the TOY Machine

slide-14
SLIDE 14

CS126 9-13 Randy Wang

Outline

  • Introduction
  • Toy machine
  • Machine language instructions
  • Example machine language programs
  • Conclusions
slide-15
SLIDE 15

CS126 9-14 Randy Wang

TOY Instructions

arithemetic control flow memory logic

  • Encode each of

these instructions using 16 bits

  • Need to divide up

the 16 bits to denote components of each type of instructions

  • Instruction formats -

different ways of dividing up the 16 bits

slide-16
SLIDE 16

CS126 9-15 Randy Wang

Instruction Format 1

slide-17
SLIDE 17

CS126 9-16 Randy Wang

Instruction Format 2

slide-18
SLIDE 18

CS126 9-17 Randy Wang

Logical Instructions

  • pcode
slide-19
SLIDE 19

CS126 9-18 Randy Wang

Right-Shift

1001010110000011 0000000000100101 x x>>10

discarded 0-filled

slide-20
SLIDE 20

CS126 9-19 Randy Wang

Bit-by-Bit-And

1001010110000010 0011001010110011 0001001010000010 a b a&b

slide-21
SLIDE 21

CS126 9-20 Randy Wang

Other Logical Operations

slide-22
SLIDE 22

CS126 9-21 Randy Wang

Outline

  • Introduction
  • Toy machine
  • Machine language instructions
  • Example machine language programs
  • Conclusions
slide-23
SLIDE 23
slide-24
SLIDE 24

CS126 9-23 Randy Wang

TOY Demo

slide-25
SLIDE 25
slide-26
SLIDE 26

N sum

slide-27
SLIDE 27

CS126 9-26 Randy Wang

Horner’s Method

slide-28
SLIDE 28

CS126 9-27 Randy Wang

Sample TOY Program 3: Horner’s Method

slide-29
SLIDE 29

CS126 9-28 Randy Wang

LFBSR

slide-30
SLIDE 30

R1 is LFBSR content R2 is a copy of R1 So is R3 Get 3rd bit to the right end Get 10th bit to the right end Only right-most bit of xor Left shift LFBSR Put in the new right-most bi

slide-31
SLIDE 31

CS126 9-30 Randy Wang

Outline

  • Introduction
  • Toy machine
  • Machine language instructions
  • Example machine language programs
  • Conclusions
slide-32
SLIDE 32

CS126 9-31 Randy Wang

Basic Characteristics of TOY Machine

slide-33
SLIDE 33

CS126 9-32 Randy Wang

“Computer Architecture”

  • Interface--“instruction set architecture” (ISA)
  • visible to machine language programmers
  • boundary between software and hardware
  • Implementation
  • “Organization”: interaction of high-level components
  • “Hardware”: low level specifics such as detailed logic design
  • Abstractions
  • Can change hardware without changing organization
  • Can change implementation without changing ISA

Instruction Set Architecture: instruction set, registers, memory Compilers Machine language programmers Implementation: “Organization” and “Hardware” “Computer Architecture”