configurable number of interfaces

Discussion in 'VHDL' started by ananth kamath, Apr 9, 2013.

  1. Hello,

    I need to have configurable number of interfaces in my entity. For example,

    library max_package;
    use max_package.all;

    entity for_example is
    port (
    fixed: out std_logic;
    variable: in std_logic_vector(0 to MAX)
    );
    end entity;

    lets assume that MAX is defined in a max_package. Now the problem is when MAX = 0, i still have the variable port signal visible in my entity. Is there a neat way of achieving this ?

    Kind Regards,
    Anantha
    ananth kamath, Apr 9, 2013
    #1
    1. Advertising

  2. ananth kamath

    KJ Guest

    On Tuesday, April 9, 2013 5:36:45 PM UTC-4, ananth kamath wrote:
    > Now the problem is when MAX = 0, i still have the variable port signal
    > visible in my entity. Is there a neat way of achieving this ?


    1. There is nothing wrong when MAX=0, you will simply have a vector of length 1, there is no reason for it to not be visible.

    2. Assuming you meant MAX=-1 (or perhaps the vector on the entity is defined to be 0 to (MAX-1)), there is still no problem. That would be a null vector.

    - So, why do you think that your signal needs to not be visible on the entity?
    - By the way, calling a port 'variable' won't work...that's a keyword

    Kevin Jennings
    KJ, Apr 10, 2013
    #2
    1. Advertising

  3. On Wednesday, April 10, 2013 1:16:30 PM UTC+2, KJ wrote:
    > On Tuesday, April 9, 2013 5:36:45 PM UTC-4, ananth kamath wrote:
    >
    > > Now the problem is when MAX = 0, i still have the variable port signal

    >
    > > visible in my entity. Is there a neat way of achieving this ?

    >
    >
    >
    > 1. There is nothing wrong when MAX=0, you will simply have a vector of length 1, there is no reason for it to not be visible.
    >
    >
    >
    > 2. Assuming you meant MAX=-1 (or perhaps the vector on the entity is defined to be 0 to (MAX-1)), there is still no problem. That would be a null vector.
    >
    >
    >
    > - So, why do you think that your signal needs to not be visible on the entity?
    >
    > - By the way, calling a port 'variable' won't work...that's a keyword
    >
    >
    >
    > Kevin Jennings




    Using the port name as "variable" wouldn't work :) Thanks for the correction.
    I am still a newbee in this field, so my question could be a bit lame.
    If I synthesize this code, the port having NULL vectors will not be present in my entity .. is my understanding correct ? And is the result true for all synthesizers ?

    Regards,
    Anantha
    ananth kamath, Apr 10, 2013
    #3
  4. ananth kamath

    Guest

    In Synplify, if you have a port with a null range, for example:

    dout: out std_logic_vector(-1 downto 0));

    it will not show up as a port. This is pretty cool, actually. I don't think you can do something similar in Verilog. (For one thing, you don't specify the range direction in Verilog.) Modelsim allows this but flags a warning.

    I don't know about other synthesizers. My guess would be that XST would crash and die if you give it a null range.
    , Apr 10, 2013
    #4
  5. ananth kamath

    KJ Guest

    On Wednesday, April 10, 2013 9:14:38 AM UTC-4, ananth kamath wrote:
    > If I synthesize this code, the port having NULL vectors will not be present
    > in my entity .. is my understanding correct ? And is the result true for
    > all synthesizers ? Regards, Anantha


    It is allowed to have a null vector on the entity. You just have to connect it to a null vector or leave it as 'open'. Either way, the vector is still listed in the port section of the entity and it can still be connected so your source code does not need to be modified for the special case.

    Since it is a null vector it will not synthesize to anything. The general use for null vectors is when the vector size is controlled by a generic (like you had in your post) and a perfectly legitimate setting for that generic happens to result in not actually needing the vector.

    As to 'all synthesizers', I dunno but if the one you're using doesn't support it then open a case with them and tell them that their competitiors do, you're considering switching to their tools which seem to be better supported. Quartus and Synplify support it.

    Kevin Jennings
    KJ, Apr 12, 2013
    #5
  6. Thanks a lot for the timely help. I found even XST supporting it :)

    On Friday, April 12, 2013 4:16:30 AM UTC+2, KJ wrote:
    > On Wednesday, April 10, 2013 9:14:38 AM UTC-4, ananth kamath wrote:
    >
    > > If I synthesize this code, the port having NULL vectors will not be present

    >
    > > in my entity .. is my understanding correct ? And is the result true for

    >
    > > all synthesizers ? Regards, Anantha

    >
    >
    >
    > It is allowed to have a null vector on the entity. You just have to connect it to a null vector or leave it as 'open'. Either way, the vector is still listed in the port section of the entity and it can still be connectedso your source code does not need to be modified for the special case.
    >
    >
    >
    > Since it is a null vector it will not synthesize to anything. The general use for null vectors is when the vector size is controlled by a generic (like you had in your post) and a perfectly legitimate setting for that generic happens to result in not actually needing the vector.
    >
    >
    >
    > As to 'all synthesizers', I dunno but if the one you're using doesn't support it then open a case with them and tell them that their competitiors do, you're considering switching to their tools which seem to be better supported. Quartus and Synplify support it.
    >
    >
    >
    > Kevin Jennings
    ananth kamath, Apr 17, 2013
    #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. dutta
    Replies:
    0
    Views:
    1,141
    dutta
    Aug 13, 2003
  2. rAinStorms

    Configurable Entity Statement

    rAinStorms, Feb 14, 2004, in forum: VHDL
    Replies:
    1
    Views:
    507
    Jonathan Bromley
    Feb 16, 2004
  3. Srinivasa Raghavan Sethuraman
    Replies:
    0
    Views:
    545
    Srinivasa Raghavan Sethuraman
    Jun 30, 2004
  4. VB Programmer

    Need good configurable forum... suggestion?

    VB Programmer, Oct 14, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    360
    =?Utf-8?B?UGF0Qg==?=
    Oct 14, 2005
  5. Xavier
    Replies:
    0
    Views:
    470
    Xavier
    Jan 9, 2004
Loading...

Share This Page