BitFlow

Universal Shift Register

intermediate · sequential · 175 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

Universal Shift Register A 4-bit universal shift register supports **all four modes** via a 2-bit mode select `s[1:0]`. This mirrors the real **74HC194** IC. | s | Mode | |---|-----------------------| | 00 | Hold (no change) | | 01 | Right shift (si_r → MSB) | | 10 | Left shift (si_l → LSB) | | 11 | Parallel load (pi → q) | **Interface** | Port | Direction | Description | |-----------|-----------|---------------------------------| | `clk` | input | Clock | | `rst` | input | Synchronous reset | | `s[1:0]`| input | Mode select | | `si_r` | input | Right-shift serial input (→MSB) | | `si_l` | input | Left-shift serial input (→LSB) | | `pi[3:0]`| input | Parallel data input | | `q[3:0]`| output | Register output | This is the capstone shift register problem — it combines load, left, right, and hold in one module.

Constraints

  • Use case(s) inside always @(posedge clk).
  • rst overrides all modes.
  • Use non-blocking assignments (<=).

Examples

Input: s=11, pi=4'hA

Output: q=4'hA (load)

Input: s=01, si_r=1

Output: q={1,q[3:1]} (right shift)

Input: s=10, si_l=0

Output: q={q[2:0],0} (left shift)

Input: s=00

Output: q=prev (hold)

Common questions

What does the Universal Shift Register problem ask you to build?
Universal Shift Register A 4-bit universal shift register supports **all four modes** via a 2-bit mode select `s[1:0]`. This mirrors the real **74HC194** IC.
What constraints does Universal Shift Register have?
Use case(s) inside always @(posedge clk).; rst overrides all modes.; Use non-blocking assignments (<=).
What is an example input and output for Universal Shift Register?
Input s=11, pi=4'hA gives output q=4'hA (load).
Which Verilog concepts does Universal Shift Register practise?
sequential, shift-register, universal, interview, 74194.