eshbonzie
Junior Member level 3
Hey guys,
I need to do a bubble sort for data in one of my arrays
I have something like this:
type SignatureArray is array (639 downto 0) of std_logic_vector(33 downto 0);
signal FrameSignatureArray : SignatureArray;
for x in 0 to 633 loop
for J in 0 to 633 loop
if(FrameSignatureArray(J+1)(23 downto 0) >= FrameSignatureArray(J)(23 downto 0)) then
FrameSignatureArray(J) <= FrameSignatureArray(J+1);
FrameSignatureArray(J+1) <= FrameSignatureArray(J);
end if;
end loop;
end loop;
I believe this will always end in both cells in the array having the same value. I know that signal assignment are nonblocking statements and they are executed delta time in future. Should I use variables?
for x in 0 to 633 loop
for J in 0 to 633 loop
if(FrameSignatureArray(J+1)(23 downto 0) > FrameSignatureArray(J)(23 downto 0)) then
temp := FrameSignatureArray1(J);
FrameSignatureArray1(J) := FrameSignatureArray1(J+1);
FrameSignatureArray1(J+1) := temp;
end if;
end loop;
end loop;
But doesn't seem to be working correctly
I know that having two nested loops are alot of logic to be implemented. is it really critical and I have to sort the array over 634 cycles?..I really would like to do the bubble sort in one cycle only.
Does any one have some hints or tips for creating this algorithm using VHDL or what would I have done wrong
Thanks
I need to do a bubble sort for data in one of my arrays
I have something like this:
type SignatureArray is array (639 downto 0) of std_logic_vector(33 downto 0);
signal FrameSignatureArray : SignatureArray;
for x in 0 to 633 loop
for J in 0 to 633 loop
if(FrameSignatureArray(J+1)(23 downto 0) >= FrameSignatureArray(J)(23 downto 0)) then
FrameSignatureArray(J) <= FrameSignatureArray(J+1);
FrameSignatureArray(J+1) <= FrameSignatureArray(J);
end if;
end loop;
end loop;
I believe this will always end in both cells in the array having the same value. I know that signal assignment are nonblocking statements and they are executed delta time in future. Should I use variables?
for x in 0 to 633 loop
for J in 0 to 633 loop
if(FrameSignatureArray(J+1)(23 downto 0) > FrameSignatureArray(J)(23 downto 0)) then
temp := FrameSignatureArray1(J);
FrameSignatureArray1(J) := FrameSignatureArray1(J+1);
FrameSignatureArray1(J+1) := temp;
end if;
end loop;
end loop;
But doesn't seem to be working correctly
I know that having two nested loops are alot of logic to be implemented. is it really critical and I have to sort the array over 634 cycles?..I really would like to do the bubble sort in one cycle only.
Does any one have some hints or tips for creating this algorithm using VHDL or what would I have done wrong
Thanks