2

I am a beginner in designing circuit using verilog in modelsim. I use a sample code and a tutorial to learn how modelsim works. The code and the testbench are compiled without any problem and even testbench is simulated without any error but the input and output signals are not shown in object windows and they are not under instance menu. please describe for me how can I find them and simulate the waveforms. here is my code and the test bench. the definition of a D flipflop

// module D_FF with synchronous reset
module D_FF(q, d, clk, reset);
output q;
input d, clk, reset;
reg q;
// Lots of new constructs. Ignore the functionality of the
// constructs.
// Concentrate on how the design block is built in a top-down fashion.
always @(negedge clk or posedge reset)
if (reset)
q <= 1'b0;
else
q <= d;
endmodule

the definition of a T flipflop from D

module T_FF(q, clk, reset);
output q;
input clk, reset;
wire d;
D_FF dff0(q, d, clk, reset);
not n1(d, q);
endmodule

counter codes:

module rcc4(q, clk, reset);
output [3:0] q;
input clk, reset;
//4 instances of the module T_FF are created.
T_FF tff0(q[0],clk, reset);
T_FF tff1(q[1],q[0], reset);
T_FF tff2(q[2],q[1], reset);
T_FF tff3(q[3],q[2], reset);
endmodule

testbench code:

module stimulus();
reg clk;
reg reset;
wire[3:0] q;
// instantiate the design block
rcc4 r1(q, clk, reset);
// Control the clk signal that drives the design block. Cycle time = 10
initial
clk = 1'b0; //set clk to 0
always
#5 clk = ~clk; //toggle clk every 5 time units
// Control the reset signal that drives the design block
// reset is asserted from 0 to 20 and from 200 to 220.
initial
begin
reset = 1'b1;
#15 reset = 1'b0;
#180 reset = 1'b1;
#10 reset = 1'b0;
#20 $finish; //terminate the simulation
end
// Monitor the outputs
initial
$monitor($time, " Output q = %d", q);
endmodule

I am using modelsim 10.1c on Windows 10. The following picture is from my project and it shows my object and instance window.

  • 4
    I found the answer. when I click on start simulation a window is opened and in this window I click on Optimization options and change the design object visibility to "apply full visibility to all modules" and the problem have been solved. – abolfazl taghribi Feb 06 '17 at 13:28
  • Thank you, above mentioned steps helped me. – Amal Roshan Oct 13 '21 at 15:27

1 Answers1

7

The switch -voptargs=+acc will solve your issue.

vsim -voptargs=+acc modulename
Syscall
  • 19,327
  • 10
  • 37
  • 52
Swami
  • 71
  • 1
  • 2