precedence of a downto clause

E

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?
 
On 28/03/13 21:30, ejubenville wrote:
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?
According to the standard, a slice is a kind of name, and a name is a
primary of an expression - so the slice must be evaluated before the
concatenation operator,

regards
Alan

--
Alan Fitch
 

Welcome to EDABoard.com

Sponsor

Back
Top