Common Cells Repository

July 3, 2026 ยท View on GitHub

Build Status GitHub tag (latest SemVer) SHL-0.51 license

Common Cells Repository

Maintainer: Philippe Sauter phsauter@iis.ee.ethz.ch

This repository contains commonly used cells and headers for use in various projects.

Cell Contents

This repository currently contains the following cells, ordered by categories. Please note that cells with status deprecated are not to be used for new designs and only serve to provide compatibility with old code.

Clocks and Resets

NameDescriptionStatusSuperseded By
cc_clk_int_divArbitrary integer clock divider with config interface and 50% output clock duty cycleactive
cc_clk_int_div_staticA convenience wrapper around cc_clk_int_div with static division factor.active
cc_rstgenReset synchronizeractive
cc_rstgen_bypassReset synchronizer with dedicated test reset bypassactive

Clock Domains and Asynchronous Crossings

NameDescriptionStatusSuperseded By
cc_cdc_4phaseClock domain crossing using 4-phase handshake, with ready/valid interfaceactive
cc_cdc_2phaseClock domain crossing using two-phase handshake, with ready/valid interfaceactive
cc_cdc_2phase_clearableIdentical to cc_cdc_2phase but supports one-sided async/sync resetting of either src or dstactive
cc_cdc_fifo_2phaseClock domain crossing FIFO using two-phase handshake, with ready/valid interfaceactive
cc_cdc_fifo_grayClock domain crossing FIFO using a gray-counter, with ready/valid interfaceactive
cc_cdc_fifo_gray_clearableIdentical to cc_cdc_fifo_gray but supports one-sided async/sync resetting of either src or dstactive
cc_cdc_reset_ctrlrLock-step reset sequencer across clock domains, internally used by clearable CDCsactive
cc_clk_mux_glitch_freeA glitch-free clock multiplexer with parameterizable number of inputs.active
cc_edge_detectRising/falling edge detectoractive
cc_edge_propagatorPropagates a single-cycle pulse across an asynchronous clock domain crossingactive
cc_edge_propagator_ackcc_edge_propagator with sender-synchronous acknowledge pin, flags received pulseactive
cc_edge_propagator_rxReceive slice of cc_edge_propagator, requires only the receiver clockactive
cc_edge_propagator_txTransmit slice of cc_edge_propagator, requires only the sender clockactive
cc_isochronous_spill_registerIsochronous clock domain crossing and full handshake, like cc_spill_registeractive
cc_isochronous_4phase_handshakeIsochronous four-phase handshake.active
cc_serial_deglitchUpdate output only after input has remained stable for a number of cyclesactive
cc_majority_vote_filterSmooth noisy data using a moving window threshold voteactive
cc_sync_wedgeSerial line synchronizer with edge detectoractive

The generic synchronizer is provided by the tech_cells_generic dependency as tc_sync.

Counters and Shift Registers

NameDescriptionStatusSuperseded By
cc_counterGeneric up/down counter with overflow detectionactive
cc_credit_counterUp/down counter for creditactive
cc_delta_counterUp/down counter with variable delta and overflow detectionactive
cc_exp_backoffExponential backoff counter with randomizationactive
cc_lfsr_8bit8-bit linear feedback shift register (LFSR)active
cc_lfsr_16bit16-bit linear feedback shift register (LFSR)active
cc_lfsr4...64-bit parametric Galois LFSR with optional whitening featureactive
cc_max_counterUp/down counter with variable delta that tracks its maximum valueactive
cc_trip_counterCounter that resets automatically when it reaches a specified boundactive

Data Path Elements

