EE457x5 P1 loop counter temp · 2018. 8. 20. · 1 Traffic Light Problem to practice counter...

10
P1_T1_029

Transcript of EE457x5 P1 loop counter temp · 2018. 8. 20. · 1 Traffic Light Problem to practice counter...

Page 1: EE457x5 P1 loop counter temp · 2018. 8. 20. · 1 Traffic Light Problem to practice counter initialization, incrementing or decrementing, and terminal value checking 1.1 HW#7 problem

P1_T1_029

Page 2: EE457x5 P1 loop counter temp · 2018. 8. 20. · 1 Traffic Light Problem to practice counter initialization, incrementing or decrementing, and terminal value checking 1.1 HW#7 problem

P1_T1_030

Page 3: EE457x5 P1 loop counter temp · 2018. 8. 20. · 1 Traffic Light Problem to practice counter initialization, incrementing or decrementing, and terminal value checking 1.1 HW#7 problem

~ R

eset

P1_T1_031

Page 4: EE457x5 P1 loop counter temp · 2018. 8. 20. · 1 Traffic Light Problem to practice counter initialization, incrementing or decrementing, and terminal value checking 1.1 HW#7 problem

~ R

eset

P1_T1_032

Page 5: EE457x5 P1 loop counter temp · 2018. 8. 20. · 1 Traffic Light Problem to practice counter initialization, incrementing or decrementing, and terminal value checking 1.1 HW#7 problem

P1_T1_033

Page 6: EE457x5 P1 loop counter temp · 2018. 8. 20. · 1 Traffic Light Problem to practice counter initialization, incrementing or decrementing, and terminal value checking 1.1 HW#7 problem

P1_T1_034

Page 7: EE457x5 P1 loop counter temp · 2018. 8. 20. · 1 Traffic Light Problem to practice counter initialization, incrementing or decrementing, and terminal value checking 1.1 HW#7 problem

ee102_midterm1_Sp2005.fm

4/1/05 EE102L Midterm #1 - Spring 2005 4 / 8 C Copyright 2005 Gandhi Puvvada

4 ( 30 points) 20 min. Loop Counter incrementation and checking:

States: I = Initial; DA = Double A; DB = Double B;DAB = Double A as well as B;

The five diagrams on the side are similar. Pay attention to when I is incremented and when the NSL looks at I, possible rollover by counter, etc.

For each diagram, answer the following four questions:1. How many times A gets doubled? 2. How many times B gets doubled?3. Any state transition arrows that are NEVER taken?4. What is the value of I when you are in DONE state?

State Diagram #1 1. A gets doubled ___ times. 2. B gets doubled ___ times. 3. 4. I =

State Diagram #2 1. A gets doubled ___ times. 2. B gets doubled ___ times. 3. 4. I =

State Diagram #3 1. A gets doubled ___ times. 2. B gets doubled ___ times. 3. 4. I =

State Diagram #4 1. A gets doubled ___ times. 2. B gets doubled ___ times. 3. 4. I =

State Diagram #5 1. A gets doubled ___ times. 2. B gets doubled ___ times. 3. 4. I =

IA<=Ain;B<=Bin;I<= 0;

RESETS

S

I = 2I = 3

I = 2

I = 3

D

DA DBA<=2*A; B<=2*B;I<=I+1;

ACK

ACK

State Diagram #1

IA<=Ain;B<=Bin;I<= 0;

RESETS

S

I = 3I = 2

I = 3

I = 2

D

DA DBA<=2*A; B<=2*B;

I<=I+1;

ACK

ACK

State Diagram #2

IA<=Ain;B<=Bin;I<= 0;

RESETS

1

I = 3

I = 3

D

DA DBA<=2*A; B<=2*B;I<=I+1;

ACK

ACK

State Diagram #3

IA<=Ain;B<=Bin;I<= 0;

RESETS

S

I = 2

I = 2

D

DA DBA<=2*A; B<=2*B;I<=I+1;

ACK

ACK

State Diagram #4

S

1

IA<=Ain;B<=Bin;I<= 0;

RESETS

S

I = 2

I = 2

D

DABA<=2*A;B<=2*B;I<=I+1;

ACK

ACK

State Diagram #5

P1_T1_035

Page 8: EE457x5 P1 loop counter temp · 2018. 8. 20. · 1 Traffic Light Problem to practice counter initialization, incrementing or decrementing, and terminal value checking 1.1 HW#7 problem

P1_T1_036

