A one-dimensional array of a sequence of consecutive elements of another one-dimensional array.
object_name ( discrete_range )
function_call ( discrete_range )
The slice is a subarray of a one-dimensional array, from a single element up to complete array.
The prefix used for a slice is the name of the parent array.
The index used for a slice must fall in the range of the indexes of the parent array. Moreover, the direction of the slice indexes must be the same as the direction of indexes of parent array (either ascending or descending).
The slice is an object which can be used in the same way as its parent array: if the parent array is a signal, then any its slice is also a signal, etc.
If the discrete range of a slice is null then the slice is null as well.
signal DataBus : Bit_Vector(31
downto 0); -- parent array
DataBus(31 downto 26) -- slice 1
DataBus(24 downto 24) -- slice 2
DataBus(24 downto 30) -- slice 3
DataBus(15 to 31) -- no slice - ERROR!
The first slice is a 6-element Subarray of the DataBus. The second slice contains one element. Slice 3 is a null slice (the range is null). Finally, the fourth example is an error due to different directions of the parent array and the slice.
The direction of the parent array and its slice must match (i.e. in both cases either to or downto keyword must be used).