HDL Programming Assignment
HDL Programming Assignment
REPORT
19EC516 - HDL Programming
Slot: 3Q2-1
Introduction:
In this project, we were tasked with designing Verilog code for two types of flip flops - the JK
and D flip flops. Flip flops are crucial building blocks in digital circuits and are used for storing
binary information.
The JK flip flop is a type of flip flop that can be used to store one bit of binary information. It
has three inputs J, K, & clk signal and two outputs, Q and Q-bar. The JK flip flop operates on
the rising edge of the clock signal and can be used to perform various functions such as no
change, set, reset and toggling.
The D flip flop is another type of flip flop that can be used to store one bit of binary information.
It has two input D & clk and two outputs Q and Q-bar. The D flip flop operates on the rising
edge of the clock signal and simply copies the input value to the output. It is often used in data
storage applications.
To complete the project, we wrote Verilog code for both types of flip flops and simulated the
circuits using Xilinx software. We also created testbenches to apply input values to the circuits
and observed the output waveforms to verify the correct behaviour of the flip flops.
Overall, this project allowed us to gain a deeper understanding of flip flops and their
implementation in digital circuits. The Verilog code we wrote can be used as building blocks
for larger digital systems, and the simulation results provide valuable insights into the
behaviour of these circuits.
JK Flip Flop
Block Diagram:
Truth Table:
CLK J K Q Q’ State
1 0 0 Q Q’ No Change
1 0 1 0 1 Resets Q to 0
1 1 0 1 0 Sets Q to 1
1 1 1 Q’ Q Toggle
Circuit Diagram:
Verilog Program:
Block Diagram:
Truth Table:
CLK D Q Q’
1 0 0 1
1 1 1 0
Circuit Diagram:
Verilog Program:
module jk_flip_flop (q, qbar, d, clk);
input d, clk;
output reg q, qbar;
Output:
Result:
We successfully designed and implemented Verilog code for both the JK and D Flip Flops. We
also simulated these circuits using Xilinx software and observed the output waveforms to verify
their correct behaviour. Our simulations confirmed that the flip flops were functioning as
intended and storing binary information as expected. Overall, this project provided us with
valuable insights into the implementation of digital circuits using flip flops as building blocks.
References:
1. https://www.javatpoint.com/jk-flip-flop-in-digital-electronics
2. https://www.knowelectronic.com/d-flip-flop/
3. https://www.javatpoint.com/d-flip-flop-in-digital-electronics
4. https://www.electronicsforu.com/technology-trends/learn-electronics/flip-flop-rs-jk-t-
d
5. https://chat.openai.com