variable cnt1 : std_logic_vector(20 downto 0):= (cnt1'right => '1', others => '0');

Joined
Mar 12, 2009
Messages
3
Reaction score
0
Hi,

I want to initialise a variable this way :
Code:
variable cnt1 : std_logic_vector(20 downto 0):= (cnt1'right => '1', others => '0');

I know i doesn't work, i want to know the correct way of doing this kind of initialisations.

Best regards,
Hassen.
 
Joined
Mar 10, 2008
Messages
348
Reaction score
0
Try this

variable cnt1 : std_logic_vector(20 downto 0):= ((0)=>'1',others=>'0');

Your welcome
Jeppe
 
Joined
Mar 12, 2009
Messages
3
Reaction score
0
Hi,
Thank you, it worked !

Now i want to do the following :
Code:
if count = ((20 downto 11) => (others => '0'), (10 downto 0) => (others => '1')) then
	   led <= '1';
	  end if;
or :
Code:
if count = ((20 downto 11) => (others => '0'), others => '1') then
	   led <= '1';
	  end if;

Best regardes,
Hassen.
 
Last edited:
Joined
Mar 10, 2008
Messages
348
Reaction score
0
The best way will be this:

if count="000000000011111111111" then
led<='1';
end if;

Your welcome
Jeppe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top