Actually, I think you could make this work -- by making length a constant. This can be done because its calculation really only depends on the value of n, which is known at elaboration?compile? time.

Its initialisation then must be done in a function, something like this (though untested, it might have syntax errors or so)

Code:

function topow2(n : natural) return natural is
variable len : natural := n;
-- using len instead of length, in case that's a reserved keyword
begin
while len /= 0 loop
length := len/2;
pow := pow+1;
end loop;
return 2 ** pow;
end;
constant len : natural := topow2(n);
constant ZS : integer := length - n;