Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

code

Status
Not open for further replies.

woody583

Technical User
Nov 16, 2004
1
GB
hi, i am pretty new to vhdl, and am not sure how to go about a project i have been given.

i have two binary numbers '00001001' and '10010010' that i want to store in an array. once they are in that array i am not sure how to acces them and hence use them as part of a seperate process.

for example i have a varaiable called 'mode' when i set mode <= '1'
i want that to some how give me access to the first binary number in my array. and when 'mode' <= '2' i want this to mean i use the second binary number

any help would be greatly appreciated

thanks in advance

 
You can use WHEN-ELSE construct for this.
If temp is your output signal, then use the following code.

temp <= "00001001" when mode = '0' else "10010010";

If the mode can take more values, then may be you can use the ROM coding style.

Case (mode) is
when "0000" temp <= "0001";
when "0001" temp <= "0010";
when "0010" temp <= "0100";

so on...

end case;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top