Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Implement a constant multiply without truncation

Hardware interview practice

Implement a constant multiply without truncation

MediumRTL ArithmeticSystemVerilog

For an unsigned 10-bit input, implement y = 9*x + 3 without using the multiplication operator and choose an expression width that preserves the maximum result.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

input  logic [9:0]  x;
output logic [13:0] y;
Reviewed example

Work through one case

Input
x = 10'd1023
Expected output
y = 14'd9210

The maximum input produces 9*1023 + 3 = 9210, which is below 2^14 and therefore fits losslessly in 14 bits.

What to cover

Requirements

  1. Implement 9*x as (x << 3) + x.
  2. Extend x before shifting so every intermediate is 14 bits wide.
  3. Add the constant 3 without truncation.
  4. State and verify the maximum possible result.
Continue practicing

Related questions

RTL DesignReverse a physical bus at the lane boundary→RTL DesignDiagnose storage from an incomplete always_comb block→RTL DesignImplement a parameterized binary-to-Gray converter→
asic.fyi · Learn silicon end to end.info@asic.fyi