Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

VHDL simulation problem

Status
Not open for further replies.

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
The following happens in ModelSim :

Code:
signal noise : std_logic := '0' ;
signal stable_one : std_logic ;
signal x : std_logic ;

stable_one <= '1' ;
noise <= not noise after 100 ns ;
[COLOR="#FF0000"]x[/COLOR] <= noise , stable_one after 10 ms ;

I expected that signal 'x' will stabilize to a stable logic '1' after 10 ms. However, the waveform shows otherwise!
signal x continues to be driven by signal "noise" indefinitely...

Why is that ???
How shall I rewrite my code so it'll do what I expect it to...?
 

Now what did your mother teach you about including full testbench code and a screenshot of your waveform?
 

Code:
library ieee ;
	use ieee.std_logic_1164.all ;
	use ieee.numeric_std.all ;
	use ieee.math_real.all ;

library work ;
	use work.package_functions.all ;
	
	
	
	
	
entity tb_debouncer is
generic
( 
    G :   unsigned ( 31 downto 0 ) := to_unsigned ( 50000000 , 32 )								             
) ;											
end entity tb_debouncer ;





architecture simulation_tb_debouncer of tb_debouncer is





component debouncer is
generic
( 
    G : unsigned ( 31 downto 0 ) := to_unsigned ( 50000000 , 32 )								             
) ;												
port							
( 							   
	I_CLOCK :       	in 	std_logic ;                               				        			
	I_RESET_GLOBAL :	in 	std_logic ;                                  			  			
	I_RESET_LOCAL : 	in 	std_logic ;        		                   				
	I_TIME :		in	unsigned ( log_2_unsigned ( G ) downto 0 ) ;  
	I_BOUNCING : 	in 	std_logic ;                            			    
	O_DEBOUNCED :	buffer 	std_logic ;   
	O_RISE :		buffer 	std_logic ;   
	O_FALL :		buffer 	std_logic 
) ;       
end component debouncer ;





signal stimulus_i_clock :	std_logic := '0' ;  
signal stimulus_i_reset_global :	std_logic ; 
signal stimulus_i_reset_local :	std_logic ; 
signal stimulus_i_time :	unsigned ( log_2_unsigned ( G ) downto 0 ) ;
signal stimulus_noise :	std_logic := '0' ;
signal stimulus_i_bouncing :        std_logic ;





begin





	stimulus_noise <= not stimulus_noise after 500 ns ;
	stimulus_i_clock <= not stimulus_i_clock after 10 ns ;
	stimulus_i_reset_global <= '1' , '0' after 1 us ;
	stimulus_i_reset_local <= '1' , '0' after 2 us ;
	stimulus_i_time <= to_unsigned ( 900000000 , stimulus_i_time ' length ) ; 
	stimulus_i_bouncing <= stimulus_noise , '1' after 10 ms ;

	

	
	
	waveform : debouncer 
	generic map
	( 
		G => G							             
	) 									
	port map						
	( 							   
		I_CLOCK =>              stimulus_i_clock , 	       			
		I_RESET_GLOBAL =>	stimulus_i_reset_global ,			
		I_RESET_LOCAL => 	stimulus_i_reset_local ,
		I_TIME =>		stimulus_i_time ,
		I_BOUNCING => 	stimulus_i_bouncing ,
		O_DEBOUNCED =>	open ,
		O_RISE =>	open ,
		O_FALL =>                open 
	) ;       

end architecture simulation_tb_debouncer ;

- - - Updated - - -

untitled.JPG

10ms is where the cursor is...

- - - Updated - - -

the signal in question is the first one ( "stimulus_i_bouncing" )
 

not really noise if it toggles like that ;)

Anyway, I dont quite get it either, assuming that really is 10 ms (sure its not 10 us? ). Have you tried other versions of modelsim? have you raised a support request?
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
Thanks TrickyDicky,

10mS - no doubt about it. Tried it with different delays - same result.
I've tried it at on version 6.5
Will retry tomorrow on 10.1 - haven't contacted Mentor support yet.

I thought that there was something I was missing (VHDL wise) but I guess not...
Wouldn't be the first time ModelSim makes me regret using it.
 

I resimulated the code with ModelSim 10.1
The problem persists!

Any suggestions ? ( a true solution/explanation for the problem - not a workaround solution )
 
Last edited:

Please forgive my ignorance but I've never seen that coding style before using the comma

Code:
stimulus_i_reset_global <= '1' , '0' after 1 us ;
	stimulus_i_reset_local <= '1' , '0' after 2 us ;
	stimulus_i_time <= to_unsigned ( 900000000 , stimulus_i_time ' length ) ; 
	stimulus_i_bouncing <= stimulus_noise , '1' after 10 ms ;

I assume that this is a valid way so my question is does this work correctly for stimulus_i_reset_global, stimulus_i_reset_local and only gives wrong result for stimulus_i_bouncing ?
 

You are switching from a waveform to a constant value, and I am not sure how this affects the event scheduling.
You can do it like this:

Code:
select_signal <= '0', '1' after 10 ms;
x <= stimulus_noise when select_signal = '0' else '1' ;
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
I assume that this is a valid way so my question is does this work correctly for stimulus_i_reset_global, stimulus_i_reset_local and only gives wrong result for stimulus_i_bouncing ?
Correct alexan_e

std_match,
As I noted there're many possible solutions for this problem...I found a workaround before posting.
It's not the issue here - I wanted to know if it was me doing something wrong or the engineers at Mentor Graphics...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top