Smaller
Compares two binary values and outputs a boolean result indicating whether the first input is smaller than (or optionally smaller-than-or-equal-to) the second input. Supports both signed and unsigned comparisons with optional output register.
Introduction
This block performs a less-than comparison between two input values. The comparison mode can be configured to check either strict inequality or include equality:
SMALLER mode: $$ \mathrm{OUT} = \begin{cases} 1 & \text{if } \mathrm{IN1} < \mathrm{IN2} \ 0 & \text{otherwise} \end{cases} $$
SMALLER EQUAL mode: $$ \mathrm{OUT} = \begin{cases} 1 & \text{if } \mathrm{IN1} \leq \mathrm{IN2} \ 0 & \text{otherwise} \end{cases} $$
Pin Description
Comparison result output.
- ‘1’ when IN1 < IN2 (SMALLER mode) or IN1 ≤ IN2 (SMALLER EQUAL mode)
- ‘0’ otherwise Width: 1 bit
Properties
Set the number of bits of the input
Number of bits for each input value. Range: 2-2048 bits. Both inputs must have the same width.Default: 16
Range: 2 – 2048
Select the sign/unsign of the input
Selects input interpretation: UNSIGNED (default, treats values as positive binary) or SIGNED (two’s complement, supports negative values).Default: UNSIGNED
Options: UNSIGNED SIGNED
Select between if consider true also in1 = in2
Comparison operation: SMALLER (strict <) or SMALLER EQUAL (≤ includes equality case).Default: SMALLER
Options: SMALLER SMALLER EQUAL
Enable one pipeline stage adding a register
Adds an output register stage. Disable (combinational, zero latency) or Enable (registered, 1 clock cycle latency).Default: Disable
Options: Disable Enable
Functional description
The Smaller comparator evaluates whether IN1 is less than IN2. The OP Mode property controls whether the comparison includes equality.
Comparison Modes
SMALLER (strict)
Returns ‘1’ only when IN1 is strictly less than IN2: $$ \mathrm{OUT} = (\mathrm{IN1} < \mathrm{IN2}) $$
SMALLER EQUAL
Returns ‘1’ when IN1 is less than OR equal to IN2: $$ \mathrm{OUT} = (\mathrm{IN1} \leq \mathrm{IN2}) $$
Signed vs. Unsigned
The Input sign property determines how values are interpreted:
- UNSIGNED: Standard binary comparison (0 to 2^N - 1)
- SIGNED: Two’s complement comparison (-2^(N-1) to 2^(N-1) - 1)
For signed numbers, the MSB is the sign bit, and the comparison accounts for negative values.
Example (8-bit)
UNSIGNED:
- IN1 = 0x01 (1) < IN2 = 0xFF (255) → OUT = 1
SIGNED:
- IN1 = 0xFF (-1) < IN2 = 0x01 (1) → OUT = 1
Latency and Timing
| RegisterOutput | Latency (clock cycles) |
|---|---|
| Disable | 0 |
| Enable | 1 |
Typical use cases
- Minimum value detection
- Lower bound checking
- Sorting and ordering operations
- Range validation
- Control flow decisions