C
Carlos
Guest
Hello,
I sometimes have to concatenate/de-concatenate vectors for example to feed them to a common FIFO (see below).
signal Ain, Aout : std_logic_vector(I-1 downto 0);
signal Bin, Bout : std_logic_vector(J-1 downto 0);
signal Cin, Cout : std_logic_vector(K-1 downto 0);
signal FIFOin, FIFOout : std_logic_vector(I+J+K-1 downto 0);
-- ...
FIFOin <= Ain & Bin & Cin;
-- ...
Aout <= FIFOout(Aout'length + Bout'length + Cout'length-1 downto Bout'length + Cout'length);
Bout <= FIFOout(Bout'length + Cout'length-1 downto Cout'length);
Cout <= FIFOout(Cout'length-1 downto 0);
This works fine, but my question would be, is there a neater way of doing the same thing since the code becomes quite lengthy and hard to follow when the number of vectors increases?
*** (Ideally something like a de-concatenate sort of operation would be nice, as shown below)
*** Aout & Bout & Cout <= FIFOout; -- INCORRECT
Thanks.
I sometimes have to concatenate/de-concatenate vectors for example to feed them to a common FIFO (see below).
signal Ain, Aout : std_logic_vector(I-1 downto 0);
signal Bin, Bout : std_logic_vector(J-1 downto 0);
signal Cin, Cout : std_logic_vector(K-1 downto 0);
signal FIFOin, FIFOout : std_logic_vector(I+J+K-1 downto 0);
-- ...
FIFOin <= Ain & Bin & Cin;
-- ...
Aout <= FIFOout(Aout'length + Bout'length + Cout'length-1 downto Bout'length + Cout'length);
Bout <= FIFOout(Bout'length + Cout'length-1 downto Cout'length);
Cout <= FIFOout(Cout'length-1 downto 0);
This works fine, but my question would be, is there a neater way of doing the same thing since the code becomes quite lengthy and hard to follow when the number of vectors increases?
*** (Ideally something like a de-concatenate sort of operation would be nice, as shown below)
*** Aout & Bout & Cout <= FIFOout; -- INCORRECT
Thanks.