Code Conversion
Thermometer Select 8-Bit — L1 Upgrade
Registered pipelined thermometer-to-binary encoder for 8-bit inputs with valid flag synchronization.
About this block
Simulate it in the Verilog IDE
Thermometer Select 8-Bit — L1 Upgrade is a Verilog reference block in the Code Conversion catalog. Encoders, decoders, priority encoders, and binary/gray converters. Marked Hard: a larger reference. Simulate the packaged testbench before you change the RTL.
This IP core implements a registered, pipelined priority encoder that converts an 8-bit thermometer code into a 3-bit binary index.
Designed for low-latency applications, it provides a single-cycle latency with registered outputs to ensure timing closure in synchronous designs.
The core includes a valid flag to synchronize data availability and handles invalid thermometer codes by defaulting to index 0.
- Choose Open in IDE. RTL Studio loads the packaged workspace for Thermometer Select 8-Bit — L1 Upgrade.
- Read the Verilog module in the editor. The catalog line for this block: Registered pipelined thermometer-to-binary encoder for 8-bit inputs with valid flag synchronization.
- Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
- 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
- Conversion: 8-bit thermometer input to 3-bit binary index.
- Latency: 1 clock cycle (registered output).
- Synchronization:
valid_in/valid_outhandshake for data synchronization. - Error Handling: Invalid non-single-bit codes default to index 0.
- Reset: Active-low asynchronous reset.
- Verification: Fully verified with 6 test cases covering reset, valid codes, invalid codes, and valid flag transitions.
Ports
| Port Name | Direction | Width | Description |
|---|---|---|---|
clk | Input | 1 | Clock input |
rst_n | Input | 1 | Active-low reset |
thermometer_in | Input | 8 | Thermometer code input |
valid_in | Input | 1 | Valid input flag |
index_out | Output | 3 | Binary index output |
valid_out | Output | 1 | Valid output flag |
Integration
### Files
rtl/thermometer_select_registered_pipelined_8bit.v: Main RTL source.tb/tb_thermometer_select_registered_pipelined_8bit.v: Testbench for verification.
### Usage
- Include
rtl/thermometer_select_registered_pipelined_8bit.vin your project. - Instantiate the module with your clock and reset signals.
- Drive
thermometer_inwith a valid thermometer code (single bit set) or handle invalid codes as per the spec. - Assert
valid_into enable data processing.
### Example Instantiation
Limitations
- Input Format: Assumes thermometer coding (single bit set). Non-thermometer inputs are not guaranteed to produce correct binary indices (defaults to 0).
- Latency: Fixed at 1 cycle. Not suitable for ultra-low latency requirements where combinational logic is preferred.
More in Code Conversion
- 16-Bit Priority Encoder — L1 Upgrade — L2 Upgrade
- 4-Bit BCD to Binary Converter — L2 Upgrade
- 4-Bit Binary to BCD Converter (Shift-and-Add-3)
- 4-Bit Thermometer to Binary Encoder
- 8-Bit One-Hot Encoder
- 8-Bit Priority Decoder (One-Hot to Binary) — L1 Upgrade — L2 Upgrade
- 8-Bit Thermometer to Binary Encoder
- 8-Bit to 16-Bit Sign Extender
- 8-to-16 Zero Extension — L1 Upgrade
- Binary to Excess-3 4-bit — L1 Upgrade — L2 Upgrade
- Binary→Thermometer Compare-Gen (8→9)
- Binary→Thermometer LUT (4→15, Case) — L1 Upgrade — L2 Upgrade
- Gray-Code Incrementer 8-Bit
- N-Bit Gray to Binary Decoder
- N-bit Priority Encoder — L1 Upgrade — L2 Upgrade
- One-Hot→Binary Case Decode (4→2) — L1 Upgrade — L2 Upgrade