22 / 36 · Concepto
What follows the maximum value?
Calculate addition beyond the register width.
Las lecciones se pueden leer gratis. Inscríbete para guardar el progreso.
La traducción aún no está disponible. Se muestra la lección original. (English)
Learning goals
- Calculate an addition that exceeds the stored width
- Distinguish wrapping from saturation
Store only the bits that fit
Adding one to 11 mathematically gives 100. count stores only the low two bits, 00, so its next state is zero. This counter cycles through values zero to three.
A counter that stops at three needs an explicit condition. Declaring two bits does not automatically make it stop at its maximum.
| Current | Plus one | Stored two bits |
|---|---|---|
| 00 | 001 | 01 |
| 01 | 010 | 10 |
| 10 | 011 | 11 |
| 11 | 100 | 00 |
A new width needs new expectations
An unsigned N-bit counter represents zero through 2 to the power N minus one. A three-bit version wraps after seven. Check initialization, literal widths and expected waveforms along with the declaration.
First explain the original sequence 00 → 01 → 10 → 11 → 00. Then work on a copy, change the width and predict how the sequence will differ.
Inténtalo tú
A three-bit counter holds 110 with reset inactive. What are its next two values?
Leer la explicación
111, then 000. The first edge reaches seven and the second wraps beyond the three-bit range.