case and generic

Discussion in 'VHDL' started by MariuszK, Jul 11, 2006.

  1. MariuszK

    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, Jul 11, 2006
    #1
    1. Advertising

  2. MariuszK

    KJ Guest

    "MariuszK" <> wrote in message
    news:...
    > 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, Jul 11, 2006
    #2
    1. Advertising

  3. MariuszK

    MariuszK Guest

    KJ napisal(a):
    > "MariuszK" <> wrote in message
    > news:...
    > > 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, Jul 12, 2006
    #3
  4. MariuszK

    KJ Guest

    "MariuszK" <> wrote in message
    news:...
    >
    > KJ napisal(a):
    >> "MariuszK" <> wrote in message
    >> news:...
    >> > 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, Jul 12, 2006
    #4
  5. MariuszK

    MariuszK Guest

    KJ napisal(a):
    > "MariuszK" <> wrote in message
    > news:...
    > >
    > > KJ napisal(a):
    > >> "MariuszK" <> wrote in message
    > >> news:...
    > >> > 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
     
    MariuszK, Jul 12, 2006
    #5
  6. MariuszK

    Andy Guest

    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:...
    > > >
    > > > KJ napisal(a):
    > > >> "MariuszK" <> wrote in message
    > > >> news:...
    > > >> > 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
     
    Andy, Jul 12, 2006
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thorsten Bunte

    Generic in CASE choice ?!?

    Thorsten Bunte, Apr 28, 2005, in forum: VHDL
    Replies:
    4
    Views:
    714
    Taras_96
    Apr 29, 2005
  2. Murat Tasan
    Replies:
    1
    Views:
    8,057
    Chaitanya
    Feb 3, 2009
  3. Replies:
    2
    Views:
    440
  4. minlearn
    Replies:
    2
    Views:
    461
    red floyd
    Mar 13, 2009
  5. Paatsch, Bernd

    Generic method without case/when?

    Paatsch, Bernd, Feb 14, 2006, in forum: Ruby
    Replies:
    1
    Views:
    106
    Robert Klemme
    Feb 14, 2006
Loading...

Share This Page