Use of std_logic '-' don't care. - vhdl

This is a discussion on Use of std_logic '-' don't care. - vhdl ; Well, when Ashenden fails me, here's where I turn. Hopefully this is a quickie. I defined an address constant in the following manner (as an example). constant MY_ADDR : std_logic_vector(7 downto 0) := "10010---"; The intent here is that only ...

+ Reply to Thread
Results 1 to 7 of 7

Use of std_logic '-' don't care.

  1. Default Use of std_logic '-' don't care.

    Well, when Ashenden fails me, here's where I turn. Hopefully this is
    a quickie.

    I defined an address constant in the following manner (as an example).

    constant MY_ADDR : std_logic_vector(7 downto 0) := "10010---";

    The intent here is that only the 5 most significant bits are decoded
    and the last 3 are don't care.

    As a matter of fact, I have an array of these addresses. So, I had
    something like the following while processing the addresses (this is
    testbench code, never intended for synthesis):

    for i in 0 to NUM_ADDR-1 loop
    if (addr = MY_ADDR(i)) then
    -- Do something incredibly interesting here
    end if;
    end loop;

    What I discovered was that my incredibly interesting code was not
    being used. So, thinks I, perhaps the equality operator is taking
    this a little more seriously than I wanted? I turn to Ashenden, and
    study the bits where std_ulogic is discussed, and then the operators,
    and there seems to be no mention of how an equality test treats don't
    cares in a vector.

    So, language gurus, is this correct? Is equality going to look for
    EXACTLY the same vector, including don't cares? If this is true, then
    I'll need to do some sort of explicit decode. I'm fairly certain
    things like 'and' and 'or' behave nicely with don't cares, so that may
    be the way to go. I was hoping for something a little more intuitive,
    but such is life sometimes.

    Thanks!
    Mark Norton


  2. Default Re: Use of std_logic '-' don't care.

    M. Norton wrote:

    > constant MY_ADDR : std_logic_vector(7 downto 0) := "10010---";

    ....
    > What I discovered was that my incredibly interesting code was not
    > being used.
    >


    http://www.vhdl.org/comp.lang.vhdl/FAQ1.html#dont_cares

  3. Default Re: Use of std_logic '-' don't care.

    On Oct 16, 5:09 pm, Mike Treseler <mtrese...@gmail.com> wrote:
    > M. Norton wrote:
    > > constant MY_ADDR : std_logic_vector(7 downto 0) := "10010---";

    > ...
    > > What I discovered was that my incredibly interesting code was not
    > > being used.  

    >
    > http://www.vhdl.org/comp.lang.vhdl/FAQ1.html#dont_cares


    Again, thank you! I had no idea that function existed (the
    std_match). Does precisely what I wanted for this.

  4. Default Re: Use of std_logic '-' don't care.

    Mike Treseler wrote:
    > M. Norton wrote:
    >
    >> constant MY_ADDR : std_logic_vector(7 downto 0) := "10010---";

    > ...
    >> What I discovered was that my incredibly interesting code was not
    >> being used.
    >>

    >
    > http://www.vhdl.org/comp.lang.vhdl/FAQ1.html#dont_cares


    Which is precisely why I pushed for the "std_match" function in numeric_std.

    In VHDL-2008 you can use the "case?" syntax (see section 8.8) does
    pretty much what you want here. You also have the ?= syntax.


  5. Default Re: Use of std_logic '-' don't care.

    On Oct 19, 4:00 pm, David Bishop <dbis...@vhdl.org> wrote:
    > Which is precisely why I pushed for the "std_match" function in numeric_std.
    >
    > In VHDL-2008 you can use the "case?" syntax (see section 8.8) does
    > pretty much what you want here.  You also have the ?= syntax.


    It's definitely a good function. I'm reminded that way back when,
    when I did more C programming I had a small book of C functions and
    library packages that was extremely handy for coding purposes. As
    well as a reminder of the syntax of functions, it's information on
    what functions actually EXIST.

    I have to admit, if a functino doesn't show up on a quick reference
    card that I have stashed around, and not a basic language feature, I'm
    not likely to know about it. textio is an exception, though I have a
    sticky note tab in my Ashenden book for the big list of procedures and
    functions that acts as as a quick reference card. It would probably
    be well worth my time digging through the standard packages for other
    gems like std_match. The trick will be remembering them if/when the
    opportunity to use them arises.


  6. Default Re: Use of std_logic '-' don't care.

    On Oct 20, 2:11 pm, Mike Treseler <mtrese...@gmail.com> wrote:
    > M. Norton wrote:
    > > It would probably
    > > be well worth my time digging through the standard packages for other
    > > gems like std_match.  The trick will be remembering them if/when the
    > > opportunity to use them arises.

    >
    > Check out the qualis cheat sheets
    >
    >  http://www.vhdl.org/rassp/vhdl/guidelines/vhdlqrc.pdf
    >  http://www.vhdl.org/rassp/vhdl/guidelines/1164qrc.pdf


    Thanks. Those look extremely handy, particularly the overloaded
    operators and conversion functions. I know I'm always consulting the
    notes I have on the types and how to move back and forth between
    them. And lo and behold there is std_match (though not a lot of
    description of what it does... would still probably need to look at
    the library code to ascertain that it is accounting for the non-binary
    values to which std_logic may be set.

  7. Default Re: Use of std_logic '-' don't care.

    M. Norton wrote:
    > On Oct 19, 4:00 pm, David Bishop <dbis...@vhdl.org> wrote:
    >> Which is precisely why I pushed for the "std_match" function in numeric_std.
    >>
    >> In VHDL-2008 you can use the "case?" syntax (see section 8.8) does
    >> pretty much what you want here. You also have the ?= syntax.

    >
    > It's definitely a good function. I'm reminded that way back when,
    > when I did more C programming I had a small book of C functions and
    > library packages that was extremely handy for coding purposes. As
    > well as a reminder of the syntax of functions, it's information on
    > what functions actually EXIST.


    There are lots of cool things buried in these packages. The "to_string"
    functions are the real timesaver for me.

    > I have to admit, if a functino doesn't show up on a quick reference
    > card that I have stashed around, and not a basic language feature, I'm
    > not likely to know about it. textio is an exception, though I have a
    > sticky note tab in my Ashenden book for the big list of procedures and
    > functions that acts as as a quick reference card. It would probably
    > be well worth my time digging through the standard packages for other
    > gems like std_match. The trick will be remembering them if/when the
    > opportunity to use them arises.


    Wait until you see Peters's 3rd addition.

+ Reply to Thread