Home

Awesome

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

Common Cells Repository

Maintainer: Nils Wistoff nwistoff@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
clk_int_divArbitrary integer clock divider with config interface and 50% output clock duty cycleactive
clk_int_div_staticA convenience wrapper around clk_int_div with static division factor.active
clk_divClock divider with integer divisordeprecatedclk_int_div
clock_dividerClock divider with configuration registersdeprecatedclk_int_div
clock_divider_counterClock divider using a counterdeprecatedclk_int_div
rstgenReset synchronizeractive
rstgen_bypassReset synchronizer with dedicated test reset bypassactive

Clock Domains and Asynchronous Crossings

NameDescriptionStatusSuperseded By
cdc_4phaseClock domain crossing using 4-phase handshake, with ready/valid interfaceactive
cdc_2phaseClock domain crossing using two-phase handshake, with ready/valid interfaceactive
cdc_2phase_clearableIdentical to cdc_2phase but supports one-sided async/sync resetting of either src or dstactive
cdc_fifo_2phaseClock domain crossing FIFO using two-phase handshake, with ready/valid interfaceactive
cdc_fifo_grayClock domain crossing FIFO using a gray-counter, with ready/valid interfaceactive
cdc_fifo_gray_clearableIdentical to cdc_fifo_gray but supports one-sided async/sync resetting of either src or dstactive
cdc_reset_ctrlrLock-step reset sequencer accross clock domains (internally used by clearable CDCs)active
clk_mux_glitch_freeA glitch-free clock multiplexer with parametrizeable number of inputs.active
edge_detectRising/falling edge detectoractive
edge_propagatorPropagates a single-cycle pulse across an asynchronous clock domain crossingactive
edge_propagator_ackedge_propagator with sender-synchronous acknowledge pin (flags received pulse)active
edge_propagator_rxReceive slice of edge_propagator, requires only the receiver clockactive
edge_propagator_txTransmit slice of edge_propagator, requires only the sender clockactive
isochronous_spill_registerIsochronous clock domain crossing and full handshake (like spill_register)active
isochronous_4phase_handshakeIsochronous four-phase handshake.active
pulp_syncSerial line synchronizerdeprecatedsync
pulp_sync_wedgeSerial line synchronizer with edge detectordeprecatedsync_wedge
serial_deglitchSerial line deglitcheractive
syncSerial line synchronizeractive
sync_wedgeSerial line synchronizer with edge detectoractive

Counters and Shift Registers

NameDescriptionStatusSuperseded By
counterGeneric up/down counter with overflow detectionactive
credit_counterUp/down counter for creditactive
delta_counterUp/down counter with variable delta and overflow detectionactive
generic_LFSR_8bit8-bit linear feedback shift register (LFSR)deprecatedlfsr_8bit
lfsr_8bit8-bit linear feedback shift register (LFSR)active
lfsr_16bit16-bit linear feedback shift register (LFSR)active
lfsr4...64-bit parametric Galois LFSR with optional whitening featureactive
max_counterUp/down counter with variable delta that tracks its maximum valueactive
mv_filterZARUBAF ADD DESCRIPTIONactive

Data Path Elements

