vhdl - Split n long bit logic vector to n individual binary values -


i wondering if there method can split n bit long vector example:

10100111

into n individual binary units used later on? i'm trying incorporate method can 8 bit long vector , have 8 led's light depending if n'th value 0 or 1. googling question returns people cutting larger vector smaller ones, if have 16 bits example i'd have make 16 separate variables work using:

entity test port (  myvector : in std_logic_vector(16 downto 0);  led : out std_logic_vector(16 downto 0) ); end test  architecture behavior of test  signal led1 : std_logic;  ...  signal led16 : std_logic; begin   led1 <= myvector(0);  ...  led16 <= myvector(16);   led(1) <= '1' when led1 = '1' else '0';  ...  led(16) <= '1' when led16 = '1' else '0'; end behavior 

doesn't seem tidy when needs repeated several times in code.

if want declare , assign identifiers different names, have make line each name, since there no loop statement identifier name manipulation in vhdl.

but vhdl provides arrays, can loop on entries, example code:

...    signal led_sig  : std_logic_vector(16 downto 0); begin   loop_g: idx in myvector'range generate     led_sig(idx) <= myvector(idx);     led(idx)     <= '1' when led_sig(idx) = '1' else '0';   end generate; ... 

where assigns equivalent shorter:

led_sig <= myvector; led     <= led_sig; 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -