Traffic Light Behavior IF A=1 AND B=0 Car Sensors B A.

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

RAM (cont.) 220 bytes of RAM (1 Mega-byte) 20 bits of address Address
Microcomputer Circuits Prof Jess UEAB 2007 Designing a Microprocessor Chapter 1.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
Introduction to Computers 2010 Class: ________________ Name: ________________.
Overview of Programming and Problem Solving ROBERT REAVES.
Our First Real System.
Introduction to programmable computing devices. Overview What is a computer ? How is the computer developed ?? How to encode instructions in past programmable.
1 Foundations of Software Design Lecture 3: How Computers Work Marti Hearst Fall 2002.
The Logic Machine We looked at programming at the high level and at the low level. The question now is: How can a physical computer be built to run a program?
The Analytical Engine Module 6 Program Translation.
Intoduction First we’ll talk in general about Visual X-Toy Then we’ll input and run a program using switches Then we’ll look at the more advanced editor.
Lecture 1: Intro to Computers Yoni Fridman 6/28/01 6/28/01.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Midterm Review October 23, 2001.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
Machine Languages Different types of CPU’s understand different instructions Pentium family / Celeron / Xeon / AMD K6 / Cyrix … (Intel x86 family) PowerPC.
1 8/28/06CS150 Introduction to Computer Science 1 Professor: Chadd Williams
Henry Hexmoor1 Chapter 10- Control units We introduced the basic structure of a control unit, and translated assembly instructions into a binary representation.
Operating Systems Lecture 1 Crucial hardware concepts review M. Naghibzadeh Reference: M. Naghibzadeh, Operating System Concepts and Techniques, iUniverse.
Chapter 9_1 Following Instructions: Principles of Computer Operation.
Some of these slides are based on material from the ACM Computing Curricula 2005.
Cisc Complex Instruction Set Computing By Christopher Wong 1.
COMPUTING DEVICE I (PRE COMPUTER AGE TO 19TH CENTURY)
Introduction to Computers. Are Computers Important? OF COURSE!
Introduction to computer: storing instructions and information.
The Study of Computer Science Chapter 0 Intro to Computer Science CS1510, Section 2.
BACS 287 Basics of Programming BACS 287.
Computer Hardware and Software Jinchang Wang. Hardware vs. Software Hardware is something tangible. Computer hardware includes electronic circuitry and.
CSCE 106 Fundamentals of Computer Science Assisting Slides The American University in Cairo Computer Science and Engineering Department.
Wilhelm Schickhard (1623) Astronomer and mathematician Automatically add, subtract, multiply, and divide Blaise Pascal (1642) Mathematician Mass produced.
Understanding Computers, Ch.31 Chapter 3 The System Unit: Processing and Memory.
The Study of Computer Science Chapter 0 Intro to Computer Science CS1510.
©Brooks/Cole, 2003 Foundations of Computer Science from Data Manipulation to Theory of Computation Behrouz A. Forouzan, Brooks/Cole — Thomson Learning,
1 8/29/05CS150 Introduction to Computer Science 1 Professor: Shereen Khoja
Introduction to programmable computing devices. What is a computer Computer: How was the computer developed/invented: A computer is a "reckoning" or computing.
Chapter 1 Introduction.
Computer Architecture And Organization UNIT-II General System Architecture.
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
RESOURCE GUIDE STORED PROGRAM CONCEPT. Understand how the von Neumann architecture is constructed. Understand how the von Neumann architecture works.
Computer Science 101 Computer Systems Organization.
Exam Format  105 Total Points  25 Points Short Answer  20 Points Fill in the Blank  15 Points T/F  45 Points Multiple Choice  The above are approximations.
Introduction to Computers. Are Computers Important? OF COURSE!
CS 232: Computer Architecture II Prof. Laxmikant (Sanjay) Kale.
Stored Programs In today’s lesson, we will look at: what we mean by a stored program computer how computers store and run programs what we mean by the.
Computer Organization. The digital computer is a digital system that performs various computational tasks Digital computer use binary number system which.
Why build a computer? u Computers were developed to mechanize mathematical computations. u Two definitions:  A computer is “a programmable electronic.
Computers. Light A Review: State Machine IF A=1 AND B=0 Always IF A=0 AND B=1 Otherwise Light B Otherwise Always.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
Paula Michelle Valenti Garcia #30 9B. MULTICORE TO CLUSTER Parallel circuits processing, symmetric multiprocessor, or multiprocessor: in the PC has been.
CMSC 104, Lecture 061 Stored Programs A look at how programs are executed.
Control units In the last lecture, we introduced the basic structure of a control unit, and translated our assembly instructions into a binary representation.
 A computer is an electronic device that receives data (input), processes data, stores data, and produces a result (output).  It performs only three.
