our first real system
DESCRIPTION
Our First Real System. Review. On our way to building a computer…. Represent Info with 0’s & 1’s (aka bits). Logic Circuits: Universal Method. 0’s & 1’s. Memory Circuits. Computers. We are here. The System Clock. “500 Mhz Pentium III computer…” What does “500 Mhz” mean? - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/1.jpg)
Our First Real System
![Page 2: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/2.jpg)
ReviewOn our way to building a computer…
Computers
We are here
LogicCircuits:UniversalMethod
0’s&1’s
RepresentInfo with0’s & 1’s(aka bits)
MemoryCircuits
![Page 3: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/3.jpg)
The System Clock
• “500 Mhz Pentium III computer…”
• What does “500 Mhz” mean?
• It refers to the speed of the System Clock. (actually this is only one of the clocks…)
• All digital systems have such “Clocks,” even traffic lights and elevator control systems.
![Page 4: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/4.jpg)
Clocks: Some Terminology
• Think of System Clock as a heart.
• How fast it beats is measured in Hertz (Hz) which means “cycles per second”
• Prefixes:
• Kilo = 1,000
• Mega = 1,000,000
• Giga = 1,000,000,000
![Page 5: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/5.jpg)
The System Clock (cont.)
• Rough idea: System takes a “step” every time the System Clock beats.
• We’ll see how this works in an example.
• In real life, Clock is a Quartz crystal,which sends out 0’s and 1’s on a wire.
• In every cycle, it changes from 0 to 1 and back to 0
0
![Page 6: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/6.jpg)
The System Clock (cont.)
• Rough idea: System takes a “step” every time the System Clock beats.
• We’ll see how this works in an example.
• In real life, Clock is a Quartz crystal,which sends out 0’s and 1’s on a wire.
• In every cycle, it changes from 0 to 1 and back to 0
1
![Page 7: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/7.jpg)
The System Clock (cont.)
• Rough idea: System takes a “step” every time the System Clock beats.
• We’ll see how this works in an example.
• In real life, Clock is a Quartz crystal,which sends out 0’s and 1’s on a wire.
• In every cycle, it changes from 0 to 1 and back to 0
0
![Page 8: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/8.jpg)
The System Clock (cont.)
• Rough idea: System takes a “step” every time the System Clock beats.
• We’ll see how this works in an example.
• In real life, Clock is a Quartz crystal,which sends out 0’s and 1’s on a wire.
• In every cycle, it changes from 0 to 1 and back to 0
1
![Page 9: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/9.jpg)
The System Clock (cont.)
• Rough idea: System takes a “step” every time the System Clock beats.
• We’ll see how this works in an example.
• In real life, Clock is a Quartz crystal,which sends out 0’s and 1’s on a wire.
• In every cycle, it changes from 0 to 1 and back to 0
0
![Page 10: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/10.jpg)
The System Clock (cont.)
• Rough idea: System takes a “step” every time the System Clock beats.
• We’ll see how this works in an example.
• In real life, Clock is a Quartz crystal,which sends out 0’s and 1’s on a wire.
• In every cycle, it changes from 0 to 1 and back to 0
1
![Page 11: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/11.jpg)
The System Clock (cont.)
• Rough idea: System takes a “step” every time the System Clock beats.
• We’ll see how this works in an example.
• In real life, Clock is a Quartz crystal,which sends out 0’s and 1’s on a wire.
• In every cycle, it changes from 0 to 1 and back to 0
0
![Page 12: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/12.jpg)
The System Clock (cont.)
• Rough idea: System takes a “step” every time the System Clock beats.
• We’ll see how this works in an example.
• In real life, Clock is a Quartz crystal,which sends out 0’s and 1’s on a wire.
• In every cycle, it changes from 0 to 1 and back to 0
1
![Page 13: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/13.jpg)
The System Clock (cont.)
• Rough idea: System takes a “step” every time the System Clock beats.
• We’ll see how this works in an example.
• In real life, Clock is a Quartz crystal,which sends out 0’s and 1’s on a wire.
• In every cycle, it changes from 0 to 1 and back to 0
0
![Page 14: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/14.jpg)
Our System:A Traffic Light
![Page 15: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/15.jpg)
A Traffic Light
• Intersection of two one-way roads
![Page 16: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/16.jpg)
A Traffic Light
• Intersection of two one-way roads
CarSensors
B
A
![Page 17: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/17.jpg)
Traffic Light System Clock
• Traffic Lights don’t have to act very fast.
• Let’s say the System Clock only beatsonce every 4 seconds.
• This is 0.25 Hz.
(a few Billion times slower than your PC)
![Page 18: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/18.jpg)
Traffic Light Design
• How do we go about designing the Traffic Light?
• First, let’s think about all the possible States of the traffic light.
![Page 19: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/19.jpg)
Traffic Light
• Intersection of two one-way roads
CarSensors
B
A
![Page 20: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/20.jpg)
Light
A
Light B
![Page 21: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/21.jpg)
Light
A
Light B
Possible States
![Page 22: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/22.jpg)
Light
A
Light B
Possible States
![Page 23: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/23.jpg)
Light
A
Light B
Possible States
![Page 24: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/24.jpg)
Light
A
Light B
Possible States
![Page 25: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/25.jpg)
Light
A
Light B
Actually Only 4 Possibilities
![Page 26: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/26.jpg)
Traffic Light Design
• We figured out some possible States of the Traffic Light.
• Next, we should think logically about how the Traffic Light should behave.
• For now, we will try to keep it simple.
• (Suppose these are infrequently used country roads.)
![Page 27: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/27.jpg)
Lig
ht
A
Light B
How should the Light behave?
CarSensors
B
A
![Page 28: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/28.jpg)
Light
A
Light B
Traffic Light Behavior
IF A=1
AND B=0
![Page 29: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/29.jpg)
Light
ATraffic Light Behavior
IF A=1
AND B=0
Otherwise
Light B
![Page 30: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/30.jpg)
Light
ATraffic Light Behavior
IF A=1
AND B=0
Always
Otherwise
Light B
![Page 31: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/31.jpg)
Light
ATraffic Light Behavior
IF A=1
AND B=0
Always
Otherwise
Light BOtherwise
IF A=0
AND B=1
![Page 32: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/32.jpg)
Light
ATraffic Light Behavior
IF A=1
AND B=0
Always
IF A=0
AND B=1
Otherwise
Light BOtherwise
Always
![Page 33: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/33.jpg)
Light
ATraffic Light Behavior
IF A=1
AND B=0
Always
IF A=0
AND B=1
Otherwise
Light BOtherwise
Always
Note:Clock beatsevery 4 sec.So Light is Yellow for
4 sec.
![Page 34: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/34.jpg)
Light
ATraffic Light State Machine
IF A=1
AND B=0
Always
IF A=0
AND B=1
Otherwise
Light BOtherwise
Always
Note:Clock beatsevery 4 sec.So Light is Yellow for
4 sec.
![Page 35: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/35.jpg)
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?
![Page 36: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/36.jpg)
Traffic Light Design
• Thinking this through:
• Our machine needs to:
![Page 37: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/37.jpg)
Traffic Light Design
• Thinking this through:
• Our machine needs to:
• Remember which state it is in (Memory)
![Page 38: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/38.jpg)
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 tonext (Logic)
![Page 39: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/39.jpg)
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 tonext (Logic)
• And that’s all !
![Page 40: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/40.jpg)
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!
![Page 41: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/41.jpg)
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.
![Page 42: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/42.jpg)
Light
ATraffic Light States
IF A=1
AND B=0
Always
IF A=0
AND B=1
Otherwise
Light BOtherwise
Always
![Page 43: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/43.jpg)
Light
ATraffic Light States
IF A=1
AND B=0
Always
IF A=0
AND B=1
Otherwise
Light BOtherwise
Always
00 01
1011
![Page 44: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/44.jpg)
Traffic Light Design
• Problem 2:
• Given the state it is in and input values, it must determine which state to go tonext (Logic)
• Answer:
![Page 45: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/45.jpg)
Traffic Light Design
• Problem 2:
• Given the state it is in and input values, it must determine which state to go tonext (Logic)
• Answer:
• Build a Truth Table
• Use Universal Method!
![Page 46: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/46.jpg)
Traffic Light BehaviorBuild A Truth Table
for next state / Output
M1 M2 A B D1 D2 Light A Red Light B Red …
![Page 47: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/47.jpg)
Light
ATraffic Light Behavior
IF A=1
AND B=0
Always
IF A=0
AND B=1
Otherwise
Light BOtherwise
Always
00 01
1011
![Page 48: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/48.jpg)
Traffic Light BehaviorBuild A Truth Table
for next state / Output
M1 M2 A B D1 D2 Light A Red Light B Red …
0 0 1 0 0 1 1 0
![Page 49: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/49.jpg)
Light
ATraffic Light Behavior
IF A=1
AND B=0
Always
IF A=0
AND B=1
Otherwise
Light BOtherwise
Always
00 01
1011
![Page 50: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/50.jpg)
Traffic Light BehaviorBuild A Truth Table
for next state / Output
M1 M2 A B D1 D2 Light A Red Light B Red …
0 0 1 0 0 1 1 0
0 1 * * 1 0 1 0
![Page 51: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/51.jpg)
Light
ATraffic Light Behavior
IF A=1
AND B=0
Always
IF A=0
AND B=1
Otherwise
Light BOtherwise
Always
00 01
1011
![Page 52: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/52.jpg)
Traffic Light BehaviorBuild A Truth Table
for next state / Output
M1 M2 A B D1 D2 Light A Red Light B Red …
0 0 1 0 0 1 1 0
0 1 * * 1 0 1 0
1 0 0 1 1 1 0 1
![Page 53: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/53.jpg)
Light
ATraffic Light Behavior
IF A=1
AND B=0
Always
IF A=0
AND B=1
Otherwise
Light BOtherwise
Always
00 01
1011
![Page 54: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/54.jpg)
Traffic Light BehaviorBuild A Truth Table
for next state / Output
M1 M2 A B D1 D2 Light A Red Light B Red …
0 0 1 0 0 1 1 0
0 1 * * 1 0 1 0
1 0 0 1 1 1 0 1
1 1 * * 0 0 0 1
![Page 55: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/55.jpg)
Light
ATraffic Light Behavior
IF A=1
AND B=0
Always
IF A=0
AND B=1
Otherwise
Light BOtherwise
Always
00 01
1011
![Page 56: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/56.jpg)
Traffic Light BehaviorBuild A Truth Table
for next state / Output
M1 M2 A B D1 D2 Light A Red Light B Red …
0 0 1 0 0 1 1 0
0 1 * * 1 0 1 0
1 0 0 1 1 1 0 1
1 1 * * 0 0 0 1
0 0 0 0 0 0 1 0
… … … … … … …
![Page 57: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/57.jpg)
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…
![Page 58: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/58.jpg)
Traffic Light Design
Input: Sensor A
Input: Sensor B
![Page 59: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/59.jpg)
Traffic Light Design
2-bitMemoryRegister
Current State
Write
Sensor A
Sensor B
M1
M2
D1
D2
![Page 60: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/60.jpg)
Traffic Light Design
2-bitMemoryRegisterWrite
Sensor A
Sensor B
Logic For
Next State
&Output 6 Outputs:
for eachLight
Current State
NextState
![Page 61: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/61.jpg)
Traffic Light Design
2-bitMemoryRegisterWrite
Sensor A
Sensor B
Logic For
Next State
&Output 6 Outputs:
for eachLight
Current State
![Page 62: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/62.jpg)
Traffic Light Design
2-bitMemoryRegisterClock
Sensor A
Sensor B
Logic For
Next State
&Output 6 Outputs:
for eachLight
Current State
![Page 63: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/63.jpg)
Design for Any State Machine
MemoryRegisterClock
Inputs
Logic For
Next State
&Output Outputs
Current State
Manybits
![Page 64: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/64.jpg)
State Machinesin Real Life
• Elevator control systems
• Car control systems
• VCR’s
• Alarm Clocks
• Personal Computers
• … Just about everything!
![Page 65: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/65.jpg)
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.)
![Page 66: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/66.jpg)
Light
ATraffic Light Behavior
IF A=1
AND B=0
Always
IF A=0
AND B=1
Otherwise
Light BOtherwise
Always
AlwaysAlways
![Page 67: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/67.jpg)
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!
![Page 68: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/68.jpg)
More Sophisticated Designs• Can also add other State Machines!
![Page 69: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/69.jpg)
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
![Page 70: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/70.jpg)
More Sophisticated Designs
Inputs Outputs
TimerState
Machine
Main StateMachine
![Page 71: Our First Real System](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56813df3550346895da7ce22/html5/thumbnails/71.jpg)
Next Time:Computers!
State Machines that you can program