-- loop-based version
function hw_loop(v: std_logic_vector) return natural is
variable h: natural;
begin
h := 0;
for i in v'range loop
if v(i) = '1' then
h := h + 1;
end if;
end loop;
return h;
end function hw_loop;
-- recursive version
function hw_tree(v: std_...