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

    Join Date
    Aug 2019
    Posts
    4
    Helped
    0 / 0
    Points
    35
    Level
    1

    Modelsim clock signal

    Hi guys, I tried to apply the stimuli using modelsim to the sequential adder that I described in vhdl.


    1) I tried to generate the clock signal like this: here is the screenshot:


    Click image for larger version. 

Name:	create_wave.png 
Views:	13 
Size:	167.7 KB 
ID:	154958



    But doing so it does not work,


    num1 is the first number to be added
    num2 is the second number
    s, the result always fixed to zero
    rst is the reset active low



    here is the result of the simulation:

    Click image for larger version. 

Name:	create_wave2.png 
Views:	8 
Size:	198.8 KB 
ID:	154959




    2) I generated the clock like this:
    Click image for larger version. 

Name:	clock1.png 
Views:	6 
Size:	69.1 KB 
ID:	154960




    Now the result is correct.

    Click image for larger version. 

Name:	clock.png 
Views:	4 
Size:	207.9 KB 
ID:	154961



    Why in the first case is it wrong? Thanks a lot .
    Last edited by maro.pitti; 13th August 2019 at 19:17.

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 31,137, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,182
    Helped
    1703 / 1703
    Points
    31,137
    Level
    43

    Re: Modelsim clock signal

    Code:
    force clk_name 0,1 5 ns -r 10 ns
    0: time 0 value
    1: value applied at 5ns
    -r or -repeat: to repeat at some interval
    10 ns the repeat interval

    this generates a 100 MHz clock you can change the duty cycle or the starting level by changing the 0,1 to 1, 0 and the duty cycle by changing the 5 ns value.



  3. #3
    Newbie level 3
    Points: 35, Level: 1

    Join Date
    Aug 2019
    Posts
    4
    Helped
    0 / 0
    Points
    35
    Level
    1

    Re: Modelsim clock signal

    But why in the first case I was wrong?



    •   AltAdvertisement

        
       

  4. #4
    Super Moderator
    Points: 31,137, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,182
    Helped
    1703 / 1703
    Points
    31,137
    Level
    43

    Re: Modelsim clock signal

    Because it doesn't force a signal onto a object. I'm not even sure what that command does as the version of Modelsim I use 10.5 doesn't even have that menu item.

    You should learn the modelsim command line instead of relying on the GUI. They've moved stuff around in the GUI over the years it's a waste of time learning where everything is...it will eventually move somewhere else.



  5. #5
    Newbie level 3
    Points: 35, Level: 1

    Join Date
    Aug 2019
    Posts
    4
    Helped
    0 / 0
    Points
    35
    Level
    1

    Re: Modelsim clock signal

    Quote Originally Posted by ads-ee View Post
    Because it doesn't force a signal onto a object.
    But this problem can only be felt with the clock, because the other signals such as the rst (reset) are correctly applied with the "CREATE WAVE" mode.



    •   AltAdvertisement

        
       

  6. #6
    Super Moderator
    Points: 31,137, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,182
    Helped
    1703 / 1703
    Points
    31,137
    Level
    43

    Re: Modelsim clock signal

    Don't know. I would still just type the commands in, the syntax is straight forward and easy to learn. Besides you can put them in a file and just run the from the command line without having to navigate a bunch of menus that can't be automated.



  7. #7
    Full Member level 5
    Points: 2,286, Level: 11

    Join Date
    May 2014
    Posts
    268
    Helped
    27 / 27
    Points
    2,286
    Level
    11

    Re: Modelsim clock signal

    My version of modelsim/questasim doesn't even have create_wave.

    I have an option called force. In order to create a clock you force a toggle behaviour.

    I don't know where create_wave came from or why you're dead set on it?



  8. #8
    Advanced Member level 4
    Points: 8,402, Level: 21
    Achievements:
    7 years registered Created Blog entry
    dpaul's Avatar
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    1,252
    Helped
    272 / 272
    Points
    8,402
    Level
    21
    Blog Entries
    1

    Re: Modelsim clock signal

    I would never use stuff as create_wave or try to force a toggle behavior in order to generate a fundamental signal such as clock.
    For signals such as clocks and resets, drive them from the test-bench. Don't drive them from the simulator GUI or even using commands. Driving signals from test-bench is best-practice.
    Write a good test-bench for functional verification even for a simple design.
    Last edited by dpaul; 14th August 2019 at 15:58.
    FPGA enthusiast!



    •   AltAdvertisement

        
       

  9. #9
    Super Moderator
    Points: 31,137, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,182
    Helped
    1703 / 1703
    Points
    31,137
    Level
    43

    Re: Modelsim clock signal

    Quote Originally Posted by dpaul View Post
    I would never use stuff as create_wave or try to force a toggle behavior in order to generate a fundamental signal such as clock.
    For signals such as clocks and resets, drive them from the test-bench. Don't drive them from the simulator GUI or even using commands. Driving signals from test-bench is best-practice.
    Write a good test-bench for functional verification even for a simple design.
    I had considered pointing this out, but at least they are trying to simulate something, most posters don't even do this much simulation. Instead they immediately go to synthesis and implementation skipping simulation completely, then ask why their circuit doesn't work.

    - - - Updated - - -

    Quote Originally Posted by wesleytaylor View Post
    My version of modelsim/questasim doesn't even have create_wave.

    I have an option called force. In order to create a clock you force a toggle behaviour.

    I don't know where create_wave came from or why you're dead set on it?
    I finally found it. It is buried under a different menu and uses a completely different mechanism to apply it.
    Objects=>select signal and right click=>Modify=>Apply wave/apply clock=>Create Pattern Wizard

    Using it generates a line like
    create -driver freeze -pattern clock -initialvalue 1'hz -period 10ns -dutycycle 50 -starttime 0ns -endtime 1000ns sim:/test/clk

    this actually creates a new signal in the wave window, which appears to be shorted to the clk signal and drives it.



  10. #10
    Full Member level 5
    Points: 2,286, Level: 11

    Join Date
    May 2014
    Posts
    268
    Helped
    27 / 27
    Points
    2,286
    Level
    11

    Re: Modelsim clock signal

    Sweet. I found it useful for generating a ramp (counter), however interestingly it has no affect on the signal value.
    See picture
    Click image for larger version. 

Name:	create_wave_questa.PNG 
Views:	9 
Size:	23.3 KB 
ID:	154984

    wave create -pattern counter -startvalue 00000000 -endvalue 11111111 -type Range -direction Up -period 50ns -step 10 -repeat 5 -range 7 0 -starttime 0us -endtime 1000us sim:/tb/counter

    #1.
    Although it's fun playing with the tool and learning new features. You really want to have your testbench driving certain behaviour as outlined by #8

    From playing with this create_wave feature I cannot see my signal counter being updated in accordance with the wave value I generated.

    Regards,
    Wes



  11. #11
    Newbie level 3
    Points: 35, Level: 1

    Join Date
    Aug 2019
    Posts
    4
    Helped
    0 / 0
    Points
    35
    Level
    1

    Re: Modelsim clock signal

    thank you all ! I solved it, I talked to one from Intel and he advised me to install the NEW version of software because the one I have has these problems. (ModelSim-Altera 6.6d) With the new version the clock is generated without problems in the way you want.



--[[ ]]--