Block Preview

Introduction

This block performs a range check to determine if an input value lies between two boundary values. Two comparison modes are available:

BETWEEN mode (exclusive boundaries): $$ \mathrm{OUT} = \begin{cases} 1 & \text{if } \mathrm{IN_MIN} < \mathrm{IN} < \mathrm{IN_MAX} \ 0 & \text{otherwise} \end{cases} $$

BETWEEN EQUAL mode (inclusive boundaries): $$ \mathrm{OUT} = \begin{cases} 1 & \text{if } \mathrm{IN_MIN} \leq \mathrm{IN} \leq \mathrm{IN_MAX} \ 0 & \text{otherwise} \end{cases} $$

Pin Description

IN Input Variable bit BIT VECTOR
Input value to check against the range. Width: Input bits (2 to 2048 bits) Interpretation depends on Input sign property.
Default: Must be connected
IN_MIN Input Variable bit BIT VECTOR
Lower boundary of the valid range. Width: Input bits (same as IN) Interpretation depends on Input sign property.
Default: Must be connected
IN_MAX Input Variable bit BIT VECTOR
Upper boundary of the valid range. Width: Input bits (same as IN) Interpretation depends on Input sign property.
Default: Must be connected
OUT Output 1 bit BIT

Range check result output.

  • ‘1’ when IN is within the range [IN_MIN, IN_MAX]
  • ‘0’ otherwise Width: 1 bit
CLK 1 bit
Clock input (only present when RegisterOutput = Enable). Used to register the comparison result.

Properties

Property window

Input bits InputSize

Set the number of bits of the input

Number of bits for all input values (IN, IN_MIN, IN_MAX). Range: 2-2048 bits. All three inputs must have the same width.

Default: 16

Range: 2 – 2048

Input sign InputSign

Select the sign/unsign of the input

Selects input interpretation: UNSIGNED (default) or SIGNED (two’s complement) for all inputs.

Default: UNSIGNED

Options: UNSIGNED SIGNED

OP Mode Mode

Select between if consider true also in1 = in2

Boundary inclusion: BETWEEN (exclusive, strict inequalities) or BETWEEN EQUAL (inclusive, allows values at boundaries).

Default: BETWEEN

Options: BETWEEN BETWEEN EQUAL

RegisterOutput EnableRegister

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 Between comparator performs a dual comparison to check if the input value is within the range defined by IN_MIN and IN_MAX.

Comparison Modes

BETWEEN (exclusive)

Returns ‘1’ only when IN is strictly between the boundaries: $$ \mathrm{OUT} = (\mathrm{IN_MIN} < \mathrm{IN}) \land (\mathrm{IN} < \mathrm{IN_MAX}) $$

BETWEEN EQUAL (inclusive)

Returns ‘1’ when IN is within or at the boundaries: $$ \mathrm{OUT} = (\mathrm{IN_MIN} \leq \mathrm{IN}) \land (\mathrm{IN} \leq \mathrm{IN_MAX}) $$

Implementation

The component implements two comparisons and combines them with an AND operation:

  • First: IN > IN_MIN (or IN ≥ IN_MIN for BETWEEN EQUAL)
  • Second: IN < IN_MAX (or IN ≤ IN_MAX for BETWEEN EQUAL)
  • Result: Both conditions must be true

Example (8-bit unsigned, BETWEEN EQUAL mode)

  • IN_MIN = 10, IN_MAX = 20
  • IN = 5 → OUT = 0 (below range)
  • IN = 10 → OUT = 1 (at lower boundary)
  • IN = 15 → OUT = 1 (within range)
  • IN = 20 → OUT = 1 (at upper boundary)
  • IN = 25 → OUT = 0 (above range)

Latency and Timing

RegisterOutput Latency (clock cycles)
Disable 0
Enable 1

Typical use cases

  • Range validation for input data
  • Threshold detection with upper and lower bounds
  • Window comparators for signal processing
  • Valid data range checking
  • Alarm and limit detection systems