RTL Studio Open IDE

Arithmetic & Math

Signed 3-Way Compare 8-bit — L1 Upgrade

Registered 3-way signed comparator for 8-bit operands with enable and reset.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

Signed 3-Way Compare 8-bit — L1 Upgrade is a Verilog reference block in the Arithmetic & Math catalog. Adders, multipliers, dividers, ALUs, and arithmetic datapaths. Marked Medium: more state or a wider datapath, still one workspace in the IDE.

This IP implements a registered 3-way signed comparator for 8-bit operands.

It asserts exactly one of three outputs indicating greater-than, equal, or less-than relationships.

The design includes an active-high enable signal to hold previous results when disabled and an asynchronous active-low reset for immediate initialization.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Signed 3-Way Compare 8-bit — L1 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: Registered 3-way signed comparator for 8-bit operands with enable and reset.
  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

  • Signed Range: Supports full signed range from -128 to +127 for 8-bit inputs.
  • Mutually Exclusive Outputs: Provides distinct outputs for GT, EQ, and LT conditions.
  • Registered Outputs: Ensures clean timing and glitch-free results.
  • Enable Control: Allows data holding without clock gating.
  • Asynchronous Reset: Provides immediate initialization.

Ports

Port NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Asynchronous active-low reset
enInput1Active-high enable
aInput[7:0]First signed operand
bInput[7:0]Second signed operand
a_gt_bOutput1High if a > b
a_eq_bOutput1High if a == b
a_lt_bOutput1High if a < b

Verification

The testbench covers ten specific scenarios to validate functionality:

  1. TC1: Verifies positive comparison where a is greater than b.
  2. TC2: Verifies equal comparison where a equals b.
  3. TC3: Verifies negative comparison where a is less than b.
  4. TC4: Verifies that outputs hold their value when enable is low.
  5. TC5: Verifies signed comparison with the minimum negative number.
  6. TC6: Verifies signed comparison with maximum positive versus minimum negative.
  7. TC7: Verifies asynchronous reset behavior.
  8. TC8: Verifies edge case of max positive versus min negative after reset.

All ten tests passed successfully in the simulation log.

More in Arithmetic & Math

All Arithmetic & Math blocks