Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • RTL Foundations57
  • Combinational Design58
    • Combinational Timing Overview
    • Muxes, Decoders and Encoders
    • Arithmetic Blocks
    • Comparators and Shifters
    • Tri-State and Shared Buses
    • Latch Inference
    • Arithmetic Datapaths
      • Fixed-Point Contract
      • Width Growth
      • Rounding and Quantization
      • Saturation Policy
      • Divider Architectures
  • Sequential Design61
  • FSM & Control66
  • Timing & Clocking64
  • Reset & CDC58
  • Memory & Buses94
  • Advanced RTL60
  • Senior & Interview175
  • Glossary and Notation
Loading lesson

‹Arithmetic Datapaths
  1. Topics
  2. RTL Design
  3. Combinational Design
  4. Arithmetic Datapaths
  5. Fixed-Point Contract

Part 2 · Combinational · Advanced

Fixed-Point Contract

Treat a fixed-point signal as an integer plus a documented scale, not as an informal bit vector.

Why this matters

The bits 0110 mean 1.50 in Q2.2 and 0.75 in Q1.3. Hardware does integer arithmetic, so the binary point lives only in your contract, and a missing contract becomes a scale error in the datapath.

After this lesson you can: read and write QI.F formats, align binary points before adding, and predict the fractional bits of a product.

This course uses QI.F with I including the sign bit. Total width is I + F; therefore signed Q1.15 is a 16-bit value spanning -1 through 1 - 2^-15. Some texts exclude the sign bit and call the same layout Q0.15, so an interface specification must state its convention.

For the sensor pipeline, both inputs are signed Q1.15. The stored code x represents x / 2^15; the hardware still performs integer arithmetic.

xreal​=xcode​⋅2−F

Start with four bits

Signed Q2.2 uses four bits: weights -2, 1, 1/2, 1/4. Its range is -2 to 1.75 in steps of 0.25; the binary point is an interpretation, not a stored bit.

Stored bits

Signed integer code

Q2.2: divide by 4

Q1.3: divide by 8

0110

6

+1.50

+0.75

1010

-6

-1.50

-0.75

1000

-8

-2.00

-1.00

0111

7

+1.75

+0.875

The bits 0110 do not say where the binary point belongs. Changing only the format label changes the interpreted value. To preserve +1.50 while increasing F from 2 to 3, first widen the signed code and then shift left: code 6 becomes code 12 (01100 in five-bit Q2.3), and 12 / 8 = 1.50. Four-bit Q1.3 cannot represent +1.50.

Alignment before addition is the same idea: +0.50 in Q2.2 has code 2, while +0.25 in Q2.3 has code 2. Adding raw codes gives 4 with an ambiguous scale. Convert the first operand to Q2.3 code 4, then add 4 + 2 = 6, which represents +0.75. Retain a growth bit for general addition.

Check yourself In signed Q2.2, what do bits 1111 represent?

The signed integer code is -1; divide by 4 to get -0.25. Equivalently, -2+1+1/2+1/4=-0.25. It is not unsigned 15/4.

Format

Width

Resolution

Approximate range

Signed Q1.15

16

2^-15

-1 to 1-2^-15

Signed Q8.8

16

2^-8

-128 to 127.996

Unsigned Q4.12

16

2^-12

0 to 15.9998

Addition requires aligned binary points. Multiplication adds fractional bits: QI1.F1 times QI2.F2 produces a full result with F1+F2 fractional bits.

design.sv
1
2
3
4
5
6
7
// snippet: Q1.15 multiply, full precision then explicit rescale
logic signed [15:0] a_q15, b_q15;
logic signed [31:0] product_q30;
logic signed [15:0] result_q15;

assign product_q30 = a_q15 * b_q15;
assign result_q15  = product_q30 >>> 15;

This short scale illustration uses floor-and-wrap: arithmetic shift rounds toward negative infinity, and assignment retains only 16 bits. It is not the running design's final nearest-even-and-clamp boundary, implemented in the quantization lesson.

Common pitfall

A right shift changes scale but does not by itself define rounding or overflow. Name both policies at every narrowing boundary.

Check yourself Two Q1.15 values multiply. How many fractional bits are in the full product?

Thirty. Returning to Q1.15 requires a 15-bit right shift plus an explicit rounding and saturation decision.

Remember

  • QI.F has total width I + F, with I including the sign bit. The stored code x means x / 2^F.

  • Addition needs aligned binary points. A product has F1 + F2 fractional bits.

  • A right shift changes scale but does not define rounding or overflow. Name both at every narrowing step.

Rule of thumb: write the format of every signal, including the sign-bit convention.

Keep going

  • Interview: run a mock interview on this topic

Related topics

  • Width growth

  • Number systems

Previous

111 / 694

Next: Width Growth

Up next

Up nextWidth Growth

Sign in to save progress

Practice this lessonReport an error

See also

  • Rounding and Quantization
  • Saturation Policy
  • Divider Architectures