Escolar Documentos
Profissional Documentos
Cultura Documentos
&
SEQUENTIAL CIRCUITS
COMBINATIONAL
CIRCUITS
1. Selected Signal Assignment:
. Used to assign signal one of several values.
Syntax: with expression select
signal name <= expression when
constant_value;
Example: Write VHDL code for mux 2:1
using selected signal assignment.
Example: Write VHDL code for mux 4:1
using selected signal assignment.
Example: Write VHDL code for mux 16:1 using package in structural style.
Example: Write VHDL code for 2:4 binary
decoder using selected signal assignment .
2. Conditional signal assignment:
. Similar as selected signal assignment operator
(but uses when and else),
. And it also uses conditional signal assignment
operator i.e.
=.
Example: Write VHDL code for mux 2:1 using
conditional signal assignment.
Example: Write VHDL code for 4:2 priority
encoder using conditional signal assignment.
Example: Write VHDL code for 4-bit comparator
using conditional signal assignment (including
std_logic_unsigned library).
Alternate code for 4-bit comparator
3. Generate Statement:
. It is a feature that describe regularly structural
hierarchical code using loop and reduce coding.
Syntax 1:
generate_label: for index_variable in range
generate
statement;
end generate;
Syntax 2:
generate_label: if expression generate
statement;
end generate;
Example: Write VHDL code for mux 16:1 using
generate statement.
Example: Write VHDL code for decoder 4:16
using generate statement.
4. Process statement:
Example: Write VHDL code for mux 2:1 using process
statement.
5. Case statement:
Similar to selected signal assignment but in this for selected signal WHEN
clause is used for its various values.
Example: Write VHDL code for decoder 2:4 using case statement.
Example: Write VHDL code for BCD to 7-
segment decoder using case statement.
SEQUENTIAL CIRCUITS
Output depend on both present and past input.
Hence have some storage and therefore States exist in it.
Combinational circuits are known as memoryless or
stateless.
Comparison between combinational and
sequential circuits.
Types of Sequential circuits:
1. Synchronous, and
2. Asynchronous circuits.
S R Q
0 0 Q
0 1 0
1 0 1
1 1 Indet
.
Gated SR Latch
To make it less sensitive to input and enable is added so
that it will be sensitive to input only when enable is 1.
Truth Table
En S R Q
1 0 0 Q
1 0 1 0
1 1 0 1
1 1 1 Indet
.
0 X X Q
Example: Write VHDL code for gated D latch.
Clocked SR Flip Flop
Used to set and reset output.
State is changed using clock cycle.
Drawback: Indetermined condition when both
input are 1.
Solution: D or JK Flip Flop.
Truth Table
clk S R Q
PE 0 0 Q
PE 0 1 0
PE 1 0 1
PE 1 1 Indet
.
0 X X Q
D (Delay) Flip Flop
Also known as transparent flip flop.
Indet. Condition will never arrive as both input
will never be 1.
Truth Table
D Q
0 0
1 1
Example: Write VHDL code for clocked D flip flop
using Clockevent (it means the clock has
changed just now and it is equal to 1 for
positive edge triggering).
Example: Write VHDL code for clocked D flip flop using WAIT UNTIL
statement (wait until work same as if statement in previous example and
also sensitivity list is omitted in process statement)
Example: Write VHDL code for D flip flop with
asynchronous reset
Example: Write VHDL code for D flip flop with
synchronous reset
JK Flip Flop
It eliminate indet. Condition of SR flip flop by
making S = J. and R = K.Q
Drawback: Output toggle when both input are 1.
Solution: JK Master-Slave flip flop or T-flip flop.
Truth Table
J K Q
0 0 Q
0 1 0
1 0 1
1 1
JK Master- Slave flip flop
Problem: Race around condition which arrives when
output changing time t is less than clock pulse tp.
Solution: either t > tp or use master-slave flip flop.
Master: Positive edge triggered.
Slave : Negative edge triggered (i.e. Slave copies
master at negative edge).
T(Toggle)-flip flop
It is modified version of JK flip flop.
Toggle condition will never arrive as single input
is given to both the nand gates.
Truth Table
T Q
0 Q
1
D flip flop with CLEAR and PRESET for
Counters
Sequential circuits depend on both past and
present input of the circuit.
Counter either has to increment (UP counter) or
decrement (DOWN counter).
So it is required to clear all the flip flop i.e. its
initial state if Q=0 or preset if Q=1 for
counting.
So on the basis of clock pulse, counters are of two
types:
1. Asynchronous counter.
2. Synchronous counter.
1. Asynchronous Counter with Preset and Clear
Shift Register:
. A no. is multiplied by 2 if its one-bit is shifted to left
and 0 is inserted at new LSB.
. A no. is divided by 2 if its one-bit is shifted to right
and 0 is inserted at new MSB.
. A register that provide ability to shift its contents is
known as Shift register.
A simple shift register, input sequence=10111000
Example: Write VHDL code for 4-bit shift
register
Example: Write VHDL code for 8-bit register
with asynchronous clear
Example: Write VHDL code for n-bit register
with asynchronous clear
Types of shift register:
1. Serial In Serial Out (SISO).
2. Serial In Parallel Out (SIPO).
3. Parallel In Serial Out (PISO).
4. Parallel In Parallel Out (PIPO).
Asynchronous counter:
. Clock is given to only I flip flop and then output
of preceding flip flop will work as clock for next
flip flop.