NameDescriptionStatusSuperseded By
addr_decodeAddress map decoderactive
addr_decode_dyncAddress map decoder extended to support dynamic online configurationactive
addr_decode_napotAddress map decoder using naturally-aligned power of two (NAPOT) regionsactive
multiaddr_decodeAddress map decoder using NAPOT regions and allowing for multiple address inputsactive
ecc_decodeSECDED Decoder (Single Error Correction, Double Error Detection)active
ecc_encodeSECDED Encoder (Single Error Correction, Double Error Detection)active
binary_to_grayBinary to gray code converteractive
find_first_oneLeading-one finder / leading-zero counterdeprecatedlzc
gray_to_binaryGray code to binary converteractive
lzcLeading/trailing-zero counteractive
onehot_to_binOne-hot to binary converteractive
shift_regShift register for arbitrary typesactive
shift_reg_gatedShift register with ICG for arbitrary typesactive
rr_arb_treeRound-robin arbiter for req/gnt and vld/rdy interfaces with optional priorityactive
rrarbiterRound-robin arbiter for req/ack interface with look-aheaddeprecatedrr_arb_tree
prioarbiterPriority arbiter arbiter for req/ack interface with look-aheaddeprecatedrr_arb_tree
fall_through_registerFall-through register with ready/valid interfaceactive
spill_register_flushableRegister with ready/valid interface to cut all combinational interface paths and additional flush signal.active
spill_registerRegister with ready/valid interface to cut all combinational interface pathsactive
stream_arbiterRound-robin arbiter for ready/valid stream interfaceactive
stream_arbiter_flushableRound-robin arbiter for ready/valid stream interface and flush functionalityactive
stream_demuxReady/valid interface demultiplexeractive
lossy_valid_to_streamConvert Valid-only to ready/valid by updating in-flight transactionactive
stream_joinReady/valid handshake join multiple to one commonactive
stream_join_dynamicReady/valid handshake join multiple to one common, dynamically configurable subset selectionactive
stream_muxReady/valid interface multiplexeractive
stream_registerRegister with ready/valid interfaceactive
stream_forkReady/valid forkactive
stream_fork_dynamicReady/valid fork, with selection mask for partial forkingactive
stream_filterReady/valid filteractive
stream_delayRandomize or delay ready/valid interfaceactive
stream_to_memUse memories without flow control for output data in streams.active
stream_xbarFully connected crossbar with ready/valid interface.active
stream_omega_netOne-way stream omega-net with ready/valid interface. Isomorphic to a butterfly.active
stream_throttleRestrict the number of outstanding transfers in a stream.active
sub_per_hashSubstitution-permutation hash functionactive
popcountCombinatorial popcount (hamming weight)active
mem_to_banks_detailedSplit memory access over multiple parallel banks with detailed response signalsactive
mem_to_banksSplit memory access over multiple parallel banksactive

Data Structures

NameDescriptionStatusSuperseded By
cb_filterCounting-Bloom-Filter with combinational lookupactive
fifoFIFO register with upper thresholddeprecatedfifo_v3
fifo_v2FIFO register with upper and lower thresholddeprecatedfifo_v3
fifo_v3FIFO register with generic fill countsactive
passthrough_stream_fifoFIFO register with ready/valid interface and same-cycle push/pop when fullactive
stream_fifoFIFO register with ready/valid interfaceactive
stream_fifo_optimal_wrapWrapper that optimally selects either a spill register or a FIFOactive
generic_fifoFIFO register without thresholdsdeprecatedfifo_v3
generic_fifo_advFIFO register without thresholdsdeprecatedfifo_v3
sramSRAM behavioral modelactive
plru_treePseudo least recently used treeactive
unreadEmpty module to sink unconnected outputs intoactive
readDummy module that prevents a signal from being removed during synthesisactive

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_sigFlip-flop with asynchronous active-high reset
`FFARNq_sig, d_sig, rst_val, clk_sig, arstn_sigdeprecated Flip-flop with asynchronous active-low reset
`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_sigFlip-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_sigFlip-flop with load-enable and asynchronous active-high reset
`FFLARNq_sig, d_sig, load_ena, rst_val, clk_sig, arstn_sigdeprecated Flip-flop with load-enable and asynchronous active-low reset
`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_sigFlip-flop with load-enable without reset

SystemVerilog Assertion Macros

The header file assertions.svh contains macros that expand to assertion blocks. These macros should recduce 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

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

Assumption Macros

MacroArgumentsDescription
`ASSUME__name, __prop, (__clk, __rst, __desc)Assume a concurrent property
`ASSUME_I__name, __prop, (__desc)Assume an immediate property

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 a concurrent property during formal verification only
`COVER_FPV__name, __prop, (__clk, __rst)Cover a concurrent property during formal verification