Hallo Forum, ich versuche gerade den Verilog-Code des RedPitayah PID
Reglers zu verstehen.
1 | wire [ 33-1: 0] int_sum ;
|
2 | reg [ 32-1: 0] int_reg ;
|
3 |
|
4 | // hab hier was weggelassen
|
5 |
|
6 | else if (int_sum[33-1:33-2] == 2'b01) // positive saturation
|
7 | int_reg <= 32'h7FFFFFFF; // max positive
|
8 | else if (int_sum[33-1:33-2] == 2'b10) // negative saturation
|
9 | int_reg <= 32'h80000000; // max negative
|
10 | else
|
11 | int_reg <= int_sum[32-1:0]; // use sum as it is
|
12 | end
|
int_sum ist ein 33 Bit typ,
int_rg ist ein 32 Bit typ.
beim Test auf negative Sättigung wäre meiner Meinung:
1 | else if (int_sum[33-1:33-2] == 2'b11) // negative saturation
|
richtig. Oder liege ich da falsch?