RTL Studio Open IDE

Shift & Bit Manipulation

Nibble Rotate 16-Bit — L1 Upgrade

16-bit shift/rotate module supporting LSR, LSL, Nibble Rotate Right, and Arithmetic Shift Right with registered output.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

Nibble Rotate 16-Bit — L1 Upgrade is a Verilog reference block in the Shift & Bit Manipulation catalog. Shifters, rotators, bit masks, and bitwise manipulation blocks. Marked Medium: more state or a wider datapath, still one workspace in the IDE.

This Intellectual Property (IP) implements a 16-bit data path capable of four distinct shift and rotate operations: Logical Shift Right (LSR), Logical Shift Left (LSL), Nibble Rotate Right (NRR), and Arithmetic Shift Right (ASR). The design features a registered output to ensure stable timing and latch-free behavior, making it suitable for high-frequency L1 cache upgrades or similar low-latency data path requirements.

### Key Features

  • 16-bit Data Width: Processes 16-bit data words.
  • Four Operation Modes: Configurable via a 2-bit mode input.

- 2'b00: Logical Shift Right (LSR) - Inserts 0 at MSB. - 2'b01: Logical Shift Left (LSL) - Inserts 0 at LSB. - 2'b10: Nibble Rotate Right (NRR) - Rotates 4-bit nibbles. - 2'b11: Arithmetic Shift Right (ASR) - Replicates MSB (sign bit).

  • Registered Output: data_out is registered to provide stable timing.
  • Handshake Interface: Uses valid to trigger operations and ready to indicate availability.
  • Synchronous Load: load signal allows direct loading of data_in into the internal register.
  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Nibble Rotate 16-Bit — L1 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: 16-bit shift/rotate module supporting LSR, LSL, Nibble Rotate Right, and Arithmetic Shift Right with registered output.
  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.

Ports

PortDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low reset
loadInput1Load data_in into register
validInput1Trigger shift/rotate operation
modeInput2Operation mode selector
data_inInput16Input data word
data_outOutput16Output data word
readyOutput1Handshake ready signal (asserts high when valid is high)

Architecture

The design consists of a single synchronous process that updates internal state on the positive edge of the clock.

  1. Registers: Two 16-bit registers are used:

- data_reg: Holds the current value being shifted/rotated. - data_out_reg: Holds the registered output value.

  1. Priority: The load signal takes priority over valid for data entry.
  2. Operation: When valid is high (and load is low), the mode signal determines the transformation applied to data_reg.
  3. Output: The external data_out is driven by data_out_reg. Note that data_out reflects the result of the previous cycle's operation due to the registered output stage.

Verification

The included testbench verifies all functional modes, including reset and load functionality.

### Test Cases

Test CaseDescriptionResult
TC1Load and ReadbackPASS
TC2Logical Shift Right (LSR)PASS
TC3Logical Shift Left (LSL)PASS
TC4Nibble Rotate Right (NRR)PASS
TC5Arithmetic Shift Right (ASR)PASS
TC6Ready Signal CheckPASS

### Simulation Log

Upon running the simulation, the following output indicates success:

More in Shift & Bit Manipulation

All Shift & Bit Manipulation blocks