T
Tobias Baumann
Guest
Hi everybody
I have a 32 bit std_logic_vector, for example something like this:
00010101111111111101010000000000
Now I want to find the place where the 1's start to be constant for at
least five times and where it ends to be constant. In the example above
I try to indicate
00010101111111111101010000000000
^ ^
| |
Do someone know a good technique to implement this? A working solution
is to loop over all bits and compare like:
-- find first transistion
for i in 0 to 27 loop
if (match_mask(i+5-1 downto i) = "11111") then
first_trans := i;
exit;
end if;
end loop;
-- find last transistion
for i in 0 to 27 loop
if (match_mask(31-i downto 31-i-5+1) = "11111") then
last_trans := 31-i;
exit;
end if;
end loop;
But is this effective (I want to synthesize the code with XST)? Does
someone know how to make it better?
Thanks a lot,
Tobias
I have a 32 bit std_logic_vector, for example something like this:
00010101111111111101010000000000
Now I want to find the place where the 1's start to be constant for at
least five times and where it ends to be constant. In the example above
I try to indicate
00010101111111111101010000000000
^ ^
| |
Do someone know a good technique to implement this? A working solution
is to loop over all bits and compare like:
-- find first transistion
for i in 0 to 27 loop
if (match_mask(i+5-1 downto i) = "11111") then
first_trans := i;
exit;
end if;
end loop;
-- find last transistion
for i in 0 to 27 loop
if (match_mask(31-i downto 31-i-5+1) = "11111") then
last_trans := 31-i;
exit;
end if;
end loop;
But is this effective (I want to synthesize the code with XST)? Does
someone know how to make it better?
Thanks a lot,
Tobias