Equal
Compares two binary values and outputs a boolean result (1-bit) indicating whether they are equal. Supports both signed and unsigned comparisons with configurable word sizes and optional output register for timing closure.
Introduction
This block performs an equality comparison between two input values. The output is a single bit that indicates whether the inputs are identical:
$$ \mathrm{OUT} = \begin{cases} 1 & \text{if } \mathrm{IN1} = \mathrm{IN2} \ 0 & \text{otherwise} \end{cases} $$
The component supports both signed and unsigned data types and offers an optional output register for improved timing performance.
Pin Description
Comparison result output.
- ‘1’ when IN1 equals IN2
- ‘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 the interpretation of input values: UNSIGNED (default) or SIGNED (two’s complement). For equality comparison, this does not affect the result.Default: UNSIGNED
Options: UNSIGNED SIGNED
Enable one pipeline stage adding a register
Adds an output register stage. Disable (combinational, zero latency) or Enable (registered, 1 clock cycle latency) for timing closure.Default: Disable
Options: Disable Enable
Functional description
The Equal comparator checks whether two input values are identical. The comparison is performed on the full bit-width of the inputs, and the result is a single boolean bit.
Comparison Operation
For unsigned numbers: $$ \mathrm{OUT} = (\mathrm{IN1} == \mathrm{IN2}) $$
For signed numbers (two’s complement): $$ \mathrm{OUT} = (\mathrm{IN1} == \mathrm{IN2}) $$
Note: For equality comparison, signed and unsigned interpretations produce the same result since we’re comparing bit patterns exactly.
Truth Table
| IN1 | IN2 | OUT |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Latency and Timing
The component offers two latency modes:
| RegisterOutput | Latency (clock cycles) |
|---|---|
| Disable | 0 |
| Enable | 1 |
- Disable: Purely combinational logic, zero latency.
- Enable: One register stage added for timing closure in high-speed designs.
Typical use cases
- Decision logic and conditional branching
- Pattern matching and detection
- State machine comparisons
- Data validation and error checking
- Equality checks in control paths