NameDescriptionStatusSuperseded By
cc_addr_decodeAddress map decoderactive
cc_addr_decode_dyncAddress map decoder extended to support dynamic online configurationactive
cc_addr_decode_napotAddress map decoder using naturally-aligned power of two (NAPOT) regionsactive
cc_multiaddr_decodeAddress map decoder using NAPOT regions and allowing for multiple address inputsactive
cc_ecc_decodeSECDED Decoder (Single Error Correction, Double Error Detection)active
cc_ecc_encodeSECDED Encoder (Single Error Correction, Double Error Detection)active
cc_binary_to_grayBinary to gray code converteractive
cc_gray_to_binaryGray code to binary converteractive
cc_lzcLeading/trailing-zero counteractive
cc_onehotHardware implementation of SystemVerilog's $onehot() functionactive
cc_onehot_to_binOne-hot to binary converteractive
cc_shift_registerShift register for arbitrary typesactive
cc_shift_register_gatedShift register with ICG for arbitrary typesactive
cc_rr_arb_treeRound-robin arbiter for req/gnt and vld/rdy interfaces with optional priorityactive
cc_fall_through_registerFall-through register with ready/valid interfaceactive
cc_spill_register_flushableRegister with ready/valid interface to cut all combinational interface paths and additional flush signal.active
cc_spill_registerRegister with ready/valid interface to cut all combinational interface pathsactive
cc_stream_arbiterRound-robin arbiter for ready/valid stream interfaceactive
cc_stream_demuxReady/valid interface demultiplexeractive
cc_lossy_valid_to_streamConvert Valid-only to ready/valid by updating in-flight transactionactive
cc_stream_joinReady/valid handshake join multiple to one commonactive
cc_stream_join_dynamicReady/valid handshake join multiple to one common, dynamically configurable subset selectionactive
cc_stream_muxReady/valid interface multiplexeractive
cc_stream_registerRegister with ready/valid interfaceactive
cc_stream_forkReady/valid forkactive
cc_stream_fork_dynamicReady/valid fork, with selection mask for partial forkingactive
cc_stream_filterReady/valid filteractive
cc_stream_delayRandomize or delay ready/valid interfaceactive
cc_stream_to_memUse memories without flow control for output data in streams.active
cc_stream_xbarFully connected crossbar with ready/valid interface.active
cc_stream_omega_netOne-way stream omega-net with ready/valid interface. Isomorphic to a butterfly.active
cc_stream_throttleRestrict the number of outstanding transfers in a stream.active
cc_sub_per_hashSubstitution-permutation hash functionactive
cc_popcountCombinatorial popcount (hamming weight)active
cc_mem_to_banks_detailedSplit memory access over multiple parallel banks with detailed response signalsactive
cc_mem_to_banksSplit memory access over multiple parallel banksactive
cc_heavisideGenerates a mask obtained by applying the Heaviside step functionactive
cc_boxcarGenerates a mask obtained by applying a boxcar functionactive

Data Structures

NameDescriptionStatusSuperseded By
cc_cb_filterCounting-Bloom-Filter with combinational lookupactive
cc_fifoFIFO register with generic fill countsactive
cc_id_queueQueue that preserves FIFO order for entries with the same IDactive
cc_passthrough_stream_fifoFIFO register with ready/valid interface and same-cycle push/pop when fullactive
cc_ring_bufferRing buffer with sequential write and random-access read interfacesactive
cc_stream_fifoFIFO register with ready/valid interfaceactive
cc_stream_fifo_optimal_wrapWrapper that optimally selects either a spill register or a FIFOactive
cc_plru_treePseudo least recently used treeactive
cc_unreadEmpty module to sink unconnected outputs intoactive
cc_readDummy module that prevents a signal from being removed during synthesisactive

Packages and Interfaces

NameDescriptionStatusSuperseded By
cc_pkgShared package for common functions, types, and encodingsactive
cc_stream_dvReady/valid stream interface with a custom payload typeactive

Ports

Generally, modules with sequential logic receive at least the following inputs. Intentional exceptions are clock, reset, cdc cells, and any cells that receive multiple clock inputs.

NameDescription
clk_iClock driving sequential logic.
rst_niAsynchronous reset, active-low. Brings the module to its reset state.
clr_iSynchronous clear, active-high. Brings the module to its reset state in the next clock cycle. Can be driven by synchronous logic or tied to 1'b0 if unused.

Use of Macros

Internally, the cells use macros to implement sequential logic (flip-flops) and assertions. These macros are defined in this repo; see RTL Register Macros and SVA Macros below for more details.

Header Contents

This repository currently contains the following header files.

RTL Register Macros

The header file registers.svh contains macros that expand to descriptions of registers. To avoid misuse of always_ff blocks, only the following macros shall be used to describe sequential behavior. The use of linter rules that flag explicit uses of always_ff in source code is encouraged.

