Professional Documents
Culture Documents
SUBJECT: INS3135
Group members:
Nguyễn Tất Bảo Ngọc – 17071391
Nguyễn Thái Học – 17071384
Nguyễn Minh Tuấn – 18071539
Bùi Quang Hiệp - 17071380
TOPIC 2
1
Contents
List of figures .............................................................................................................................. 2
List of figures
Figure 1.Counter state diagram ................................................................................................. 6
Figure 2. Converter State Diagram ............................................................................................ 7
Figure 3. A Full subtractor truth table ....................................................................................... 7
Figure 4. Counter state table (X: don’t care condidtion) ........................................................... 8
Figure 5. Excitation table of T flip-flop....................................................................................... 8
Figure 6. Converter truth table (X:don’t care condition) ........................................................... 8
Figure 7: 1-bit full- subtractor K-map ..................................................................................... 12
Figure 8. Counter circuit ........................................................................................................ 134
Figure 9. Converter & counter circuit ...................................................................................... 13
Figure 10. Digital system that contains a 4-bit subtractor, a counter and a converter. ....... 145
3
Project Brief
Design a digital system that contains a 4-bit subtractor, a counter and a converter:
(1) The 4-bit subtractor that adds two numbers, one from the input and another from the
converter circuit,
(2) The counter that counts in the sequence 1, 4, 5, 9, 13, 14 and repeat,
(3) The converter that converts the counted sequence to 1, 3, 5, 7, 9, 11 to feed back into
subtractor.
Demonstrate in full detail the mathematical model of the design including: the state
diagram (for SC*), the truth (for CC*) and state (for SC) tables, the minimization of
equations, the logical circuit drawing, the explanations for all choices, the simulation using
HDL in active-HDL software, and evaluate the circuit when considering the propagation
delay time is 2ns for each basic gate and 10ns for each flip-flop.
*Sequential circuit: SC
**Combination circuit: CC
4
1. Circuit Specification
This digital system includes 4-bit adder, a counter and a converter.
The full subtractor circuit is basically two half subtractors connected together, the
truth table for the full subtractor r includes an additional column to take into
account the Carry-in, CIN input as well as the summed output, S and the Carry-out,
Cout bit . The single 1-bit binary subtractor can be constructed from basic logic
gates. If we wanted to add together two 4-bit numbers, then 4 number of 1-bit full
subtractor need to be connected or “cascaded” together to subtract two parallel 4-
bit numbers from each other. So by using an 4-bit adder and 4 number of inverters
(NOT Gates), the process of subtraction becomes an addition as we can use two’s
complement notation on all the bits in the subtrahend and setting the carry input of
the least significant bit to a logic “1”. Because the 4-bit subtractor that adds two
numbers, one from the input and the another from the converter circuit. So, we
have first number is B3, B2, B1, B0 and the second number is A3, A2, A1, A0 and A0 =
0.
The counter that counts in the sequence 1, 4, 5, 9, 13, 14 and repeat. The counter uses
4 T Flip Flops and has 4 inputs T4,T3,T2,T1 , the present state includes Q4,Q3 ,Q2 ,Q1
; the next state includes Q4(t+1) , Q3(t+1) , Q2(t+1), Q1(t+1). The way the counter
works is that if we want to count a sequence of numbers, the 4 bits present sate
(Q4,Q3 ,Q2 ,Q1) will represent the initial number, the 4 bits next state ( Q4(t+1) ,
Q3(t+1) , Q2(t+1), Q1(t+1)) will represent the next number of the sequence. And then
continue like that until the last number of the sequence, the last number of the
sequence will be represented in the initial 4 bits present sate (Q4,Q3 ,Q2 ,Q1) , the
4 bits next state ( Q4(t+1) , Q3(t+1) , Q2(t+1), Q1(t+1)) will represent the original
number of the sequence, that means this counter counts a repeated sequence.
The converter that converts the counted sequence to 1, 3, 5, 7, 9, 11 to feed back into
the adder. The converter has 4 bits input are ( Q4(t+1) , Q3(t+1) , Q2(t+1), Q1(t+1) –
the next sate of Counter and 4 bits output are A3, A2 ,A1 ,A0 and A0 = 0 ; 4 bits input
( Q4(t+1) , Q3(t+1) , Q2(t+1), Q1(t+1) represent the sequence 1, 4, 5, 9, 13, 14. This
converter will convert the numbered sequences into a new sequence represented by
5
the output 4 bits A3, A2 ,A1 ,A0 and also because the conversion sequence is even, in
the 4 bits output A3, A2 ,A1 ,A0 , so the value of A0 is 0.
2. Mathematical Design
2.1 State Diagram
The state diagram for the counter that counts in the sequence 1, 4, 5, 9, 13, 14 and
repeat is shown as below.
The state diagram for the converter that converts the counted sequence to 1, 3, 5, 7,
9, 11 to feed back into the adder:
T flip-flop – If value of Q changes either from 0 to 1 or from 1 to 0 then input for T flip-flop is
1 else input value is 0.
Excitation Table
Q(t) Q(t+1) T
0 0 0
0 1 1
1 0 1
1 1 0
Find value of T4, T3, T2, and T1 in terms of Q4, Q3, Q2, and Q1 using K-Map:
9
Q4Q3\Q2Q1 00 01 11 10
00 X 0 X X
01 0 1 X X
11 X 0 X 1
10 X 0 X X
Q4Q3\Q2Q1 00 01 11 10
00 X 0 X X
01 0 0 X X
11 X 1 X 1
10 X 0 X X
To find the corresponding digital circuit, we will use the K-Map technique for each of the
bits as output with all of the binary bits as input.
Q4Q3\Q2Q1 00 01 11 10
00 X 0 X X
01 0 0 X X
11 X 1 X 1
10 X 0 X X
Q4Q3\Q2Q1 00 01 11 10
00 X 0 X X
01 0 1 X X
11 X 0 X 0
10 X 1 X X
Therefore, A2 = Q4Q3’+Q1Q4’Q3
Q4Q3\Q2Q1 00 01 11 10
00 X 0 X X
01 1 0 X X
11 X 0 X 1
10 X 1 X X
Q4Q3\Q2Q1 00 01 11 10
00 X 1 X X
01 1 X X X
11 X 1 X 1
10 X 1 X X
Therefore, A0 =0
Figure 10. Digital system that contains a 4-bit adder, a counter and a converter.