Newbie: Testbench question

Apr 21, 2008 8 Replies

Hello, I have a question about instantiating a module in a verilog testbench. Sometimes the instantiation may have lots of inputs and output that you may not want to appear in the ModelSim simulation, is there a way to stimulate particular signals in a module so the simulation won't include (display) all of the i/o in your design. Below if my testbench:



// // Copyright 2006 Mentor Graphics Corporation // // All Rights Reserved. // // THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS THE PROPERTY OF // MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS SUBJECT TO LICENSE TERMS. // `timescale 1ns/1ns


module test_counter;



reg clock_80mhz, fiber_rst;



reg delay_clock;



wire pin_in;


ModelSimTopblock dut ( fib_rx_dv, fib_rx_er, fib_rx_clk, reset_fpga, clock_80mhz, fiber_rcv_rdreq, fiber_go_xmit, fiber_wrreq, fiber_rst, pin_in, fib_rx_data, fiber_tx_data, //------------------------------ fib_tx_en, fib_tx_er, fifo_ef_dsp, dsp_fib_rx_interrupt, fib_rx_data_led, fib_tlk_sig_loss, fib_tx_data_led, fifo_ef_ctl, pin_out, fib_tx_data, fiber_data_rcvd );



parameter tON = 15, tOFF = 7;


initial // Clock generator begin clock_80mhz = 0; forever #15 clock_80mhz = !clock_80mhz; end


always begin #tON delay_clock = 0; #tOFF delay_clock = 1; end


initial // Test stimulus begin fiber_rst = 1; #5 fiber_rst = 1; #4 fiber_rst = 0; end



assign pin_in = delay_clock;


initial $monitor($stime,, fiber_rst,, clock_80mhz,,, pin_out);



endmodule



When I launch modelsim all of the io signals of the ModelSimTopblock would be present in the sim. Can I do something like this:


ModelSimTopblock dut ( 0, fib_rx_er, 0, 0 clock_80mhz, 0, 0 fiber_wrreq, fiber_rst, pin_in, fib_rx_data, fiber_tx_data, //------------------------------ 0, 0, 0 0, 0, 0, fib_tx_data_led, fifo_ef_ctl, pin_out, fib_tx_data, fiber_data_rcvd ); Here only a few signals would be stimulated and few signals would appear in the ModelSim simulation window. Is there a way to do this?



thanks, joe


//------------------------------

//------------------------------

Hello again, I tried putting 0 in the instantiation and it gives an error. There must be some way to create a testbench were only a few signals are stated and thereby would create a simulation consisting of only the signals of interest are displayed.

This is probably not the most appropriate forum for this question. Tr

formatting link
instead.

..snip

I probably don't understand you question but you can simply drag and drop the signals of interest from the Objects window onto the Waveform window. If you want to do this from a script than look up the "add wave" command in the reference manual.

Hans.

formatting link

Hello, thanks for responding to my post. Sorry for me confusing everyone. Let's say I have a large design that has lots of inputs and outputs and let's say I'm only interested in a simulation consisting of only a few inputs and outputs. When I run ModelSim it will add in all the inputs/output of the module I am simulating, thus adding in all of the inputs and outputs of my design into the waveform window. I was hoping I could configure something so when the simulation finishes it would display the signals I'm interested in. Is that possible? I'll also try the other newsgroup and see if anyone has a solution.

thanks, joe

How are you running Modelsim?

When I run it up, load a project/simulation then open the wave window there are no signals in it.

I've got a 'standard' naming convention so I can easily find and load the

*.do file that loads the signals associated with a particular testbench. These are then saved in the /Modesim sub directory of the project in question.

Nial.

I don't believe modelsim automatically adds signals to the wave window, it also does not automatically run a simulation. How do you start modelsim? Your environment may start modelsim with a scriptfile (.do) and it may have generated a default for this script that adds all your IO to the wave window and runs the simulation to completion.

If you can find that script, you can probably modify it to suit your needs.

Stef (remove caps, dashes and .invalid from e-mail address to reply by mail) Out of sig error

Alternatively, you can just delete the signals you don't want from the wave window after they've been added.

I've seen a reference design once that used a .tcl script to display on the simulation window only the signals of interest but I couldn't figure out how they called the .tcl script. When I run ModelSim I simply change the directory to the directory of my verilog design and the testbench. I then compile and simulate the design using the testbench. I would like to learn how to use scripts to run the simulation. If anyone can suggest a good web site that covers things like this please let me know.

Thanks, joe

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required