I have the below Verilog code and simulation where I want to view the signals and compare the clocks for each of them.
`timescale 1ns / 1ps
module dff(clk, D, rst, Q);
input clk, D, rst;
output Q;
reg Q;
always @ (posedge clk, posedge rst)
begin
if (rst == 1)
Q <= 1'b0;
else
Q <= D;
end
endmodule
//////////////////////////////////////////////
// clock divider module
/////////////////////////////////////////////
`timescale 1ns / 1ps
module clk_divider(
input clk,
input rst,
output led
);
wire [4:0] din;
wire [4:0] clkdiv;
dff dff_inst0 (
.clk(clk),
.rst(rst),
.D(din[0]),
.Q(clkdiv[0])
);
dff dff_inst1 (
.clk(clk),
.rst(rst),
.D(din[1]),
.Q(clkdiv[1])
);
dff dff_inst2 (
.clk(clk),
.rst(rst),
.D(din[2]),
.Q(clkdiv[2])
);
dff dff_inst3 (
.clk(clk),
.rst(rst),
.D(din[3]),
.Q(clkdiv[3])
);
dff dff_inst4 (
.clk(clk),
.rst(rst),
.D(din[4]),
.Q(clkdiv[4])
);
genvar i;
generate
for (i = 1; i < 5; i=i+1)
begin : dff_gen_label
dff dff_inst (
.clk(clkdiv[i-1]),
.rst(rst),
.D(din[i]),
.Q(clkdiv[i])
);
end
endgenerate;
assign din = ~clkdiv;
assign led = clkdiv[4];
endmodule
And the test bench
module tb;
// Inputs
reg clk;
reg rst;
// Outputs
wire led;
// Instantiate the Unit Under Test (UUT)
clk_divider uut (
.clk(clk),
.rst(rst),
.led(led)
);
always
#5 clk = ~clk;
initial
begin
// Initialize Inputs
clk = 0;
rst = 1;
#10 rst = 0;
#10 rst = 1;
#10 rst = 0;
#10 rst = 1;
#10 rst = 0;
#100;
end
endmodule
here is the simulation
I want to see the clkdiv(1), clkdiv(2), etc. and add more and check the signals. What am I missing here?
Best Answer
You should see a Scopes box where the hierarchy is laid out, and an Objects box where the corresponding signals are. You can take signals from the Objects box and add them to the waveform viewer, upon which you'll have to restart the sim.