Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8295581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:39:32+00:00 2026-06-08T14:39:32+00:00

As I have known, D flipflop samples its input value at every positive edge

  • 0

As I have known, D flipflop samples its input value at every positive edge
of the clock.

Thus, it will produce a 1 cycle delay. Right?

But why does my D flip flop does not produce a 1 cycle delay?

         module flipflop(
             input clk,
             input rstn,
             input [7:0] i_data,
             output reg [7:0] o_data
         );

             always @(posedge clk) begin
                     if (~rstn) begin
                             o_data <= 0;
                     end
                     else begin
                             o_data <= i_data;
                     end
             end
         endmodule

       module test;
           reg clk;
           reg [7:0] i_data;
           reg rstn;
           wire [7:0] o_data;

           initial begin
                   clk = 0;
                   rstn = 1;
                   i_data = 0;
                   #20;
                   rstn = 0;

                   #30;
                   rstn = 1;
                   #20;
                   i_data = 8'hFA;
                   #20;
                   i_data = 8'hF0;
                   #20
                   i_data = 8'hF1;
                   #20
                   #10 $finish;
           end

           always #10 clk = !clk;

           flipflop flipflop(
                   .clk (clk),
                   .rstn(rstn),
                   .i_data(i_data),
                   .o_data(o_data)
           );

           initial begin
                   $dumpfile("flipflop.vcd");
                   $dumpvars();
           end
       endmodule

dff no delay

My D flip flop functions like a combinational circuit here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:39:34+00:00Added an answer on June 8, 2026 at 2:39 pm

    The simulator is probably doing something like this:

           initial begin
                   clk = 0;
                   rstn = 1;
                   i_data = 0;
                   #10;
                   clk = !clk;
                   #10;
                   rstn = 0;
                   clk = !clk;
    
                   #10;
                   clk = !clk;
                   #10;
                   clk = !clk;
                   #10;
                   rstn = 1;
                   clk = !clk;
                   #10;
                   clk = !clk;
                   #10
                   i_data = 8'hFA; //Input updated
                   clk = !clk;     //Clock event
                                   //o_data assigned here
                   #10;
                   clk = !clk;
                   #10;
                   i_data = 8'hF0;
                   clk = !clk;
                   #20
                   i_data = 8'hF1;
                   #20
                   #10 $finish;
           end
    

    Since the clock event is occurring last in each time step from your testbench, it looks like the flop is being assigned immediately. You likely want your testbench to be entirely slaved off the clock so Marty’s suggestion of using @(posedge…) will achieve this. You could also simply delay your assignments once at the very beginning:

           initial begin
                   clk = 0;
                   #1;
                   rstn = 1;
                   i_data = 0;
                   #20;
                   rstn = 0;
    
                   #30;
                   rstn = 1;
                   #20;
                   i_data = 8'hFA;
                   #20;
                   i_data = 8'hF0;
                   #20
                   i_data = 8'hF1;
                   #20
                   #10 $finish;
           end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to develop a Java ME (formerly known as J2ME) application that will
As you may have known that I switched from ubuntu to windows from my
Scala programmer should have known that this sort of writing : class Person{ var
I have a known shared folder on another Windows PC and i have to
I have a variable known as $SessionMinus. What I want to do is that
I have completed the well known 'news' toutorial included in CI documentation. sometimes double
I have a rectangle which has known width and height.Now devide rectangle diagonally to
I have a string that contains a known number of double values. What's the
I have a php form that has a known number of columns (ex. top
I have an array of objects in a known format, it could look like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.