How does this line of code below works as the multiplication of (1024-31)?
The code is intended to be synthesized for FPGA, so shifting is used instead of direct division.
But what I do not understand is that how such shifting mimics the multiplication of the value of reg_acc * (1024-31).
reg [27:0] reg_adj;
reg [27:0] reg_acc;
...
reg_adj <= ((reg_acc[11:0] << (20)) - ((reg_acc[11:0] << (15)) - (reg_acc[11:0] << (10)))) // x (1024-31)
...