RTL Studio Open IDE

Shift & Bit Manipulation

Circular Shift Param 8-bit

Combinational module performing circular left shift on 8-bit data with variable shift amount.

About this block

Simulate it in the Verilog IDE

Easyverilogsimsyn

Circular Shift Param 8-bit 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 implements a parameterized circular left shift operation on an 8-bit data bus. It uses a case-based conditional assignment to handle shift amounts from 0 to 7. The design avoids variable part-select indexing errors by explicitly defining each shift case.

This IP provides a robust and verified circular shift function for 8-bit data. It is suitable for applications requiring bit manipulation without clock synchronization.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Circular Shift Param 8-bit.
  2. Read the Verilog module in the editor. The catalog line for this block: Combinational module performing circular left shift on 8-bit data with variable shift amount.
  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

  • Performs circular left shifts on 8-bit input data.
  • Supports shift amounts from 0 to 7 via a 3-bit control signal.
  • Combinational logic implementation with no clock dependency.
  • Fully verified with 10 test cases covering all shift amounts and edge cases.

Interface

SignalDirectionWidthDescription
data_inInput[7:0]Input data bus
shamtInput[2:0]Shift amount (0-7)
data_outOutput[7:0]Output data after circular shift

Architecture

The module uses a continuous assignment with a ternary operator chain to map each shift amount to its corresponding bit concatenation. This approach ensures deterministic timing and avoids synthesis issues related to variable indexing.

Verification

The testbench applies all possible shift amounts (0-7) to two distinct data patterns (0xAA and 0x00/0xFF). It also verifies edge cases such as zero shift and full rotation.

Test CaseInput DataShift AmountExpected OutputStatus
TC18'hAA08'hAAPASS
TC28'hAA18'h55PASS
TC38'hAA28'hAAPASS
TC48'hAA38'h55PASS
TC58'hAA48'hAAPASS
TC68'hAA58'h55PASS
TC78'hAA68'hAAPASS
TC88'hAA78'h55PASS
TC98'h0048'h00PASS
TC108'hFF38'hFFPASS

More in Shift & Bit Manipulation

All Shift & Bit Manipulation blocks