Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - How to instantiate identical components by for loop or generate in VHDL?

 
Thread Tools Search this Thread
Old 04-27-2005, 02:24 AM   #1
Default How to instantiate identical components by for loop or generate in VHDL?


Dear all,
I'm trying to use For-loop or generate to instantiate RAM
components but am stuck. I don't know how to assign each instance name
so I can reference each individual component. Or generate statement
can achieve this? Looking forward to ur answer. Thanks a lot!~

--------------------------------------------
for n in SWMMBSIZE_IN_ROW-1 downto 0 loop
swmsram(n): mbbankinswm
port map(
address => std_logic_vector(addr),
datain => din,
write => write,
dataout => dout,
clk => clk
);
end loop;


boku
  Reply With Quote
Old 04-27-2005, 07:01 PM   #2
avishay
 
Posts: n/a
Default Re: How to instantiate identical components by for loop or generate in VHDL?
Hi
This is the code you need:

for n in SWMMBSIZE_IN_ROW-1 downto 0 generate
swmsram: mbbankinswm
port map(
address => std_logic_vector(addr),
datain => din,
write => write,
dataout => dout(n), -- <== Note this!
clk => clk
);
end loop;

Notes:
1. You should use the GENERATE statement. This is a concurrent
statement (not within a process).
2. At elaboration time, a numbered sufix is appended to each component
label. I
don't know if this suffix is standart among all
simulators/synthesizers, but this is not a problem unless you need to
refer a component's label.
3. Some port mappings (at least outputs, usually) must be dependent on
the loop variable, or else all your generated components will be
connected in parallel.

Hope it helps,
Avishay

boku wrote:
> Dear all,
> I'm trying to use For-loop or generate to instantiate RAM
> components but am stuck. I don't know how to assign each instance

name
> so I can reference each individual component. Or generate statement
> can achieve this? Looking forward to ur answer. Thanks a lot!~
>
> --------------------------------------------
> for n in SWMMBSIZE_IN_ROW-1 downto 0 loop
> swmsram(n): mbbankinswm
> port map(
> address => std_logic_vector(addr),
> datain => din,
> write => write,
> dataout => dout,
> clk => clk
> );
> end loop;




avishay
  Reply With Quote
Old 04-28-2005, 11:37 AM   #3
David R Brooks
 
Posts: n/a
Default Re: How to instantiate identical components by for loop or generate in VHDL?
If you need the component label to (for example) apply an attribute,
you put the attribute inside the lpp. Thus:

for n in RANGE generate
-- attributes here
begin -- Note we now need a "begin"
-- as before

"avishay" <> wrote:

:Hi
:This is the code you need:
:
:for n in SWMMBSIZE_IN_ROW-1 downto 0 generate
: swmsram: mbbankinswm
: port map(
: address => std_logic_vector(addr),
: datain => din,
: write => write,
: dataout => dout(n), -- <== Note this!
: clk => clk
: );
:end loop;
:
:Notes:
:1. You should use the GENERATE statement. This is a concurrent
:statement (not within a process).
:2. At elaboration time, a numbered sufix is appended to each component
:label. I
:don't know if this suffix is standart among all
:simulators/synthesizers, but this is not a problem unless you need to
:refer a component's label.
:3. Some port mappings (at least outputs, usually) must be dependent on
:the loop variable, or else all your generated components will be
:connected in parallel.
:
:Hope it helps,
:Avishay
:
:boku wrote:
:> Dear all,
:> I'm trying to use For-loop or generate to instantiate RAM
:> components but am stuck. I don't know how to assign each instance
:name
:> so I can reference each individual component. Or generate statement
:> can achieve this? Looking forward to ur answer. Thanks a lot!~
:>
:> --------------------------------------------
:> for n in SWMMBSIZE_IN_ROW-1 downto 0 loop
:> swmsram(n): mbbankinswm
:> port map(
:> address => std_logic_vector(addr),
:> datain => din,
:> write => write,
:> dataout => dout,
:> clk => clk
:> );
:> end loop;



David R Brooks
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute an external software from VHDL? And how to interface VHDL with JAVA? becool_nikks Software 0 03-06-2009 07:08 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46