class13-HowProgramsRun

class13-HowProgramsRun - How Programs Run Review Hardware =...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
How Programs Run How Programs Run
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Review Review s Hardware = wires, transistors, chips Hardware = wires, transistors, chips Software = bits (voltages on wires) Software = bits (voltages on wires) s Layers of Abstraction: Layers of Abstraction: We can use transistors to build logic gates. We can use transistors to build logic gates. We can use logic gates to perform arithmetic. We can use logic gates to perform arithmetic. s Given a truth table, we can build an equivalent circuit Given a truth table, we can build an equivalent circuit using not/and/or gates. using not/and/or gates. s Given a circuit with not/and/or gates, we can write Given a circuit with not/and/or gates, we can write an equivalent truth table. an equivalent truth table.
Background image of page 2
Computer Processors Your computer processor is a machine that takes in a program and runs it. (The program must be written in the processor's machine language .)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Interpreters An interpreter is a program that takes in a program and runs it. Java is an interpreter, because it takes in your Java programs and runs them. (not completely true)
Background image of page 4
A Simple Interpreter (We played around with LMC.jar, a simple interpreter based on "The Little Man Computer." The language that this interpreter runs is representative of the kind of machine language that your computer processor might run.)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A Simple Machine Language s add : add value at given address to accumulator s goto : go to given line number s ifzero : if accumulator contains zero, go to given line number s input : prompt for number and store at given address s load : load value at given address into accumulator s store : store accumulator value at given address s subtract : subtract value at given address from accumulator
Background image of page 6
Doubling 0: input 15 //input x 1: load 15 //load x 2: add 15 //x + x ... 15: data //x
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Adding 1 0: input 15 //input x 1: load 15 //load x 2: add 14 //add 1 ... 14: data 1 //1 15: data //x
Background image of page 8
0: input 15 //input x 1: load 15 //load x 2: add 14 //add 1 3: goto 2 //repeat ... 14: data
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/14/2010 for the course CS 15-100 taught by Professor Dave during the Spring '08 term at Carnegie Mellon.

Page1 / 46

class13-HowProgramsRun - How Programs Run Review Hardware =...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online