CHAPTER 1 INTRODUCTION.  Data Processor: ◦ The basic definition of a computer is as a data processor. ◦ A black box that: 1.Accepts input data, 2.Processes.
Computer Architecture Adapted from CS10051 originally by Professor: Johnnie Baker Computer Science Department Kent State University von Neuman model.
Chapter 2 content Basic organization of computer What is motherboard
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1 Introduction.
CS 1308 Exam 2 Review.
Introduction to Computing Lecture # 1
CSCE Fall 2013 Prof. Jennifer L. Welch.
The Von Neumann Model Basic components Instruction processing
Topics Introduction Hardware and Software How Computers Store Data
Electronic Homework Submission and Grading
Branch instructions We’ll implement branch instructions for the eight different conditions shown here. Bits 11-9 of the opcode field will indicate the.
The Study of Computer Science
Control units In the last lecture, we introduced the basic structure of a control unit, and translated our assembly instructions into a binary representation.
ECE 352 Digital System Fundamentals
The Study of Computer Science Chapter 0
CS 1308 Exam 2 Review.
Presentation transcript:

Traffic Light Behavior IF A=1 AND B=0 Car Sensors B A

Traffic Light Behavior IF A=1 AND B=0 Otherwise Car Sensors B A

Traffic Light Behavior IF A=1 AND B=0 Always Otherwise Car Sensors B A

Traffic Light Behavior IF A=1 AND B=0 Always Otherwise IF A=0 AND B=1 Car Sensors B A

Traffic Light Behavior IF A=1 AND B=0 Always IF A=0 AND B=1 Otherwise Always Car Sensors B A

Traffic Light Behavior IF A=1 AND B=0 Always IF A=0 AND B=1 Otherwise Always Note: Clock beats every 4 sec. So Light is Yellow for 4 sec. Car Sensors B A

Traffic Light State Machine IF A=1 AND B=0 Always IF A=0 AND B=1 Otherwise Always Note: Clock beats every 4 sec. So Light is Yellow for 4 sec. Car Sensors B A

Traffic Light Design We’ve figured out the logical behavior of the Traffic Light in terms of a State Machine: We know what the states are. For each state, given any input, we know which state to go to next. How do we build it?

Traffic Light Design Thinking this through: Our machine needs to:

Traffic Light Design Thinking this through: Our machine needs to: Remember which state it is in (Memory)

Traffic Light Design Thinking this through: Our machine needs to: Remember which state it is in (Memory) Given the state it is in and input values, it must determine which state to go to next (Logic)

Traffic Light Design Thinking this through: Our machine needs to: Remember which state it is in (Memory) Given the state it is in and input values, it must determine which state to go to next (Logic) And that’s all !

Traffic Light Design Problem 1: Remember which state it is in (Memory) How do represent the states? We could keep one bit of memory for whether Light A is Green or not, whether it is Yellow or not, … This would take 6 bits of memory. There is a much simpler way!

Traffic Light Design Problem 1: Remember which state it is in (Memory) How do represent the states? Answer: Just number them (using binary numbers). We have 4 states. Call them 00, 01, 10, 11. We (human designers) will keep track of what these names mean.

Light A Traffic Light States IF A=1 AND B=0 Always IF A=0 AND B=1 Otherwise Light B Otherwise Always

