Question

In: Computer Science

Simulate a D-Flip Flop on Xilinx using Verilog HDL | Behavioral Modelling PS: please include the...

Simulate a D-Flip Flop on Xilinx using Verilog HDL | Behavioral Modelling

PS: please include the simulation screenshot and output and the code

Solutions

Expert Solution

Find below the verilog code of D-flip Flop in behavioral style along with test bench and simulation results.

Code:

`timescale 1ns / 1ps

module D_FlipFlop_Bhev(D,Clk,Clear,Q,Q_bar);
  
   input D,Clk,Clear;
   output reg Q,Q_bar;
  
   always @(posedge Clk)
   begin
       if(Clear == 1)
       begin
           Q<=0;
           Q_bar<=1;
       end
       else
       begin
           Q<=D;
           Q_bar<=!D;
       end
   end
endmodule

TestBench :

`timescale 1ns / 1ps
module D_FlipFlop_TestBench;

   // Inputs
   reg D;
   reg Clk;
   reg Clear;

   // Outputs
   wire Q;
   wire Q_bar;

   // Instantiate the Unit Under Test (UUT)
   D_FlipFlop_Bhev uut (
       .D(D),
       .Clk(Clk),
       .Clear(Clear),
       .Q(Q),
       .Q_bar(Q_bar)
   );
  
   initial begin
       Clk=0;
       forever #20 Clk= ~Clk;
   end

   initial begin
   $monitor("simtime = %g, CLK = %b, D = %b,reset = %b, Q = %b, Q_bar = %b", $time, Clk, D, Clear, Q, Q_bar);
       // Initialize Inputs
       D = 0;
       Clear = 1;

       #100;
      
       D = 0;
       Clear = 0;
      
       #100;

       D = 1;
       Clear = 0;
   end
endmodule

Simulation Screenshot:

Output Screenshot:


Related Solutions

In Verilog Design a state machine, using the D flip-flop, that implements a 00 and 11...
In Verilog Design a state machine, using the D flip-flop, that implements a 00 and 11 sequence detector. Your machine should output a 1 as soon as it detects two 0s or two 1s on its input, otherwise it outputs 0s. Write a module that implements the machine and a test bench to test it.
Implement a JK Flip flop using behavioral modeling in verilog, also write its test bench code.
Implement a JK Flip flop using behavioral modeling in verilog, also write its test bench code.
Design a synchronously settable flip-flop using a regular D flip-flop and additional gates.
Design a synchronously settable flip-flop using a regular D flip-flop and additional gates.
Write and verify a behavioral Verilog model of J-K flip-flop with active-low asynchronous reset.
Write and verify a behavioral Verilog model of J-K flip-flop with active-low asynchronous reset.
9. Why is the D flip flop the more common flip flop? 10. What is the...
9. Why is the D flip flop the more common flip flop? 10. What is the purpose of a clock in a digital system?
You are to implement the following in VHDL: D flip-flop D flip-flop       with enable and reset J-K...
You are to implement the following in VHDL: D flip-flop D flip-flop       with enable and reset J-K flip flop with asynchronous set T Flip flop with asynchronous clear
A T flip-flop is a 1-bit synchronous storage component alternative to the D flip-flop, with a...
A T flip-flop is a 1-bit synchronous storage component alternative to the D flip-flop, with a slightly different interface. The T flip-flop has one input t to synchronously control the state of the flip-flop, as follows: When t is 0, the flip-flop does not change its state value. When t is 1, the flip-flop inverts its current state value (0 becomes 1, and 1 becomes 0). Write a Verilog module for the T flip-flop using a behavioral model. The flip-flop...
Type up Verilog Verilog program , test bench and screenshot of the wavefore using verilog xilinx....
Type up Verilog Verilog program , test bench and screenshot of the wavefore using verilog xilinx. (PLEASE ONLY ANSWER IF YOU UNDERSTAND HOW TO USE XILINX. ******************no need to show me the state diagram or state table just the verilog code , test bench and the screenshot of the waveforem **************** Implement the function given below using each of the following methods. As few 16-1 multiplexers as possible. Behavioral Verilog. F( w , x, y , z) = ?(2 ,...
Create a VHDL code of a 4 bit Counter using D flip flop and a Frequency...
Create a VHDL code of a 4 bit Counter using D flip flop and a Frequency Divider that provides the clock signal input for counter
Verify the operation of a D flip-flop by providing appropriate inputs to the D, Preset, and...
Verify the operation of a D flip-flop by providing appropriate inputs to the D, Preset, and Clear pins. Use CLOCK input to the flip-flop to function properly ( can be found under wiring in Logisim) //If you present a diagram designed in the "Logisim app" it would be very much appreciated. Thank you
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT