Docsity

Lab Exercise with D Flip-Flops - Computer Organization | CPSC 2105, Study notes of Computer Architecture and Organization

Toggle sidebar
bg1
CPSC 2105 / CPSC 5155 Computer Organization/Architecture
Lab Assignment D Flip–Flops
The purpose of this lab is to use a circuit emulation tool to investigate the operation
of a realistic D flip–flop. We shall consider two types: those without the standard
preset and clear inputs and those with the asynchronous clear and preset inputs.
In the lecture notes, the following symbol is used to represent an edge–triggered D flip–flop.
This flip–flop has one input, which is synchronous with the clock. This is the D input.
When the clock goes high, the flip–flop will respond to the D input and change its value.
Remember that the flip–flop value is represented by the output labeled Q,
and the complement of that value is found in the output labeled
Q
.
Using the Multi–Media logic design tool, such a flip–flop might be represented as follows.
The first part of this lab is to create the circuit shown above and run it. Note the use of a
push button to generate the clock input to the flip–flop.
The picture above shows the first output when the simulation is run. Note that the LED for
each of the outputs Q and
Q
is shown as neither red nor black. This output indicates that
the state of the flip–flop is not a known value; it needs to be set by sampling the D input. In
a real circuit, the flip–flop would have a value; it might be Q = 0 or it might be Q = 1.
Page 1 of 4 pages Revised November 8, 2008
pf3
pf4

Partial preview of the text

Download Lab Exercise with D Flip-Flops - Computer Organization | CPSC 2105 and more Study notes Computer Architecture and Organization in PDF only on Docsity!

CPSC 2105 / CPSC 5155 Computer Organization/Architecture

Lab Assignment D Flip–Flops

The purpose of this lab is to use a circuit emulation tool to investigate the operation

of a realistic D flip–flop. We shall consider two types: those without the standard

preset and clear inputs and those with the asynchronous clear and preset inputs.

In the lecture notes, the following symbol is used to represent an edge–triggered D flip–flop.

This flip–flop has one input, which is synchronous with the clock. This is the D input.

When the clock goes high, the flip–flop will respond to the D input and change its value.

Remember that the flip–flop value is represented by the output labeled Q,

and the complement of that value is found in the output labeled

Q .

Using the Multi–Media logic design tool, such a flip–flop might be represented as follows.

The first part of this lab is to create the circuit shown above and run it. Note the use of a

push button to generate the clock input to the flip–flop.

The picture above shows the first output when the simulation is run. Note that the LED for

each of the outputs Q and

Q is shown as neither red nor black. This output indicates that

the state of the flip–flop is not a known value; it needs to be set by sampling the D input. In

a real circuit, the flip–flop would have a value; it might be Q = 0 or it might be Q = 1.

Start the flip–flop by selecting a value for the D input and pressing the clock button.

Here is what the student should see. The picture on the left shows the flip–flop having

reacted to the input D = 0; Q = 0 and

Q = 1. The picture on the right shows the situation for

D = 1. Note that the output does not change until the clock button has been pressed.

Asynchronous Inputs

In general, it is desirable to have asynchronous inputs to a flip–flop. Unlike synchronous

inputs (which are sampled only at the clock pulse), asynchronous inputs affect the state of the

flip–flop immediately. The standard use of these inputs is to initialize the flip–flop value.

Functionally, there are two asynchronous signals: one to clear the flip–flop (set its value to 0)

and one to preset the flip–flop (set its value to 1). As both of these signals are active–low;

the standard notation for them is PRESET and CLEAR , or just PRE

and CLR. The use

of these inputs is indicated in the following truth table.

PRE

CLR Action

0 0 The flip–flop value is undefined.

0 1 The flip–flop is preset; Q = 1.

1 0 The flip–flop is cleared; Q = 0.

1 1 The flip–flop value reflects the D input.

The simplest way to investigate this behavior is shown in the figure below. Note that this

design is probably not useful when the flip–flop is to be used in a real circuit. A later

example will be used to show the more common design.

Note that, in this instance, we have PRE

= 1 and CLR = 0. The flip–flop has been cleared;

this is indicated by the fact that the LED’s indicate that Q = 0 and

Q = 1. The student

should observe that the output of the flip–flop is not defined when PRE

= 1 and CLR = 1.

This is due to the fact that the D input has not been connected to any source.

As an aside, it is generally not practical to have a LED connected to both Q and

Q

. These

early experiments have that arrangement so that the student can always observe something.

One Standard Set–Up

Here is a standard set–up for a D flip–flop that is initialized to Q = 0 and then run. The

student should build this circuit and run the emulation.

When the signal RUN = 0, two things happen. First, the flip–flop is cleared to Q = 0,

as the circuit will have PRE = 1 and CLR = 0. With this input the D input is ignored.

Second, the signal RUN is an input to an AND gate, the other input of which is the clock

signal. When RUN = 0, the clock signal does not reach the flip–flop; it cannot react to the

D–input. This blocking of the clock signal is important in more complex circuits.

When the signal RUN = 1, again two things happen. First, the circuit has its asynchronous

inputs set as PRE = 1 and CLR = 1, enabling it to respond to its D input. Second, the

AND gate will now pass the clock signal, and the flip–flop can function as designed.

The last step in this lab involves replacement of the “push button” system clock with an

oscillator. In order to use this, one needs to select the speed of the simulation so that the

results can be viewed. This is done by selecting the Simulate menu item and then selecting

Setup. One sees a box with two sections. The bottom section, labeled “Simulation Rate”.

Change the rate to something less than 10 Hz (pulses per second); I used 2 Hz. This causes

the clock to “tick” at two pulses per second.

The student should run this circuit and see what happens. Note that there is no need to “keep

up” with the clock; the flip–flop will just change states on the next clock pulse.