Light A Traffic Light States IF A=1 AND B=0 Always IF A=0 AND B=1 Otherwise Light B Otherwise Always

Traffic Light Design Problem 2: Given the state it is in and input values, it must determine which state to go to next (Logic) Answer:

Traffic Light Design Problem 2: Given the state it is in and input values, it must determine which state to go to next (Logic) Answer: Build a Truth Table Use Universal Method!

Traffic Light Behavior Build A Truth Table for next state / Output M 1 M 2 ABD 1 D 2 Light A RedLight B Red …

Light A Traffic Light Behavior IF A=1 AND B=0 Always IF A=0 AND B=1 Otherwise Light B Otherwise Always

Traffic Light Behavior Build A Truth Table for next state / Output M 1 M 2 ABD 1 D 2 Light A RedLight B Red …

Light A Traffic Light Behavior IF A=1 AND B=0 Always IF A=0 AND B=1 Otherwise Light B Otherwise Always

Traffic Light Behavior Build A Truth Table for next state / Output M 1 M 2 ABD 1 D 2 Light A RedLight B Red … **1010

Light A Traffic Light Behavior IF A=1 AND B=0 Always IF A=0 AND B=1 Otherwise Light B Otherwise Always

Traffic Light Behavior Build A Truth Table for next state / Output M 1 M 2 ABD 1 D 2 Light A RedLight B Red … **

Light A Traffic Light Behavior IF A=1 AND B=0 Always IF A=0 AND B=1 Otherwise Light B Otherwise Always

Traffic Light Behavior Build A Truth Table for next state / Output M 1 M 2 ABD 1 D 2 Light A RedLight B Red … ** **0001

Light A Traffic Light Behavior IF A=1 AND B=0 Always IF A=0 AND B=1 Otherwise Light B Otherwise Always

Traffic Light Behavior Build A Truth Table for next state / Output M 1 M 2 ABD 1 D 2 Light A RedLight B Red … ** ** …………………

Traffic Light Design We understand how to represent which state the system is in (so we can store it in Memory) We understand how the system can determine which state to go to next (Logic) Let’s put it together…

Traffic Light Design Input: Sensor A Input: Sensor B

Traffic Light Design 2-bit Memory Register Current State Write Sensor A Sensor B M1M1 M2M2 D1D1 D2D2

Traffic Light Design 2-bit Memory Register Write Sensor A Sensor B Logic For Next State & Output 6 Outputs: for each Light Current State Next State

Traffic Light Design 2-bit Memory Register Write Sensor A Sensor B Logic For Next State & Output 6 Outputs: for each Light Current State

Traffic Light Design 2-bit Memory Register Clock Sensor A Sensor B Logic For Next State & Output 6 Outputs: for each Light Current State

Design for Any State Machine Memory Register Clock Inputs Logic For Next State & Output Outputs Current State Many bits

State Machines in Real Life Elevator control systems Car control systems VCR’s Alarm Clocks Personal Computers … Just about everything!

More Sophisticated Designs Just add more states, more inputs, more outputs, more rules… Example: Add a longer delay before Traffic Light changes from Yellow to Red. (Say 8 seconds instead of 4.)

Light A Traffic Light Behavior IF A=1 AND B=0 Always IF A=0 AND B=1 Otherwise Light B Otherwise Always

More Sophisticated Designs Note that the new “delay” states we added correspond to the SAME combinations of lights as other states (Red/Yellow). The purpose of the new states is only to add delays. Logical states need not correspond to different observable states of the machine!

More Sophisticated Designs Can also add other State Machines!

More Sophisticated Designs Example (Fairness): We might want a separate Timer machine for the Traffic Light: If cars keep coming, Light should decide after 3 minutes to switch lights. A Timer is just a state machine that keeps counting beats of the Clock

More Sophisticated Designs Inputs Outputs Timer State Machine Main State Machine

Computers! State Machines that you can program

Review In designing state machines, we used: Binary Representation (to represent states) Memory (to store the current state) Logic Circuits & Universal Method (to determine the next state) In this way, we learned how to build special-purpose digital systems (e.g. traffic lights)

