Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

[SOLVED] Modelsim clock signal

maro.pitti

Newbie level 3
Joined
Aug 13, 2019
Messages
4
Helped
Reputation
0
Reaction score
0
Trophy points
1
Activity points
35
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:


create_wave.png



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:

create_wave2.png




2) I generated the clock like this:
clock1.png




Now the result is correct.

clock.png



Why in the first case is it wrong? Thanks a lot .
 
Last edited:

ads-ee

Super Moderator
Joined
Sep 10, 2013
Messages
7,527
Helped
1761
Reputation
3,528
Reaction score
1,707
Trophy points
113
Location
USA
Activity points
55,480
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.
 

maro.pitti

Newbie level 3
Joined
Aug 13, 2019
Messages
4
Helped
Reputation
0
Reaction score
0
Trophy points
1
Activity points
35
But why in the first case I was wrong?
 

ads-ee

Super Moderator
Joined
Sep 10, 2013
Messages
7,527
Helped
1761
Reputation
3,528
Reaction score
1,707
Trophy points
113
Location
USA
Activity points
55,480
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.
 

maro.pitti

Newbie level 3
Joined
Aug 13, 2019
Messages
4
Helped
Reputation
0
Reaction score
0
Trophy points
1
Activity points
35
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.
 

ads-ee

Super Moderator
Joined
Sep 10, 2013
Messages
7,527
Helped
1761
Reputation
3,528
Reaction score
1,707
Trophy points
113
Location
USA
Activity points
55,480
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.
 

wesleytaylor

Full Member level 5
Joined
May 1, 2014
Messages
281
Helped
28
Reputation
56
Reaction score
24
Trophy points
18
Activity points
2,649
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?
 

dpaul

Advanced Member level 4
Joined
Jan 16, 2008
Messages
1,345
Helped
288
Reputation
576
Reaction score
283
Trophy points
1,363
Location
Germany
Activity points
10,309
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:

ads-ee

Super Moderator
Joined
Sep 10, 2013
Messages
7,527
Helped
1761
Reputation
3,528
Reaction score
1,707
Trophy points
113
Location
USA
Activity points
55,480
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 - - -

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.
 

wesleytaylor

Full Member level 5
Joined
May 1, 2014
Messages
281
Helped
28
Reputation
56
Reaction score
24
Trophy points
18
Activity points
2,649
Sweet. I found it useful for generating a ramp (counter), however interestingly it has no affect on the signal value.
See picture
create_wave_questa.PNG

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
 

maro.pitti

Newbie level 3
Joined
Aug 13, 2019
Messages
4
Helped
Reputation
0
Reaction score
0
Trophy points
1
Activity points
35
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.
 

Toggle Sidebar

Welcome to EDABoard.com

Sponsor

Sponsor

Design Fast


X
Top