Skip to main content
added 263 characters in body
Source Link
Dave Tweed
  • 178.3k
  • 17
  • 242
  • 418

If the shift amount is greater than the width of the mantissa (24 bits), then the mantissa of the smaller number becomes completely irrelevant and can be simply zero'd out. That what the AND-OR logic is determining.

This allows the barrel shifter to be smaller, since it only needs to handle 24 cases rather than the full 256 cases.

This would have been a lot more obvious if the Verilog had been written as

 always_comb
    if (shamt >= 24)
        shmant = 24'b0;
    else
        shmant = shiftedval;

which synthesizes to exactly the same logic as the original code.

If the shift amount is greater than the width of the mantissa (24 bits), then the mantissa of the smaller number becomes completely irrelevant and can be simply zero'd out. That what the AND-OR logic is determining.

This allows the barrel shifter to be smaller, since it only needs to handle 24 cases rather than the full 256 cases.

If the shift amount is greater than the width of the mantissa (24 bits), then the mantissa of the smaller number becomes completely irrelevant and can be simply zero'd out. That what the AND-OR logic is determining.

This allows the barrel shifter to be smaller, since it only needs to handle 24 cases rather than the full 256 cases.

This would have been a lot more obvious if the Verilog had been written as

 always_comb
    if (shamt >= 24)
        shmant = 24'b0;
    else
        shmant = shiftedval;

which synthesizes to exactly the same logic as the original code.

Source Link
Dave Tweed
  • 178.3k
  • 17
  • 242
  • 418

If the shift amount is greater than the width of the mantissa (24 bits), then the mantissa of the smaller number becomes completely irrelevant and can be simply zero'd out. That what the AND-OR logic is determining.

This allows the barrel shifter to be smaller, since it only needs to handle 24 cases rather than the full 256 cases.