indexing - Creating a vector with other vector`s index as elements in VHDL -
i have std_logic_vector 1 input: v1 = "10001010" , want create vector one: v2 = x"00000731", x"7", x"3", , x"1" represent index of first vector (v1) value '1'.
v1(1) = '1', v1(2) = '0', v1(3) = '1', etc.
please me coding examples can create v2.
something like:
variable base : natural := 0; .... v2 <= (others => '0'); in v1'right v1'left loop if v1(i) = '1' v2(base+3 downto base) = to_unsigned(i,4); base := base + 4; end if; end for;
Comments
Post a Comment