MacroArgumentsDescription
`FFq_sig, d_sig, rst_val, (clk_sig, arstn_sig)Flip-flop with asynchronous active-low reset
`FFARq_sig, d_sig, rst_val, (clk_sig, arst_sig)Flip-flop with asynchronous active-high reset
`FFARNCq_sig, d_sig, clr_sig, rst_val, (clk_sig, arstn_sig)Flip-flop with asynchronous active-low reset and synchronous active-high clear
`FFSRq_sig, d_sig, rst_val, clk_sig, rst_sigFlip-flop with synchronous active-high reset
`FFSRNq_sig, d_sig, rst_val, clk_sig, rstn_sigFlip-flop with synchronous active-low reset
`FFNRq_sig, d_sig, (clk_sig)Flip-flop without reset
`FFLq_sig, d_sig, load_ena, rst_val, (clk_sig, arstn_sig)Flip-flop with load-enable and asynchronous active-low reset
`FFLARq_sig, d_sig, load_ena, rst_val, (clk_sig, arst_sig)Flip-flop with load-enable and asynchronous active-high reset
`FFLARNCq_sig, d_sig, load_ena, clr_sig, rst_val, (clk_sig, arstn_sig)Flip-flop with load-enable, asynchronous active-low reset and synchronous active-high clear
`FFLSRq_sig, d_sig, load_ena, rst_val, clk_sig, rst_sigFlip-flop with load-enable and synchronous active-high reset
`FFLSRNq_sig, d_sig, load_ena, rst_val, clk_sig, rstn_sigFlip-flop with load-enable and synchronous active-low reset
`FFLNRq_sig, d_sig, load_ena, (clk_sig)Flip-flop with load-enable without reset
  • The name of the clock signal for implicit variants is clk_i.
  • The name of the reset signal for implicit variants is rst_i or rst_ni, respectively for active-high and active-low variants.
  • Argument suffix _sig indicates signal names for present and next state as well as clocks, resets and synchronous clear signals.
  • Argument rst_val specifies the value literal to be assigned upon reset.
  • Argument load_ena specifies the boolean expression that forms the load enable of the register.
  • Arguments clr_sig, rst_sig and rstn_sig must be plain signal names, not expressions.

SystemVerilog Assertion Macros

The header file assertions.svh contains macros that expand to assertion blocks. These macros should reduce the effort in writing many assertions and make it easier to use them. They are similar to but incompatible with the macros used by lowrisc.

Simple Assertion and Cover Macros

MacroArgumentsDescription
`ASSERT_I__name, __prop, (__desc)Immediate assertion
`ASSERT_INIT__name, __prop, (__desc)Assertion in initial block. Can be used for things like parameter checking
`ASSERT_FINAL__name, __prop, (__desc)Assertion in final block
`ASSERT__name, __prop, (__clk, __rst, __desc)Assert a concurrent property directly
`ASSERT_NEVER__name, __prop, (__clk, __rst, __desc)Assert a concurrent property NEVER happens
`ASSERT_KNOWN__name, __sig, (__clk, __rst, __desc)Concurrent clocked assertion with custom error message
`COVER__name, __prop, (__clk, __rst)Cover a concurrent property
  • The name of the clock and reset signals for implicit variants is clk_i and rst_ni, respectively.
  • __desc is an optional string argument describing the failure causing the assertion to be violated that is embedded into the error report and defaults to "".

Complex Assertion Macros

MacroArgumentsDescription
`ASSERT_PULSE__name, __sig, (__clk, __rst, __desc)Assert that signal is an active-high pulse with pulse length of 1 clock cycle
`ASSERT_IF__name, __prop, __enable, (__clk, __rst, __desc)Assert that a property is true only when an enable signal is set
`ASSERT_KNOWN_IF__name, __sig, __enable, (__clk, __rst, __desc)Assert that signal has a known value (each bit is either '0' or '1') after reset if enable is set
`ASSERT_STABLE__name, __valid, __ready, __data, (__mask, __clk, __rst, __desc)Assert that the unmasked data on a ready-valid interface is kept stable after valid is asserted, until ready is asserted
  • The name of the clock and reset signals for implicit variants is clk_i and rst_ni, respectively.
  • __desc is an optional string argument describing the failure causing the assertion to be violated that is embedded into the error report and defaults to "".

Assumption Macros

MacroArgumentsDescription
`ASSUME__name, __prop, (__clk, __rst, __desc)Assume a concurrent property
`ASSUME_I__name, __prop, (__desc)Assume an immediate property
  • The name of the clock and reset signals for implicit variants is clk_i and rst_ni, respectively.
  • __desc is an optional string argument describing the failure causing the assertion to be violated that is embedded into the error report and defaults to "".

Formal Verification Macros

MacroArgumentsDescription
`ASSUME_FPV__name, __prop, (__clk, __rst, __desc)Assume a concurrent property during formal verification only
`ASSUME_I_FPV__name, __prop, (__desc)Assume an immediate property during formal verification only
`COVER_FPV__name, __prop, (__clk, __rst)Cover a concurrent property during formal verification
  • The name of the clock and reset signals for implicit variants is clk_i and rst_ni, respectively.
  • __desc is an optional string argument describing the failure causing the assertion to be violated that is embedded into the error report and defaults to "".