I don't have a compiler in front of me, but I wonder if this would be
YACDA (yet another cosmetically-different approach):
function get_range(n : natural) return
std_logic_vector is
variable v : std_logic_vector((n+1)*4 downto n*4)) := (others =>
'0');
begin
return v;
end function
-- usage
a <= b(get_range(2)'range);
I like this less than KJ's approach (especially because his get_slice
takes in the aggregate vector, clearly expressing intent), but I
thought I'd still pose it for discussion.
MB