@@ -426,19 +426,17 @@ always @* begin
426
426
// updated sampled dst_phase error
427
427
428
428
// gain scheduling
429
- if (! sample_acc_sync_reg[SAMPLE_ACC_W- 1 ]) begin
430
- if (sample_acc_sync_reg[SAMPLE_ACC_W- 4 + : 3 ]) begin
431
- dst_gain_sel_next = 1'b1 ;
432
- end else begin
433
- dst_gain_sel_next = 1'b0 ;
434
- end
435
- end else begin
436
- if (~ sample_acc_sync_reg[SAMPLE_ACC_W- 4 + : 3 ]) begin
437
- dst_gain_sel_next = 1'b1 ;
438
- end else begin
439
- dst_gain_sel_next = 1'b0 ;
440
- end
441
- end
429
+ casez (sample_acc_sync_reg[SAMPLE_ACC_W- 4 + : 4 ])
430
+ 4'b01zz : dst_gain_sel_next = 1'b1 ;
431
+ 4'b001z : dst_gain_sel_next = 1'b1 ;
432
+ 4'b0001 : dst_gain_sel_next = 1'b1 ;
433
+ 4'b0000 : dst_gain_sel_next = 1'b0 ;
434
+ 4'b1111 : dst_gain_sel_next = 1'b0 ;
435
+ 4'b1110 : dst_gain_sel_next = 1'b1 ;
436
+ 4'b110z : dst_gain_sel_next = 1'b1 ;
437
+ 4'b10zz : dst_gain_sel_next = 1'b1 ;
438
+ default : dst_gain_sel_next = 1'b0 ;
439
+ endcase
442
440
443
441
// time integral of error
444
442
case (dst_gain_sel_reg)
@@ -850,19 +848,19 @@ always @* begin
850
848
// PI control
851
849
852
850
// gain scheduling
853
- if ( ! ts_ns_diff_reg[8 + CMP_FNS_W]) begin
854
- if (ts_ns_diff_reg[ 4 + CMP_FNS_W + : 4 ]) begin
855
- gain_sel_next = 1'b1 ;
856
- end else begin
857
- gain_sel_next = 1'b0 ;
858
- end
859
- end else begin
860
- if ( ~ ts_ns_diff_reg[ 4 + CMP_FNS_W + : 4 ]) begin
861
- gain_sel_next = 1'b1 ;
862
- end else begin
863
- gain_sel_next = 1'b0 ;
864
- end
865
- end
851
+ casez ( ts_ns_diff_reg[9 + CMP_FNS_W- 5 + : 5 ])
852
+ 5'b01zzz : gain_sel_next = 1'b1 ;
853
+ 5'b001zz : gain_sel_next = 1'b1 ;
854
+ 5'b0001z : gain_sel_next = 1'b1 ;
855
+ 5'b00001 : gain_sel_next = 1'b1 ;
856
+ 5'b00000 : gain_sel_next = 1'b0 ;
857
+ 5'b11111 : gain_sel_next = 1'b0 ;
858
+ 5'b11110 : gain_sel_next = 1'b1 ;
859
+ 5'b1110z : gain_sel_next = 1'b1 ;
860
+ 5'b110zz : gain_sel_next = 1'b1 ;
861
+ 5'b10zzz : gain_sel_next = 1'b1 ;
862
+ default : gain_sel_next = 1'b0 ;
863
+ endcase
866
864
867
865
// time integral of error
868
866
case (gain_sel_reg)
0 commit comments