Question

Using verilog code, write the testbench and design for a D- Flip Flop (latch)

Using verilog code, write the testbench and design for a D- Flip Flop (latch)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here I'm writing the d flip flop Test Bench along with the d flip flop code.For the test bench simulation we need to write the normal code of the asked flip flop.

If you have any doubts please comment below.

// D flip flop code;

module dff(clk,in,y);
input clk,in;
output y;
reg y;
always@(posedge clk)
begin
y=in ;
end
endmodule


//Test Bench for d flip flop;

module TB_dff( ); //In testbench we don't mention the net list;
reg clk,d;
wire out;
initial
begin
clk=0;
d=0;
#100000 $finish;
end
end
always #100 clk = ~ clk ;
always #330 d = ~ d ;
dff anyname(out, d, clk ) ; //Instantiation of the D flip flop;
endmodule

Add a comment
Know the answer?
Add Answer to:
Using verilog code, write the testbench and design for a D- Flip Flop (latch)
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT