BitFlow

Shift Register (PISO)

intermediate · sequential · 135 XP

Sign in to write your solution, run it in the simulator and submit it for grading.

Sign in or create a free account →

Problem

Shift Register — PISO (Parallel-In Serial-Out) A 4-bit PISO shift register. A parallel word is loaded all at once when `load=1`, then shifted out one bit at a time via `so`. **Interface** | Port | Direction | Description | |-----------|-----------|------------------------------------| | `clk` | input | Clock | | `rst` | input | Synchronous reset | | `load` | input | 1=load parallel data, 0=shift | | `pi[3:0]`| input | Parallel input data | | `so` | output | Serial output (MSB exits first) | **Operation:** - `load=1`: `sr <= pi` (load all 4 bits at once) - `load=0`: `sr <= {sr[2:0], 1'b0}` (shift left, MSB exits) - `so = sr[3]` always **Use case:** SPI transmitter — CPU writes a byte, hardware shifts it out bit-by-bit. Keyboard scan matrices use PISO registers.

Constraints

  • load=1 has priority over shifting.
  • MSB (sr[3]) exits first via so.
  • Fill LSB with 0 during shift.

Examples

Input: load=1, pi=4'b1011, then load=0 x4

Output: so outputs: 1,0,1,1

Common questions

What does the Shift Register (PISO) problem ask you to build?
Shift Register — PISO (Parallel-In Serial-Out) A 4-bit PISO shift register. A parallel word is loaded all at once when `load=1`, then shifted out one bit at a time via `so`.
What constraints does Shift Register (PISO) have?
load=1 has priority over shifting.; MSB (sr[3]) exits first via so.; Fill LSB with 0 during shift.
What is an example input and output for Shift Register (PISO)?
Input load=1, pi=4'b1011, then load=0 x4 gives output so outputs: 1,0,1,1.
Which Verilog concepts does Shift Register (PISO) practise?
sequential, shift-register, PISO, parallel-to-serial.