I have not taken the time to set up a simulation, but as for the line 69 error I have an answer.
When the following block executes:
if D_in = "11" then
C <= 0;
elsif C < n-1 then
C <= C + 1;
end if;
C can equal n.
This is an issue since:
.
signal memory_last_row : std_logic_vector (0 to 2*n-1) ; -- because D_in has 2 bits the memory needs to be 2*D_in
signal changed_chk : std_logic_vector (0 to n-1) ;
.
.
memory_last_row(2*C) <= D_in(1);
memory_last_row(2*C+1) <= D_in(0);
Assume n = 3, so C = 3 after the execution of C < n if statement. When you calculate the declared size of the signal memory_last_row (2*3-1 = 5) and the index you are trying to select (2*3 = 6), you are out of bounds.