Assessment Lab3Book s2142081
Assessment Lab3Book s2142081
In this lab, 4 experiments have been performed and analysed using concepts related to Boolean algebra, com-
binational and sequential logic. This day book attempts to capture an hour by hour reflection of the process
involved in performing the experiments. Each experiment is structured to first encapsulate my thinking process,
plan and then my attempt at making simulations to verify observations. Challenges and key learning points
have also been recorded.
A1 = A0 · 1 = A0 and B1 = B0 · 1 = B0 (1)
If ports A1 and B0 are connected; the modified circuit has an input signal A0, which results in an output
signal B1. For this circuit, we may now claim mathematicaly that A1 equals B0 (A1 = B0). To simplify this
equation, realise B0 from equation 1 may be expressed as B0 = B1. Substituting these equations and using
the principle of involution to simplify the double negation yields
A1 = A0 = B0 = B1
∴ A1 = B1 =⇒ B1 = A1.
We have realised input signal A0 and output signal B1 are one and the same. Until this point, we have made
multiple theoretical observations. To test if these observations hold merit, we may simulate this circuit using
the LTSpice software and use the CD4000 library to reproduce different forms of logic gates.
1
Figure 2: Modified circuit where A1 = B0 and is also known as a digital buffer.
Figure 3: The voltage vs time relationship for input singal A0 and output signal B1.
As displayed in the graph above, the input and output signals are equivalent in all cases. Hence, the
theoretical observation made above are valid. This circuits is also known as a digital buffer. Digital buffers are
used for a host of purposes such as: amplifying a week signal when driving high current loads and isolating the
input and output circuitry, reducing chances of loading effects casued by high impedances of input circuitry.
2
Before simulating the circuit and analysing its results, we require R S Qn Qn Qn+1 Qn+1
to conduct some preliminary research. It is worth to mention that Q
1 1 1 0 1 0
and Q display an inverse relationship and are so never equal. We can
1 1 0 1 0 1
now build a characteristic table with n = 3 inputs R, S and Qn , which
1 0 1 0 0 1
implies there are 2n = 8 elements in the domain for each variable
1 0 0 1 0 1
(Table 1). As an example take R = S = Qn = 1 and therefore Qn = 0.
0 1 1 0 1 0
In this case, Qn+1 = R NAND Qn = 1 and Qn+1 = S NAND Qn = 0.
0 1 0 1 1 0
The same steps are followed for all other values. The last two rows
0 0 1 0 Invalid Invalid
are invalid, as they claim Qn+1 = Qn+1 which violates their inverse
0 0 0 1 Invalid Invalid
relationship.
Table 1: Characteristic table of RS latch
The characteristic table may can now be represented as a truth
table. When output Q and Q are 1 (HIGH) and 0 (LOW) respectively, R S Qn+1 State
the latch is said to be in the set state. Similarly, when output Q and Q 1 1 Qn No change
are 0 (LOW) and 1 (HIGH) respectively, the latch is said to be in the 1 0 0 Reset
reset state. The RS latch enters a forbidden state when R = S = 0, 0 1 1 Set
in which case outputs Q and Q are equivalent, which is unstable and 0 0 Invalid Forbidden
violates their inverse relationship. Table 2: Truth table of RS latch
We may now begin simulating with different values of R and S. Lets start by setting signal R to 0 (LOW - 0V)
and S to 1 (HIGH - 5V) for 0.1 seconds and then allow both signals to equal 1 for the next 0.1 seconds. Realise,
we do not right away change signal R to 1 and S to 0, as if S reaches 0 before R reaches 1, the latch will be
in its forbidden state. We may now set signal R to equal 1 and S to equal 0 for the next 0.1 seconds and then
allow both signals to equal 1 for another 0.1 seconds to prevent the forbidden state. Lastly, to confirm if the
forbidden state exists or not we may set signals R and S to 0 for 0.1 seconds. After simulating this sequence of
signals, a voltage vs time profile is shown for inputs and outputs in Figure 5.
Figure 5: The relationship between voltage and time for different input and output values of a RS latch.
We can formulate a truth table as demonstrated in Table 3. As shown from the profile and truth table,
when input R = 0 and S = 1, the outputs are in their set state where Q = 1 and Q = 0. Then, when both
inputs R and S change to 1, the outputs remain in the set state. Similarly, when input R = 1 and S = 0, the
outputs are in their reset state where Q = 0 and Q = 1. Likewise, when both inputs R and S return to 1, the
3
outputs remain in their reset state. When both inputs R and S are equal to 0, the outputs enter their forbidden
state where Q and Q equal 1. These results confirm our theoretical findings made above. Using these we can
produce a state diagram as shown in Figure 6.
R S Q Q State
0 1 1 0 Set
1 1 1 0 No change
1 0 0 1 Reset
1 1 0 1 No change
0 0 1 1 Forbidden
Table 3: Truth table for RS latch.
Hence, the RS latch has two stable states (set and reset), which can be used to store information or used
as a start and stop switch for multiple machinery. However, a drawback of this latch is that both inputs must
be set to 1 before changing states, otherwise the function of this latch is indeterminate. Similarly, inputs to
a RS latch can never equal 0 simultaneously or an unstable forbidden state is realised. This task was very
straightforward. I clearly understood the concept of states and how they are practically useful.
4
3.1 Simulating RS latch with ’Enable’
The synchronised RS latch with enable is demonstrated in its circuit representation bellow (Figure 7). Input
signal R is first set to logic level 0, then 1 (to test the set and reset states), then 0 and 1 (to test no change
state) in 0.1 second increments. Input signal S is set to logic level 1, then 0 (to test the the set and reset states),
then 0 and 1 (to test no change state) in 0.1 second increments. Lastly, enable is in logic level 1 for the first
0.3 seconds (to test set, reset and no change states) and then 0 for 0.1 seconds (to test no change state). The
simulation results for inputs and outputs are demonstrated as a voltage vs time profile in Figure 8.
Figure 8: The relationship between voltage and time for different input and output values of RS latch with enable.
5
3.2 Developing the D Latch
Whenever changing between states, input signals R and S are always different. For convenience and simplicity,
we can ensure R and S are never equal. In this way we can completely eliminate the concept of a forbidden
state. To achieve this circuit we may use some input signal D, which is directly fed into R and negated before
being fed into S. The no change state can easily be achieved by setting the enable En to 0. This modified circuit
is known as a D latch and represented as a circuit diagram in figure 9. The D latch includes all functionalities of
a RS latch with enable, except it does not have a forbidden state and only one way to achieve a no change state
as the output. Nevertheless, it is more practical and simple in comparison to a RS latch. Before simulating, lets
establish a relationship between input signal D and signals R and S. Using the circuit in figure 9, when signal
D is at logic level 1, signals R and S are 1 and 0 respectively. At the same time, when signal D is at logic level
0, signal R and S are 0 and 1 respectively. According to the truth table in Table 4, this implies when D = 1
the outputs are in their set state. The contrary is true when D = 0.
In order to verify the observations made above, the D latch circuit can be simulated. Input signal D is first set
to logic level 1, then 0 (to test set and reset states) and then again 0 (to test no change state) in 0.1 second
increments. Enable is set to 1 for 0.2 seconds (to test set and reset states) and then 0 for 0.1 seconds (to test
no change state). The simulation results are displayed as a voltage vs time profile in Figure 10.
Figure 10: The relationship between voltage and time for different input and output values of a D latch.
Using the graph in Figure 10, the truth table shown in Table 5 is formed. As can be seen, when enable is
6
set to En = 1 and input signal is at D = 1, outputs Q and Q are at 1 and 0 respectively (set state). Similarly,
when D = 0 the outputs are Q = 0 and Q = 1 (reset state). Lastly, when the enable En is changed to 0 the
outputs do not change value.
D En Q Q State
1 1 1 0 Set
0 1 0 1 Reset
0 0 0 1 No change
Table 5: Truth table of a D latch.
This experiment was straightforward and very logical to follow. I found it very interesting how circuits can
be simplified and modified to achieve functionalities for different purposes.
As can be seen from the graph bellow, at the rising edges of the clock signal (Clk), the D flip-flop is
transparent and allows input signal D to propagate through to the output. At the falling edges, the flip-flip is
no longer transparent and memorises the logic level of the output at this edge. This memorised output becomes
7
Figure 12: The relationship between voltage and time for a rising edge triggered D flip-flop.
its current output. At the next rising edge, the D flip-flop becomes transparent again. The same steps are
followed for the next falling edge too; the output at the edge is memorised and becomes the current output.
A CD4013B has 4 input terminals and 2 output terminals. The first input signal is D, which is comparable to
the input for our master-slave D flip-flop and D latch. Similarly, the second input signal is the clock signal Clk.
The 2 new input signals are P RE and CLR. If input signal P RE = 0 and CLR = 1 the output is T DAT = 1
(set state), irrespective of input signals D and Clk. When P RE = 1 and CLR = 0 the output is T DAT = 0
(reset state), again irrespective of D and Clk. For our purposes, both input signals P RE and CLR will be
connected ground or logic level 0. Now we only understand the relation between inputs D and Clk and outputs
T DAT and T DAT .
The same input signals D and Clk used for the master-salve D flip-flop simulation can be utilised. To
reiterate, signal D is a random pulsating signal and Clk is a pulsating signal with a period of 0.2 seconds, with
the 0.1 seconds at logic level 1 and the remaining 0.1 seconds at 0. The circuit diagram for this simulation is
shown bellow (Figure 13). The input and output voltage vs time profile is displayed in Figure 14.
8
Figure 14: The relationship between voltage and time of a CD4013B D flip-flop.
As can be seen from the graph displayed in Figure 14, at every rising edge of the clock signal the logic level of
input D is registered and yielded as the output signal until the next rising edge. Hence, this D flip-flop contrary
to the master-slave one does not become transparent at edges. These characteristics display the behaviour of a
positive edge triggered D flip-flop, as the output changes every rising edge (positive edge) and does not display
transparency. What would happen if two CD4013B flip-flops are connected together (the first components
output becomes the input for the next)?
Figure 15: The relationship between voltage and time of 2 connected CD4013B D flip-flops.
9
As can be seen from the graph above, output T DAT appears 0.2 seconds delayed from the case with just
one D flip-flop. It may therefore be hypothesised, through connecting more CD4013B components the delay of
output will increase. It must be realised the setup and hold time are very important to consider. The output
of the first CD4013B becomes the input for the second flip-flop, for which the input signal changes very close
to the pulsating clock signal. If here the input signal is unstable within its setup/ hold time, a violation occurs
and the output becomes indeterminate.
The setup and hold time can be determined using a simulation. The simulation was run by using a one
pulse input signal D and Clk. The on time for signal D was varied and brought closed the rising edge of Clk
to test when the output signal becomes indeterminate. Through trial and error it was found the setup time is
20ns (×10−9 - nano seconds) and the hold time is around 7ns.
10
In order to recreate the sequence described above, Q1 requires to be at logic-level 1 after the first rising
clock edge. Then, the same for Q2 until Q4 each time with a given time delay to follow the sequence (delay is
caused naturally with the D flip-flops). Hence, input signal D requires to only have one pulse at the rising edge
T1 of Clk. The Clk is a pulsating periodic signal with 0.1 seconds at logic level 1 and the next 0.1 second at 0
(period is 0.2 seconds). The results may be represented as a voltage vs time profile bellow in Figure 17.
Using the graph above a table may be formed to display the sequence of outputs (Table 6). Note, Tn
represent the n ∈ Z+ rising edges of Clk. Hence, it may be realised the circuit is able to perform one hot
encoding.
Signal Q4 Q3 Q2 Q1
Initial 0 0 0 1
T1 0 0 1 0
T2 0 1 0 0
T3 1 0 0 0
T4 0 0 0 1
Table 6: Table representing the one hot shift register.
11