electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

how to write correctly a testbench of the top module


Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> how to write correctly a testbench of the top module
Author Message
chibijia



Joined: 16 Jan 2008
Posts: 36


Post03 Nov 2009 9:46   

how to write correctly a testbench of the top module


recently i write a code which embrace two subside modules,such as
module1 module segbcd(data,clk,rst,seg_out) where data is 8bits input ;clk,rst are 1bit input,seg_out is 8bits output,and
module2 module counter(s,sc,sn,rst,clk,data_sn,data)
where s,sc,sn,rst,clk are 1bit input ,data_sn is 8bits input,data is 8 bits output;
and the clk and rst can be the common node.and the output of the module2-data is the input of module1-data.
can anybody tell me how to write a correct testbench for this design!
help!!!
Back to top
Google
AdSense
Google Adsense




Post03 Nov 2009 9:46   

Ads




Back to top
ckaa



Joined: 06 Apr 2006
Posts: 15
Helped: 4


Post05 Nov 2009 22:57   

Re: how to write correctly a testbench of the top module


Here's a quick testbench. It may have minor erros. Check it out though and let me know if it works for you!

module_tb();
reg clk, reset;
wire[7:0] data_sn, data, seg_out;
wire s, sc, sn;

//adjust your delay according to your reset pulse width
// Also provide stimuli for your s, sc, sn inputs according to your design
initial begin
clk = 0;
reset = 0;
#20 reset = 1;
#20 reset = 0;

end

//determine your clock period and adjust the delay below
always #50 clk = ~clk;


segbcd segbcd_inst(
data(data),
clk(clk),
rst(reset),
seg_out(seg_out)
);

counter counter_inst(
s(s),
sc(sc),
sn(sn),
rst(reset),
clk(clk),
data_sn(data_sn),
data(data)
);

endmodule
Back to top
pini_1



Joined: 18 Jun 2007
Posts: 288
Helped: 17


Post06 Nov 2009 7:02   

Re: how to write correctly a testbench of the top module


maybe this example can help:

"The following is a small design of a FIFO, which is built of Flip-Flop devices. I found the design some where on the web, fixed some bugs, created a test bench to test it and PERL script to automate the testing. This site will demonstrate all of the three...."

http://bknpk.no-ip.biz/my_web/MiscellaneousHW/regFIFO.html
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> how to write correctly a testbench of the top module
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
How to include the sub-modules in top module ? (3)
how to write good testbench (2)
how to write a testbench file with tcl? (4)
Hi,i want to know how to write good testbench,thank you! (23)
Debussy: How to specify top module file(.v)? (4)
how to write a memory bist module? (5)
PLB Master module is not operating correctly (250 points!) (3)
How do simulate the RF input matching on PCB correctly? (1)
Write data in testbench (4)
Which language to write TestBench? (2)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS