FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-14-2007, 04:00 AM
Franck Y
Guest
 
Posts: n/a
Default Weird concatenation

Hello,

I have some constant name like this

ok1
ok2
ok3
ok4 etc....

I am doing a loop
but i don't know how i can acces to those value

for i in 0 to 1loop

if (d_col_1(i)='1') then
go("ok"+i,red);

END IF;

But it wont't work do you have any clue ?

Thanks

Reply With Quote
  #2 (permalink)  
Old 11-14-2007, 03:36 PM
Paul Uiterlinden
Guest
 
Posts: n/a
Default Re: Weird concatenation

Franck Y wrote:

> Hello,
>
> I have some constant name like this
>
> ok1
> ok2
> ok3
> ok4 etc....
>
> I am doing a loop
> but i don't know how i can acces to those value
>
> for i in 0 to 1loop
>
> if (d_col_1(i)='1') then
> go("ok"+i,red);
>
> END IF;
>
> But it wont't work do you have any clue ?


If you want to access those constants in a loop, indexed by the loop
counter, you'll have to store those constants in an array.

For example:

TYPE ok_tbl_type IS ARRAY(natural RANGE <>) OF natural;
CONSTANT ok: ok_tbl_type :=
(
1 => 123,
2 => 456,
3 => 777,
4 => 999
);

In this example an array of naturals is chosen, but you can choose any type.

Then you can use ok(1), ok(2) etc, or use a loop:

FOR i IN ok'RANGE LOOP -- same as: FOR i IN 1 TO 4 LOOP
IF d_col_1(i) = '1' THEN
go(ok(i), red);
END IF;
END LOOP;

--
Paul Uiterlinden
www.aimvalley.nl
e-mail addres: remove the not.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
concatenation N vectors zlotawy VHDL 0 10-28-2007 11:46 PM
generic concatenation Chad VHDL 4 08-26-2004 05:48 PM
vector concatenation pandora VHDL 5 04-05-2004 08:57 AM
Zero width concatenation. Ron Smith Verilog 2 10-24-2003 02:35 PM
what's the difference between VHDL 93 CONCATENATION and VHDL 87 CONCATENATION? walala VHDL 3 09-18-2003 06:17 AM


All times are GMT +1. The time now is 01:33 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved