+ Post New Thread
Page 2 of 2 FirstFirst 1 2
Results 21 to 27 of 27
  1. #21
    Super Moderator
    Points: 245,688, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    42,684
    Helped
    13007 / 13007
    Points
    245,688
    Level
    100

    Re: irrational clk period

    Your question has been already answered, the problem is that you apparently don't understand the answers.

    Just run the code in post #1 with any simulation time step resolution according to your requirements, e.g. 10 ps, 1 ps, as you like. The time variable is a real type with sufficient resolution, but the actual wait time interval is rounded according to the simulation time step.


    1 members found this post helpful.

    •   AltAdvertisment

        
       

  2. #22
    Advanced Member level 5
    Points: 21,066, Level: 35
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,056
    Helped
    882 / 882
    Points
    21,066
    Level
    35

    Re: irrational clk period

    First of all, your basic premise is wrong. You can't have an "irrational" period. That's a purely mathematical concept.

    Set your timing resolution to 1 ps.
    Set t_high and t_low=6.849 ns.
    Your frequency will be 73003358.1545


    1 members found this post helpful.

    •   AltAdvertisment

        
       

  3. #23
    Advanced Member level 4
    Points: 6,329, Level: 18

    Join Date
    Apr 2016
    Posts
    1,342
    Helped
    232 / 232
    Points
    6,329
    Level
    18

    Re: irrational clk period

    Quote Originally Posted by nsgil85 View Post
    Yes
    Sorry but I do not understand why it is difficult to answer my question
    because you are asking it wrong.
    Really, I am not Sam.



    •   AltAdvertisment

        
       

  4. #24
    Full Member level 1
    Points: 844, Level: 6

    Join Date
    Aug 2016
    Location
    Bangalore, India
    Posts
    103
    Helped
    12 / 12
    Points
    844
    Level
    6

    Re: irrational clk period

    You can try this.
    Code:
    procedure cgen(signal clk : out std_logic;) is
    constant P: time := 13698 ps;        
    constant HIGH_T : time := P/2;          
    constant LOW_T  : time := P/2;  
    begin
       loop
       clk <= '1';
       wait for HIGH_T;
       clk <= '0';
       wait for LOW_T;
       end loop;
    end procedure;
    Just a minor modification in your code.
    And ensure time resolution of your simulator to be 1ps.



  5. #25
    Super Moderator
    Points: 245,688, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    42,684
    Helped
    13007 / 13007
    Points
    245,688
    Level
    100

    Re: irrational clk period

    Just a minor modification in your code.
    The code in post #1 will achieve the same.



    •   AltAdvertisment

        
       

  6. #26
    Advanced Member level 5
    Points: 21,066, Level: 35
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,056
    Helped
    882 / 882
    Points
    21,066
    Level
    35

    Re: irrational clk period

    Quote Originally Posted by FvM View Post
    The code in post #1 will achieve the same.
    25 posts and we have now circumnavigated the thread.



  7. #27
    Newbie level 6
    Points: 365, Level: 4

    Join Date
    Aug 2016
    Posts
    11
    Helped
    2 / 2
    Points
    365
    Level
    4

    Re: irrational clk period

    I think post #4 had your answer, or at least outlined the questions you need answered.
    You or somebody else must decide on a clock frequency, its resolution and jitter.
    Then match these numbers in your simulator.

    Also: it's not an 'irrational' period; it's a repeating fraction



--[[ ]]--