case and generic

M

MariuszK

Guest
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" <mariusz.kwiczala@gmail.com> wrote in message
news:1152648466.923094.78770@s13g2000cwa.googlegroups.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
 
KJ napisal(a):
"MariuszK" <mariusz.kwiczala@gmail.com> wrote in message
news:1152648466.923094.78770@s13g2000cwa.googlegroups.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
 
"MariuszK" <mariusz.kwiczala@gmail.com> wrote in message
news:1152686345.682900.209570@p79g2000cwp.googlegroups.com...
KJ napisal(a):
"MariuszK" <mariusz.kwiczala@gmail.com> wrote in message
news:1152648466.923094.78770@s13g2000cwa.googlegroups.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
 
KJ napisal(a):
"MariuszK" <mariusz.kwiczala@gmail.com> wrote in message
news:1152686345.682900.209570@p79g2000cwp.googlegroups.com...

KJ napisal(a):
"MariuszK" <mariusz.kwiczala@gmail.com> wrote in message
news:1152648466.923094.78770@s13g2000cwa.googlegroups.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
 
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" <mariusz.kwiczala@gmail.com> wrote in message
news:1152686345.682900.209570@p79g2000cwp.googlegroups.com...

KJ napisal(a):
"MariuszK" <mariusz.kwiczala@gmail.com> wrote in message
news:1152648466.923094.78770@s13g2000cwa.googlegroups.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
 

Welcome to EDABoard.com

Sponsor

Back
Top