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

Reply

VHDL - case and generic

 
Thread Tools Search this Thread
Old 07-11-2006, 09:07 PM   #1
Default case and generic


Hello,
I have question:
If Argument of case is generic from entity, then after synthesis
generated code will be equal to
Q<= romValueArray2(iConvAdress); ????

------------------------------------------
entity xxxx is
generic(
sectionCount :integer := 2; -- section count
);

.......................

architecture xxx_arch of xxx is
begin
process(ADDRESS)
variable iConvAdress:integer:=0;
begin
case sectionCount is
when 2 =>
Q<= romValueArray2(iConvAdress);

when 4 =>
Q<= romValueArray4(iConvAdress);
......................



MariuszK
  Reply With Quote
Old 07-11-2006, 09:24 PM   #2
KJ
 
Posts: n/a
Default Re: case and generic

"MariuszK" <> wrote in message
news: ups.com...
> Hello,
> I have question:
> If Argument of case is generic from entity, then after synthesis
> generated code will be equal to
> Q<= romValueArray2(iConvAdress); ????


Yes, and you should see the same thing with a simulator.

KJ


  Reply With Quote
Old 07-12-2006, 07:39 AM   #3
MariuszK
 
Posts: n/a
Default Re: case and generic


KJ napisal(a):
> "MariuszK" <> wrote in message
> news: ups.com...
> > Hello,
> > I have question:
> > If Argument of case is generic from entity, then after synthesis
> > generated code will be equal to
> > Q<= romValueArray2(iConvAdress); ????

>
> Yes, and you should see the same thing with a simulator.
>
> KJ

Maybe I don't detailed my question. But I want ask If used of fpga
resources will be the same for architecture
............
case genericValue is
when 2 =>
Q<= romValueArray2(iConvAdress);
..........
and for architecture with only this line (genericValue = 2)
Q<= romValueArray2(iConvAdress);


Mariusz

  Reply With Quote
Old 07-12-2006, 10:34 AM   #4
KJ
 
Posts: n/a
Default Re: case and generic

"MariuszK" <> wrote in message
news: oups.com...
>
> KJ napisal(a):
>> "MariuszK" <> wrote in message
>> news: ups.com...
>> > Hello,
>> > I have question:
>> > If Argument of case is generic from entity, then after synthesis
>> > generated code will be equal to
>> > Q<= romValueArray2(iConvAdress); ????

>>
>> Yes, and you should see the same thing with a simulator.
>>
>> KJ

> Maybe I don't detailed my question. But I want ask If used of fpga
> resources will be the same for architecture
> ...........
> case genericValue is
> when 2 =>
> Q<= romValueArray2(iConvAdress);
> .........
> and for architecture with only this line (genericValue = 2)
> Q<= romValueArray2(iConvAdress);
>
>
> Mariusz
>

Yes, both flavors of code will synthesize to the exact same thing. In your
original code with the case statement, the synthesizer will see that
'sectionCount', which is used to select the appropriate case, is constant
and will optomize out all cases other than the one corresponding to the
selected value of the constant (in this case 'sectionCount = 2'). That
leaves only the line of code
Q<= romValueArray2(iConvAdress);
to implement/synthesize. No synthesis tool that I know of would do anything
different in this situation.

KJ


  Reply With Quote
Old 07-12-2006, 12:26 PM   #5
MariuszK
 
Posts: n/a
Default Re: case and generic


KJ napisal(a):
> "MariuszK" <> wrote in message
> news: oups.com...
> >
> > KJ napisal(a):
> >> "MariuszK" <> wrote in message
> >> news: ups.com...
> >> > Hello,
> >> > I have question:
> >> > If Argument of case is generic from entity, then after synthesis
> >> > generated code will be equal to
> >> > Q<= romValueArray2(iConvAdress); ????
> >>
> >> Yes, and you should see the same thing with a simulator.
> >>
> >> KJ

> > Maybe I don't detailed my question. But I want ask If used of fpga
> > resources will be the same for architecture
> > ...........
> > case genericValue is
> > when 2 =>
> > Q<= romValueArray2(iConvAdress);
> > .........
> > and for architecture with only this line (genericValue = 2)
> > Q<= romValueArray2(iConvAdress);
> >
> >
> > Mariusz
> >

> Yes, both flavors of code will synthesize to the exact same thing. In your
> original code with the case statement, the synthesizer will see that
> 'sectionCount', which is used to select the appropriate case, is constant
> and will optomize out all cases other than the one corresponding to the
> selected value of the constant (in this case 'sectionCount = 2'). That
> leaves only the line of code
> Q<= romValueArray2(iConvAdress);
> to implement/synthesize. No synthesis tool that I know of would do anything
> different in this situation.
>
> KJ


Thank you very much for clear answer.
It is exacly what I expected.

Mariusz

  Reply With Quote
Old 07-12-2006, 01:41 PM   #6
Andy
 
Posts: n/a
Default Re: case and generic

Synthesis automatically optimizes out constants and static values.
Also, since for-loops are unrolled for synthesis, the loop index
becomes effectively static, and is optimized out as well.

Andy


MariuszK wrote:
> KJ napisal(a):
> > "MariuszK" <> wrote in message
> > news: oups.com...
> > >
> > > KJ napisal(a):
> > >> "MariuszK" <> wrote in message
> > >> news: ups.com...
> > >> > Hello,
> > >> > I have question:
> > >> > If Argument of case is generic from entity, then after synthesis
> > >> > generated code will be equal to
> > >> > Q<= romValueArray2(iConvAdress); ????
> > >>
> > >> Yes, and you should see the same thing with a simulator.
> > >>
> > >> KJ
> > > Maybe I don't detailed my question. But I want ask If used of fpga
> > > resources will be the same for architecture
> > > ...........
> > > case genericValue is
> > > when 2 =>
> > > Q<= romValueArray2(iConvAdress);
> > > .........
> > > and for architecture with only this line (genericValue = 2)
> > > Q<= romValueArray2(iConvAdress);
> > >
> > >
> > > Mariusz
> > >

> > Yes, both flavors of code will synthesize to the exact same thing. In your
> > original code with the case statement, the synthesizer will see that
> > 'sectionCount', which is used to select the appropriate case, is constant
> > and will optomize out all cases other than the one corresponding to the
> > selected value of the constant (in this case 'sectionCount = 2'). That
> > leaves only the line of code
> > Q<= romValueArray2(iConvAdress);
> > to implement/synthesize. No synthesis tool that I know of would do anything
> > different in this situation.
> >
> > KJ

>
> Thank you very much for clear answer.
> It is exacly what I expected.
>
> Mariusz


  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
Forum Jump