The accumulate and average codes do not work. Maybe you can run simulation to understand better.
When the same node is updated multiple times in LHS of non-blocking assignments, only the last one takes effect.
In the code, IEtotal gets reduced to effectively single statement of "IEtotal <= IEtotal + Iearly[4095];". IEtotal is always X without reset. Similarly for the other regs in the loop.
For summation of IEtotal, you can create intermediate combinatorial adder before feeding it to IEtotal. Break it into 2 "always" blocks. Something like,
always @(posedge sysclk)
begin
...
IEtotal <= IEtotal_intermediate;
...
end
always @*
begin
IEtotal_intermediate = 32'h00000000;
for(n = 0; n < 4096; n = n +1)
IEtotal_intermediate = IEtotal_intermediate + {31'h00000000, Iearly[n]};
end