Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ312
Page ↗
Q312FWASIC interview problem

Rotate a packed word

TechniquesBitsRotationParameterized width
DifficultyMedium
TopicBit Manipulation
LanguageSystemVerilog
Requirements4 checkpoints
01

Problem

Implement rotate-left and rotate-right for a W-bit packed vector.

Example input and output

Use this case to check your interpretation
Input
W=8, word = 8'b1001_0001, rotate_left = 3
Output
8'b1000_1100
Explanation

The upper three bits wrap into the low end rather than being discarded.

02

Requirements (4)

  • Require W to be a positive compile-time width.
  • Normalize shifts larger than W.
  • Return x unchanged when the normalized shift is zero.
  • Do not accidentally perform a shift by W.