8. Serial to parallel
Bits arrive one at a time on din, least significant bit first. A bit is only real on a clock edge where din_valid is 1; edges with din_valid = 0 are ignored.
After every eighth valid bit, put the assembled byte on data and raise data_valid for exactly one clock cycle. data keeps the last complete byte until the next one is finished. Then start collecting the next byte.
rst (synchronous, active high) clears data to 0, data_valid to 0 and forgets any partly collected bits.
Ports
| Port | Dir | Bits | What it is |
|---|---|---|---|
clk | in | 1 | Clock. |
rst | in | 1 | Synchronous reset, active high. |
din | in | 1 | Serial data, LSB first. |
din_valid | in | 1 | din holds a bit on this edge. |
data | out | 8 | The last complete byte. |
data_valid | out | 1 | 1 for one cycle when a new byte is ready. |
Example
Sending 0, 0, 1, 0, 1, 1, 0, 1 (bit 0 first) gives data = 1011_0100 (0xB4) with data_valid = 1 for the cycle after the eighth bit.
Written hints
AI hint
Submissions
No submissions yet. Submit your answer and it shows here. Sign in to keep them.
Submit your answer to have it graded. The hidden test runs on the server; you see whether it passes and, if not, the first case it gets wrong.
Press Build to check your code with Yosys. Errors and warnings show here, and a clean build draws the logic diagram.
Build your design to drive it by hand and see its signals here.