RTL Studio Open IDE

Shift & Bit Manipulation

32-bit Synthesizable Barrel Shifter — L2 Upgrade

A 32-bit barrel shifter supporting logical, arithmetic, and serial shift operations with parallel load capability.

About this block

Simulate it in the Verilog IDE

Hardsystemverilogsimsyn

32-bit Synthesizable Barrel Shifter — L2 Upgrade is a SystemVerilog reference block in the Shift & Bit Manipulation catalog. Shifters, rotators, bit masks, and bitwise manipulation blocks. Marked Hard: a larger reference. Simulate the packaged testbench before you change the RTL.

A fully synthesizable 32-bit barrel shifter IP core supporting logical, arithmetic, and serial shift operations. Designed for high-performance data path applications with Verilator verification.

This IP provides a robust 32-bit barrel shifter capable of parallel loading and seven distinct shift modes.

It is fully synthesizable, verified with Verilator, and includes a comprehensive testbench.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for 32-bit Synthesizable Barrel Shifter — L2 Upgrade.
  2. Read the SystemVerilog module in the editor. The catalog line for this block: A 32-bit barrel shifter supporting logical, arithmetic, and serial shift operations with parallel load capability.
  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

  • 32-bit Data Path: Handles 32-bit wide data words.
  • Parallel Load: Supports direct loading of data via load_en.
  • Seven Shift Modes:

- Logical Shift Left (LSL) - Logical Shift Right (LSR) - Arithmetic Shift Left (ASL) - Arithmetic Shift Right (ASR) - Preserves sign bit - Serial Shift Left (SSL) - Serial Shift Right (SSR) - Parallel Load Mode

  • Synthesizable: Verified for synthesis with standard EDA tools.
  • Verified: All modes tested with Verilator.

Ports

Port NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low reset
data_inInput32Data input for parallel load
shift_amountInput5Shift amount (0-31)
serial_inInput1Serial input bit
modeInput3Operation mode selector
load_enInput1Parallel load enable
data_outOutput32Shifted data output

Verification

The testbench (tb/tb_barrel_shifter_32bit_synthesizable_serial_in_arith.sv) verifies all seven operational modes using Verilator.

Test CaseModeInputExpected OutputResult
TC1Parallel Load0xDEADBEEF0xDEADBEEFPASS
TC2Logical Shift Left0x00000001 (<<4)0x00000010PASS
TC3Logical Shift Right0x80000000 (>>4)0x08000000PASS
TC4Arithmetic Shift Right0x80000000 (>>>4)0xF8000000PASS
TC5Serial Shift Left0x00000000 (in=1)0x00000001PASS
TC6Serial Shift Right0x00000000 (in=1)0x80000000PASS

More in Shift & Bit Manipulation

All Shift & Bit Manipulation blocks