Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > How to instantiate identical components by for loop or generate in VHDL?

Reply
Thread Tools

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

 
 
boku
Guest
Posts: n/a
 
      04-27-2005
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;
 
Reply With Quote
 
 
 
 
avishay
Guest
Posts: n/a
 
      04-27-2005
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;


 
Reply With Quote
 
 
 
 
David R Brooks
Guest
Posts: n/a
 
      04-28-2005
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" <(E-Mail Removed)> 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;

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triple nested loop python (While loop insde of for loop inside ofwhile loop) Isaac Won Python 9 03-04-2013 10:08 AM
How to generate variable labels for same component within a generate loop Weng Tianxiang VHDL 5 02-16-2006 01:45 PM
Instantiate primitives in for-generate? George Mercury VHDL 2 08-02-2005 01:04 AM
SWING components adjustment in different resolutions - Should show scrollbars less than 800X600 and expand components over this resolution Bluetears76 Java 1 07-01-2004 09:01 PM
Can Choice components respond to keyboard input like HTML Choice components? Mickey Segal Java 0 02-02-2004 10:59 PM



Advertisments