Page 9: EE457x5 P1 loop counter temp · 2018. 8. 20. · 1 Traffic Light Problem to practice counter initialization, incrementing or decrementing, and terminal value checking 1.1 HW#7 problem

February 13, 2017 8:24 am C Copyright 2017 Gandhi Puvvada

1 Traffic Light Problem to practice counter initialization, incrementing or decrementing, and terminal value checking

1.1 HW#7 problem

1.2 EE254L Fall 2015 Final Question: A single 5-bit up/down counter is used in the state machine on the side to control the Jefferson/Vermont lights (Green and Yellow). It start with I == 0 in JG. The clock frequency is 1c/s. Find the number of seconds for each of the four light together with the range of values of the counter in that light.JG: 30 sec. Irange = [00:29]JY: __ sec. I range = [__:__] VG: __ sec. I range = [__:__] VY: __ sec. I range = [__:__]

1.2.1 Redesign the above traffic light controller with an up-only counter and a down-only counter, both starting with (I==0) in JG state.We want the same number of clocks (seconds) spent in each of the 4 states:

A

B

C

D

ENP ENT

EGC

GC

LOAD CLR

QA

QB

QC

QD

RCOCK

VCC

MAX-JG

MAX-VG

~C_CLR

74LS163A

A

B

C

D

ENP ENT

EYC

YC

LOAD CLR

QA

QB

QC

QD

RCOCK

VCC

MAX-JY

MAX-VY

~C_CLR

74LS163A

JYJG

VY VG

RESETif I==26I <= I +1;

(I=29)

(I=29)I <= 10;

else I<= I -1;

I <= I -1;

(I=26)

(I=26)

(I=0)

(I=0)

if I==26I <= 0;

else I< =I -1;

(I=26)(I=26)

JYJG

VY VG

RESETJYJG

VY VG

RESET

JG: 30 sec. I range = [00 : ]JY: 5 sec. I range = [__ : __] VG: 11 sec. I range = [__ : __] VY: 6 sec. I range = [__ : __]

JG: 30 sec. I range = [00 : ]JY: 5 sec. I range = [__ : __] VG: 11 sec. I range = [__ : __] VY: 6 sec. I range = [__ : __]

P1_T1_037

Page 10: EE457x5 P1 loop counter temp · 2018. 8. 20. · 1 Traffic Light Problem to practice counter initialization, incrementing or decrementing, and terminal value checking 1.1 HW#7 problem

February 13, 2017 8:24 am C Copyright 2017 Gandhi Puvvada

1 Traffic Light Problem to practice counter initialization, incrementing or decrementing, and terminal value checking

1.1 HW#7 problem

1.2 EE254L Fall 2015 Final Question: A single 5-bit up/down counter is used in the state machine on the side to control the Jefferson/Vermont lights (Green and Yellow). It start with I == 0 in JG. The clock frequency is 1c/s. Find the number of seconds for each of the four light together with the range of values of the counter in that light.JG: 30 sec. Irange = [00:29]JY: __ sec. I range = [__:__] VG: __ sec. I range = [__:__] VY: __ sec. I range = [__:__]

1.2.1 Redesign the above traffic light controller with an up-only counter and a down-only counter, both starting with (I==0) in JG state.We want the same number of clocks (seconds) spent in each of the 4 states:

A

B

C

D

ENP ENT

EGC

GC

LOAD CLR

QA

QB

QC

QD

RCOCK

VCC

MAX-JG

MAX-VG

~C_CLR

74LS163A

A

B

C

D

ENP ENT

EYC

YC

LOAD CLR

QA

QB

QC

QD

RCOCK

VCC

MAX-JY

MAX-VY

~C_CLR

74LS163A

JYJG

VY VG

RESETif I==26I <= I +1;

(I=29)

(I=29)I <= 10;

else I<= I -1;

I <= I -1;

(I=26)

(I=26)

(I=0)

(I=0)

if I==26I <= 0;

else I< =I -1;

(I=26)(I=26)

JYJG

VY VG

RESETJYJG

VY VG

RESET

JG: 30 sec. I range = [00 : ]JY: 5 sec. I range = [__ : __] VG: 11 sec. I range = [__ : __] VY: 6 sec. I range = [__ : __]

JG: 30 sec. I range = [00 : ]JY: 5 sec. I range = [__ : __] VG: 11 sec. I range = [__ : __] VY: 6 sec. I range = [__ : __]

P1_T1_038