case and generic

M

MariuszK

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);
......................
 
K

KJ

MariuszK said:
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
 
M

MariuszK

KJ napisal(a):
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
 
K

KJ

MariuszK said:
KJ napisal(a):
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
 
M

MariuszK

KJ napisal(a):
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
 
A

Andy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Generic N-bit multiplier 1
2 flip-flop synchronizer 1
2 JK Circuit in VHDL 0
Tasks 1
VHDL - parameterised generic constants 1
Problem with case-statement 2
Using abstract generic 7
Generic multiplexer 1

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top