RTL Studio Open IDE

Shift & Bit Manipulation

Rotate Left/Right 8-Bit — L1 Upgrade — L2 Upgrade

8-bit serial-in shift register with parallel load, supporting left/right shift modes and serial data injection.

About this block

Simulate it in the Verilog IDE

Easyverilogsimsyn

Rotate Left/Right 8-Bit — L1 Upgrade — L2 Upgrade is a Verilog reference block in the Shift & Bit Manipulation catalog. Shifters, rotators, bit masks, and bitwise manipulation blocks. Marked Easy: a small block you can read, simulate, and synthesize in one sitting.

This IP core implements an 8-bit serial-in shift register with parallel load capability.

It supports configurable shifting directions (left or right) controlled by a mode signal, making it suitable for arithmetic operations, serial data processing, and FIFO-like buffer implementations.

The design includes synchronous reset and enable controls for flexible integration into larger digital systems.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Rotate Left/Right 8-Bit — L1 Upgrade — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: 8-bit serial-in shift register with parallel load, supporting left/right shift modes and serial data injection.
  3. Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
  4. Run Yosys in the same IDE for a generic netlist. Sky130 liberty mapping is a separate Pro library option.

RTL Studio is the Verilog simulator and IDE around this block: Slang lint, Verilator, VCD waveforms, and Yosys, in the browser. Simulation guide · Yosys guide.

Features

  • 8-bit Width: Processes 8-bit data words.
  • Parallel Load: Loads 8-bit data from data_in when en is low.
  • Serial Shift: Shifts data serially when en is high.
  • Bidirectional Shifting:

- Left Shift: Inserts serial_in at the Least Significant Bit (LSB). - Right Shift: Inserts serial_in at the Most Significant Bit (MSB).

  • Synchronous Reset: Resets the register to zero on the active-low rst_n signal.
  • Fully Verified: Comprehensive testbench coverage for all operational modes.

Architecture

The core logic is implemented within a single synchronous process triggered by the clock (clk) and reset (rst_n).

  • Reset: When rst_n is low, the internal register shift_reg is cleared to 8'b0.
  • Enable Logic:

- If en is low: The register loads the parallel input data_in. - If en is high: The register performs a shift operation based on the mode signal. - mode == 0 (Left Shift): shift_reg <= {shift_reg[6:0], serial_in} - mode == 1 (Right Shift): shift_reg <= {serial_in, shift_reg[7:1]}

### Block Diagram

Interface

SignalDirectionWidthDescription
clkInput1Clock signal
rst_nInput1Active-low synchronous reset
enInput1Enable: 0=Load, 1=Shift
modeInput1Direction: 0=Left, 1=Right
serial_inInput1Serial data input for shift operation
data_inInput8Parallel data input for load operation
data_outOutput8Current state of the shift register

Verification

The provided testbench (tb_rotate_left_right_arithmetic_mode_8bit_serial_in_arith.v) verifies the following scenarios:

Test CaseDescriptionExpected Result
TC1Parallel Load 0xAAdata_out == 0xAA
TC2Shift Left (0x01 -> 0x02 -> 0x04)Correct left shift
TC3Shift Right (0x80 -> 0x40 -> 0x20)Correct right shift
TC4Serial In Left (1) into 0x00data_out == 0x01
TC5Serial In Right (1) into 0x00data_out == 0x80
TC6Reset to 0x00data_out == 0x00

Run the simulation to view waveforms in sim/dump.vcd and verify the log output indicates PASS for all test cases.

More in Shift & Bit Manipulation

All Shift & Bit Manipulation blocks