DescriptionQ439
Q439FWASIC interview problem
Map packed words to unpacked bytes
TechniquesPacked arrayUnpacked arrayEndianness
DifficultyEasy
TopicBit Manipulation
LanguageSystemVerilog
Requirements3 checkpoints
01
Problem
Split a 32-bit packed word into four unpacked bytes using little-endian byte lanes, then rebuild the original word.
Example input and output
Use this case to check your interpretationInput
word = 32'hA1B2_C3D4Output
bytes[0:3] = [D4, C3, B2, A1]; rebuilt_word = 32'hA1B2_C3D4Explanation
Little-endian lane zero is word[7:0], and the inverse indexed part-select mapping reproduces every source bit.
02
Requirements (3)
- Define byte 0 as word[7:0].
- Use indexed part-selects rather than an implicit array assignment.
- Rebuilding the word must reproduce every input bit.
