precedence of a downto clause

Discussion in 'VHDL' started by ejubenville, Mar 28, 2013.

  1. ejubenville

    ejubenville Guest

    If I use a downto clause on a function call at the end of a concatenation, will the downto clause apply only to the return value of the function call, or to the whole concatenation?

    In other words, does this:
    myvalue & myfunc()(7 downto 0)
    mean:
    (myvalue & myfunc())(7 downto 0)
    or:
    myvalue & (myfunc()(7 downto 0))

    Here is an example. Suppose GetZeros returns a std_logic_vector of 8 bits, all zeros, and I write this statement:

    result <= b"1111" & GetZeros()(3 downto 0);

    Will the result be b"11110000", throwing the middle four bits away from b"111100000000"? Or would the result be b"0000", throwing away all but the lower 4 bits of the entire concatenation?
     
    ejubenville, Mar 28, 2013
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.