How to convert 8 bits to 16 bits in VHDL?

后端 未结 5 536
南笙
南笙 2020-12-17 14:29

I have an input signal from ADC convertor that is 8 bits (std_logic_vector(7 downto 0)). I have to convert them to a 16 bits signal (std_logic_vector(15 d

5条回答
  •  盖世英雄少女心
    2020-12-17 15:19

    For completeness, yet another way which is occasionally useful:

    --  Clear all the slv_16 bits first and then copy in the bits you need.  
    process (slv_8)
    begin
        slv_16 <= (others => '0');
        slv_16(7 downto 0) <= slv_8;
    end process;
    

    I've not had to do this for vectors that I can recall, but I have had need of this under more complex circumstances: copying just a few relevant signals into a bigger, more complex, record was one time.

提交回复
热议问题