Altera_Forum
Honored Contributor
8 years agoQuery regarding Simulation in Modelsim
Dear friends,
I have a query regarding simulation in Modelsim, I want to take a flop of a input signal to introduce a one clock cycle delay, but I didn't get one clock cycle delay in Modelsim. So, my question is why I didn't get any delay? If any one have idea about this , please explain me. I have attached image of simulation below and also write code for the same. rtl:
`timescale 1ns/100ps module flops( input logic clk, input logic reset_n, input logic RxD_in ); logic RxD_in_f1; //first flop of input signal logic RxD_in_f2; //second flop of input signal always_ff@(posedge clk or negedge reset_n) begin if ( ~reset_n ) begin RxD_in_f1 <= 1'b0; end else begin RxD_in_f1 <= RxD_in; end end always_ff@(posedge clk or negedge reset_n) begin if(~reset_n ) begin RxD_in_f2 <= 1'b0; end else begin RxD_in_f2 <= RxD_in_f1; end end endmodule
testbench:
`timescale 1ns/100ps module flops_tb; logic clk = 1'b1, reset = 1'b1; logic RxD; flops inst( .clk(clk), .reset_n(reset), .RxD_in(RxD) ); always# 1 clk <= ~clk; always begin RxD = 1'b0;# 10 RxD = 1'b1;# 10 RxD = 1'b0; end endmodule