UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
3,651 Views
Registered: ‎03-08-2012

newbie's question about variable's characteristics

Jump to solution

Hey, I have a code as follow:

process(clk)

variable list_head : element_ptr := NULL;
variable temp_elem : element_ptr := NULL;
variable last_clk : std_logic := 'U';
begin

.......

end process

 

 

my question:  1. the 'list_head' and the other variables are initialized everytime when the process is triggered?

                          2. is 'list_head' visible out of the process? If the 'list_head' is changed to a signal, is it visible out of the process?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
Teacher hgleamon1
Teacher
4,573 Views
Registered: ‎11-14-2011

Re: newbie's question about variable's characteristics

Jump to solution

1. No. Initialisations are power-on values only (and quite distinct from a reset value). Your question shows quite a "software" mentality. You need to think about it in terms of hardware (FFs). How would it be "initialised"? How useful would it be if it were "initialised" every clock (as you have a clocked process)?

 

2. No, variables cannot be used outside of their defining process. Making the variable a signal will allow it be used by other processes (note that you should only assign a value to a signal in ONE process).

 

Regards,

 

Howard

 

----------
"That which we must learn to do, we learn by doing." - Aristotle

View solution in original post

0 Kudos
3 Replies
Teacher hgleamon1
Teacher
4,574 Views
Registered: ‎11-14-2011

Re: newbie's question about variable's characteristics

Jump to solution

1. No. Initialisations are power-on values only (and quite distinct from a reset value). Your question shows quite a "software" mentality. You need to think about it in terms of hardware (FFs). How would it be "initialised"? How useful would it be if it were "initialised" every clock (as you have a clocked process)?

 

2. No, variables cannot be used outside of their defining process. Making the variable a signal will allow it be used by other processes (note that you should only assign a value to a signal in ONE process).

 

Regards,

 

Howard

 

----------
"That which we must learn to do, we learn by doing." - Aristotle

View solution in original post

0 Kudos
Explorer
Explorer
3,625 Views
Registered: ‎03-08-2012

Re: newbie's question about variable's characteristics

Jump to solution

Thank you very much for your reply.

As for the "Hardware" mentality, I will try.

What do you mean by "assign in ONE process"? Do you mean we can "read" the signal in many processes, but can "write" in ONE process? 

0 Kudos
Teacher hgleamon1
Teacher
3,616 Views
Registered: ‎11-14-2011

Re: newbie's question about variable's characteristics

Jump to solution

Regarding signal assignments, that's exactly what I mean.

 

It's a situation that trips up many people, newbies and more experienced designers (although usually with more complex designs) and can be a source of simulation frustration.

 

Good luck.

----------
"That which we must learn to do, we learn by doing." - Aristotle
0 Kudos