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 04-27-2005, 03:24 AM
boku
Guest
 
Posts: n/a
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;
Reply With Quote
  #2 (permalink)  
Old 04-27-2005, 08:01 PM
avishay
Guest
 
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;


Reply With Quote
  #3 (permalink)  
Old 04-28-2005, 12:37 PM
David R Brooks
Guest
 
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" <[email protected]> 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

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
for...generate loop with generics, constants (vhdl) geoffrey wall FPGA 2 10-03-2005 10:20 PM
There is a way to instantiate 'N' VHDL components using a repetitive strutucture ? ivan FPGA 3 09-30-2005 11:45 AM
how instantiate generic vhdl entity with verilog ? kagior Verilog 3 04-25-2005 08:41 AM
For Loop Generate Statement Roman Zeilinger VHDL 2 09-23-2004 04:59 PM
Components instantiation in loop? VHDL User VHDL 1 09-05-2004 10:04 PM


All times are GMT +1. The time now is 04:21 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