![]() |
Events on individual bits of a vector
I want to test for events on individual bits of a std_logic_vector signal... something like this:
Assume vec is signal vec : std_logic_vector(63 downto 0)... Code:
for i in 63 downto 0 loopAttribute "event" requires a static signal prefix. Is there a way to check individual bits of a signal vector for an event? |
this might work
Since you need to check 64 bits for events which can occur at any time, you need to generate concurrent hardware to check each one. This code might work:
Code:
for i in vec'range generateOn second thought, you know what else you can do? To save on hardware you could do this: Code:
-- |
hmmm... interesting. I didn't know you can use generate in that manner (I only used it to for entities).
But are you sure that works? I just tried it and I get an "Illegal concurrent statement" error. I was supposed to check for events in my testbench but I decided to use your code inside my entity (where I also use several generate statements) and it gives me that error. |
Sorry about that. I just modified my previous post. Perhaps that'll help. I've been away from VHDL for a while and have gotten pretty rusty.
|
Thanks for your input! I really appreciate it.
Unfortunately, there was something I forgot to mention. That "do something" actually needs to know which bit has that event. To do something like this: Code:
if (vec(i)'event) thenCode:
if(vec'event) thenvec'event compiles. vec(i)'event does not. So my problem is that I actually need to know which bit in the vector has an event. Thanks again for your efforts though! |
Dang! I really have been away.
|
I have a basic solution going... not really elegant. Basically I have another variable that stores the previous values of 'vec' and XORs them with current values of vec.
Code:
-- assume variable prev_vec_vals : std_logic_vector (63 downto 0) := (others => '0');It seems to be working fine right now. Perhaps someone who ran into my problem could find this useful. |
| All times are GMT. The time now is 10:40 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.