Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why can't you use a Generate inside a process?

1,698 views
Skip to first unread message

Gary Watson

unread,
Apr 13, 2000, 3:00:00 AM4/13/00
to
Just noticed that you can't use a GENERATE inside a process. Why does this
restriction exist?

--

Gary Watson
ga...@nexsan.sex (Change dot sex to dot com to reply!!!)
Nexsan Technologies Ltd.
Derby DE21 7BF ENGLAND
http://www.nexsan.com


Joel Kolstad

unread,
Apr 13, 2000, 3:00:00 AM4/13/00
to
"Gary Watson" <ga...@nexsan.sex> wrote in message
news:MPnJ4.1$Fa1...@news-west.usenetserver.com...

> Just noticed that you can't use a GENERATE inside a process. Why does
this
> restriction exist?

Because "generate" is a concurrent statement, and a process is sequential.
What you want to use instead is the "loop" statement; it accomplishes much
the same thing.

---Joel Kolstad


Gary Watson

unread,
Apr 13, 2000, 3:00:00 AM4/13/00
to
Joel Kolstad <Joel.K...@USA.Net> wrote in message
news:sfc90dc...@corp.supernews.com...

Oh, ok, that makes sense. I was worried that this rule was invented
specifically to cause me pain.

Basil Brush

unread,
Apr 13, 2000, 3:00:00 AM4/13/00
to
> Just noticed that you can't use a GENERATE inside a process. Why does this
> restriction exist?

I had the same "problem".
Warp just told me it's a reserved word.
Reserved for what is different question.

Andy Peters

unread,
Apr 13, 2000, 3:00:00 AM4/13/00
to
Gary Watson wrote in message ...

>Joel Kolstad <Joel.K...@USA.Net> wrote in message
>news:sfc90dc...@corp.supernews.com...
>> "Gary Watson" <ga...@nexsan.sex> wrote in message
>> news:MPnJ4.1$Fa1...@news-west.usenetserver.com...
>> > Just noticed that you can't use a GENERATE inside a process. Why does
>> this
>> > restriction exist?
>>
>> Because "generate" is a concurrent statement, and a process is
sequential.
>> What you want to use instead is the "loop" statement; it accomplishes
much
>> the same thing.
>
>Oh, ok, that makes sense. I was worried that this rule was invented
>specifically to cause me pain.

Gary,

It would only cause you pain if you were trying to implement a vending
machine.

-- a
-----------------------------------------
Andy Peters
Sr Electrical Engineer
National Optical Astronomy Observatories
950 N Cherry Ave
Tucson, AZ 85719
apeters (at) noao \dot\ edu

"Money is property; it is not speech."
-- Justice John Paul Stevens


Volker Urban

unread,
Apr 18, 2000, 3:00:00 AM4/18/00
to
Joel Kolstad <Joel.K...@usa.net> wrote:
> "Gary Watson" <ga...@nexsan.sex> wrote in message
> news:MPnJ4.1$Fa1...@news-west.usenetserver.com...
>> Just noticed that you can't use a GENERATE inside a process. Why does
> this
>> restriction exist?

> Because "generate" is a concurrent statement, and a process is sequential.
> What you want to use instead is the "loop" statement; it accomplishes much
> the same thing.

Well, just let's ask the next 'why':
Why it's a concurrent statement?
I.e I want to connect a bit vector with 2 others like:

a(0) <= b(0);
a(1) <= c(0);
a(2) <= b(1);
a(3) <= c(1);
.
.
.

which follows the formula:

a(2*i) <= b(i);
a(2*i+1) <= c(i);

It's not fun typing that for a long a(), so let's do it by using Generate.
But it will not work within a process, I have to type it by hand. Why?
Why is generate not some kind of VHDL lines generator for any kind of
VHDL constructs. It seemed to be limited to Component instantiation or so.
Any reason?

+volker-

a...@z.com

unread,
Apr 18, 2000, 3:00:00 AM4/18/00
to
Volker Urban wrote:

> Joel Kolstad ?Joel.K...@usa.net? wrote:
> ? Because "generate" is a concurrent statement, and a process is sequential.
> ? What you want to use instead is the "loop" statement; it accomplishes much
> ? the same thing.


>
> Well, just let's ask the next 'why':
> Why it's a concurrent statement?
> I.e I want to connect a bit vector with 2 others like:
>