General Purpose Computers What makes a PC different? Today your PC can’t play Final Fantasy X. Tonight, you buy the Final Fantasy X CD-ROM Tomorrow your PC can play the game! PC’s are general-purpose computers. Realize state machines for traffic lights, digital cameras, VCR’s, … You can write a program (software) to control the circuitry (hardware) of a general purpose computer

The Stored Program Idea is simple: Build a machine that can execute certain instructions. Then, write down different lists of instructions (programs) to accomplish different things. One program plays an adventure game Another program lets you write papers Another lets you surf the Web

Using software to control hardware –Hardware is fixed circuitry –Software is instructions to the processor to control the inputs to the fixed circuitry Inputs to the hardware are of 2 types –Data –Program We don’t differentiate –Both are stored in computer’s memory Programming

History of Programmable Machines First “programmable system” was the early printing process developed in China circa 800 C.E. First “program” was perhaps Chinese translation of Buddhist Canon (the Tipitaka)

History (cont.) Gutenberg’s Printing Press (circa 1450) Main Contribution: Just a few “basic instructions” (smaller alphabet size) suffice.

History (cont.) Huygen’s Pendulum Clock (circa 1650) Main Contribution: Timing, “clock ticks” increase accuracy

History (cont.) Musical Machines: Barrel Organs (1500!) Music boxes (between) Player Pianos (c. 1700) Main Contributions: Drive cylinder or disk with “pins” (bits!!) which play notes at the right time Change disk -> change song!!

History (cont.) Jacquard’s Loom (circa 1810) Punched Cards stored program for weaving patterns.

History (cont.) Charles Babbage ( ): Input -- Punched Cards Hardware -- general-purpose mechanical mathematical system (Analytical Engine) -- never built Could be programmed punched card could say: “Go back 5 punched cards” Instructions could be Executed repeatedly, or in different order.

The Modern Computer Basic Idea still the same: A machine that can execute certain instructions. Machine instructions represented by sequences of 0’s and 1’s (Machine Language) Instructions, and data, stored in Memory von Neumann (1945) Princeton, NJ

Memory We’ve seen that memory can be used to build State Machines. In modern computers, memory is also used in a different way: Big arrays of Memory called RAM : Random Access Memory RAM is a place to store information while the computer is running The information includes the data that the program reads and writes, as well as the program itself (I.e. its instructions)

Programs are Just Like Data One of the important features of the von Neumann model is the fact that: The instructions themselves And The data the instructions manipulate are all stored in the same RAM. This was one of the revolutionary features of the modern computer, totally unlike Punch-Card computers proposed in the past.

Programs are Just Like Data This innovation is crucial to modern computing. It even allows for the possibility of programs that change themselves as they are executed. With great power comes great risk… Computer Viruses!

How Memory (RAM) Works Take a single bit of memory… D Write M

RAM (cont.) Group 8 of them together. 8 bits (b) is called a byte (B). Most RAM is arranged in bytes. D M W D M W D M W D M W D M W D M W D M W D M W

RAM (cont.) A byte of memory (a.k.a. an 8-bit register) 8 bits (1 byte) of Memory 8 bits Output 8 bits input Write

RAM (cont.) We want a HUGE number of such 1 byte memory cells. 1B

RAM (cont.) We want a HUGE number of such 1 byte memory cells. Problem: How do we indicate which byte of memory we want to use at any given time? 1B

RAM (cont.) Solution: Assign each byte an address. We can number all the bytes in binary. Each byte’s assigned number is called the byte’s address in memory. Then, we can ask the RAM: What is byte number ? Or tell the RAM: Write “ ” into memory at address

RAM (cont.) 2 20 bytes of RAM (1 Mega-byte) Write Address Data input Data Output

RAM (cont.) 2 20 bytes of RAM (1 Mega-byte) Write Address Data input Data Output 20 bits of address

RAM (cont.) 2 20 bytes of RAM (1 Mega-byte) Write Address Data input Data Output 20 bits of address 8 bits (1 byte) of data