Practice assignment 7 solution - GUC MET

The German University in Cairo
CSEN 605: Digital System Design
Dr.Mohamed Elmahdy
Eng.Yasmin Mohamed
Media Engineering and Technology
Winter 2015
Problem Set 7 Solutions
Memory and Programmable Logic
Discussion: 28/11/2015 – 5/12/2015
*Exercise 7-1: (Problem 8.2)
There are two control signals: x and y. If xy = 10, register R is incremented by 1 and control goes to a
second state. If xy = 01, register R is cleared to zero and control goes from the initial state to a third
state. Otherwise, control stays in the initial state. Assume active-low synchronous reset. Draw:
1) a block diagram showing the controller, datapath unit (with internal registers), and signals
2) the ASMD chart starting from an initial state.
**Problem set taken from: Digital Design 4th Edition by M. Morris Mano. For further exercises check
chapter 8 problems.
Page 1
The German University in Cairo
CSEN 605: Digital System Design
Dr.Mohamed Elmahdy
Eng.Yasmin Mohamed
Media Engineering and Technology
Winter 2015
Exercise 7-2: (Problem 8.3)
Draw the ASMD charts for the following state transitions:
a) If x = 1, control goes from state S1 to state S2; if x = 0, generate a conditional operation R <= R+2
and go from S1 to S2.
b) If x = 1, control goes from S1 to S2 and then to S3; if x = 0, control goes from S1 to S3.
**Problem set taken from: Digital Design 4th Edition by M. Morris Mano. For further exercises check
chapter 8 problems.
Page 2
The German University in Cairo
CSEN 605: Digital System Design
Dr.Mohamed Elmahdy
Eng.Yasmin Mohamed
Media Engineering and Technology
Winter 2015
c) * Start from state S1; then if xy = 00, go to S2; if xy = 10, go to S3; and if xy = 01, go to S1;
otherwise, go to S3.
Exercise 7-3: (Problem 8.5)
Explain how the ASM and ASMD charts differ from a conventional flowchart. Using the figure below as
an illustration, show the difference in interpretation.
**Problem set taken from: Digital Design 4th Edition by M. Morris Mano. For further exercises check
chapter 8 problems.
Page 3
The German University in Cairo
CSEN 605: Digital System Design
Dr.Mohamed Elmahdy
Eng.Yasmin Mohamed
Media Engineering and Technology
Winter 2015
The operations specified in a flowchart are executed sequentially, one at a time. The operations
specified in an ASM chart are executed concurrently for each ASM block. Thus, the operations listed
within a state box, the operations specified by a conditional box and the transfer to the next state in
each ASM block are executed at the same clock edge. For example, in Fig. 8.5 with Start = 1 and Flag = 1,
signal Flush_R is asserted. At the clock edge the state moves to S_2, and register R is flushed.
*Exercise 7-4: (Problem 8.6)
Construct a block diagram and an ASMD chart for a digital system that counts the number of people in a
room. The one door through which people enter the room has a photocell that changes a signal x from 1
to 0 when the light is interrupted. They leave the room from a second door with a similar photocell that
changes a signal y from 1 to 0 when the light is interrupted. The datapath circuit consists of an up-down
counter with a display that shows how many people are in the room.
Note: To avoid counting a person
more than once, the machine waits
until x or y is deasserted before
incrementing or decrementing the
counter. The machine also accounts
for persons entering and leaving
simultaneously.
**Problem set taken from: Digital Design 4th Edition by M. Morris Mano. For further exercises check
chapter 8 problems.
Page 4
The German University in Cairo
CSEN 605: Digital System Design
Dr.Mohamed Elmahdy
Eng.Yasmin Mohamed
Media Engineering and Technology
Winter 2015
*Exercise 7-5: (Problem 8.10)
The state diagram of a control unit is shown in the figure below. It has four states and two inputs x and
y. Draw the equivalent ASM chart. Write and verify a Verilog model of the controller.
**Problem set taken from: Digital Design 4th Edition by M. Morris Mano. For further exercises check
chapter 8 problems.
Page 5
The German University in Cairo
CSEN 605: Digital System Design
Dr.Mohamed Elmahdy
Eng.Yasmin Mohamed
Media Engineering and Technology
Winter 2015
**Problem set taken from: Digital Design 4th Edition by M. Morris Mano. For further exercises check
chapter 8 problems.
Page 6