> a(0) ?= b(0);
> a(1) ?= c(0);
> a(2) ?= b(1);
> a(3) ?= c(1);


> .
> .
> .
>
> which follows the formula:
>

> a(2*i) ?= b(i);
> a(2*i+1) ?= c(i);


>
> It's not fun typing that for a long a(), so let's do it by using Generate.
> But it will not work within a process, I have to type it by hand. Why?
> Why is generate not some kind of VHDL lines generator for any kind of
> VHDL constructs. It seemed to be limited to Component instantiation or so.
> Any reason?
>
> +volker-

You do not have to type it by hand. Why don't you want to use a loop inside the
process as Joel pointed out? Something like:

for I in b'range loop
a(2*i) ?= b(i);
a(2*i+1) ?= c(i);
end loop;

Outside a process you would have:

l1:for I in b'range generate
a(2*i) ?= b(i);
a(2*i+1) ?= c(i);
end generate;

Generate generates hardware not VHDL lines. I think you are missing the
important difference between concurent and sequential VHDL code. Inside a
process you have sequential code (like normal C code) and outside processes you
have concurent code. The assignments in the loop occur sequentialy while the
assignments in the generate occur in parallel. If b and c depend somehow on a
then there is a big difference between the two. You cannot use generate inside a
process and you cannot use loop outside it but each one does exactly what you
want in its own domain.

Catalin

Volker Urban

unread,
Apr 19, 2000, 3:00:00 AM4/19/00
to
a...@z.com wrote:
> Volker Urban wrote:

>> Joel Kolstad ?Joel.K...@usa.net? wrote:
>> ? Because "generate" is a concurrent statement, and a process is sequential.
>> ? What you want to use instead is the "loop" statement; it accomplishes much
>> ? the same thing.

> Generate generates hardware not VHDL lines. I think you are missing the


> important difference between concurent and sequential VHDL code. Inside a

No, I do not miss it.

> process you have sequential code (like normal C code) and outside processes you
> have concurent code. The assignments in the loop occur sequentialy while the
> assignments in the generate occur in parallel. If b and c depend somehow on a
> then there is a big difference between the two. You cannot use generate inside a
> process and you cannot use loop outside it but each one does exactly what you
> want in its own domain.

Lets summarize:
"Generate" builts modified copies (modified by using a "loop index") of
concurrent assigments for internal representation and "loop" can be used
for the same dealing with sequential assigments.

If I would code a simulator, I would handle both commands in the same way,
i.e. building an array of pointers to an object.

Confusing most loops are not limited to work as "generators for sequential
assigments
(ie. for calculating functions ie n! :

y:=n;i:=n;Loop{i:=i-1;y:=y*i;IF i/=2 Loop;} (pseudo code))

which doesn't look much like to be done by "copying lines".

So I was misteached by the wrong rule : "If You have to do something like copy
and modify lines of code (say: "generate lines of code")
use "generate". Thanks for pointing out this.

+volker-

jain_...@my-deja.com

unread,
Apr 20, 2000, 3:00:00 AM4/20/00
to
generate is just for the component instantiation..as far as I
remember..and you can not instantiate the components in the process..

-naveen

In article <MPnJ4.1$Fa1...@news-west.usenetserver.com>,


"Gary Watson" <ga...@nexsan.sex> wrote:
> Just noticed that you can't use a GENERATE inside a process. Why does
this
> restriction exist?
>

> --
>
> Gary Watson
> ga...@nexsan.sex (Change dot sex to dot com to reply!!!)
> Nexsan Technologies Ltd.
> Derby DE21 7BF ENGLAND
> http://www.nexsan.com
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.

me...@mench.com

unread,
Apr 24, 2000, 3:00:00 AM4/24/00
to
On Thu, 20 Apr 2000 20:00:54 GMT, jain_...@my-deja.com wrote in
article <8dnnlb$87g$1...@nnrp1.deja.com>:

> generate is just for the component instantiation..as far as I
> remember..and you can not instantiate the components in the process..

Actually, generate statements can control the elaboration of any
concurrent statement, for example, processes....

Paul

--
Paul Menchini | "Outside of a dog, a book is probably man's
Menchini & Associates | best friend, and inside of a dog, it's too
me...@mench.com | dark to read."
www.mench.com | --Groucho Marx

0 new messages