ptp: Tame the control loop a bit, avoid higher gain when locked

Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
Alex Forencich
2026-02-13 17:30:52 -08:00
parent 0461953bcc
commit 8b6fb5fdb2

View File

@@ -420,7 +420,7 @@ always_comb begin
endcase
// time integral of error
case (dst_gain_sel_reg)
case (dst_gain_sel_reg && !dst_sync_locked_reg)
1'd0: {dst_ovf, dst_err_int_next} = $signed({1'b0, dst_err_int_reg}) + (PHASE_ACC_W+2)'($signed(sample_acc_sync_reg));
1'd1: {dst_ovf, dst_err_int_next} = $signed({1'b0, dst_err_int_reg}) + (PHASE_ACC_W+2)'($signed(sample_acc_sync_reg) * 2**7);
endcase
@@ -435,7 +435,7 @@ always_comb begin
end
// compute output
case (dst_gain_sel_reg)
case (dst_gain_sel_reg && !dst_sync_locked_reg)
1'd0: {dst_ovf, dst_phase_inc_next} = $signed({1'b0, dst_err_int_reg}) + ($signed(sample_acc_sync_reg) * 2**4);
1'd1: {dst_ovf, dst_phase_inc_next} = $signed({1'b0, dst_err_int_reg}) + ($signed(sample_acc_sync_reg) * 2**11);
endcase