+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Newbie level 3
    Points: 713, Level: 5

    Join Date
    Jan 2009
    Posts
    4
    Helped
    0 / 0
    Points
    713
    Level
    5

    clock_frequency

    How to write verilog code for calculation of clock frequency?

    •   AltAdvertisment

        
       

  2. #2
    Full Member level 5
    Points: 4,114, Level: 15
    Achievements:
    7 years registered
    RBB's Avatar
    Join Date
    Jul 2007
    Location
    USA
    Posts
    304
    Helped
    70 / 70
    Points
    4,114
    Level
    15

    Re: clock_frequency

    Code:
    `timescale 1ns/10ps
    
    module foo(clk);
         input clk;
    
         real t0;
         real t1;
         real frequency;
    
         initial
              begin
                   @ (posedge clk) t0 = $realtime;
                   @ (posedge clk) t1 = $realtime;
                   frequency = 1.0e9 / (t1 - t0);
                   $display("Frequency = %g", frequency);
                   $finish;
              end
    endmodule



    •   AltAdvertisment

        
       

  3. #3
    Newbie level 3
    Points: 713, Level: 5

    Join Date
    Jan 2009
    Posts
    4
    Helped
    0 / 0
    Points
    713
    Level
    5

    Re: clock_frequency

    Thanks for clearing my doubt...


    reagrds,
    vinoth



--[[ ]]--