Skip to content

Repository files navigation

common RTL foundation

common is a self-contained SystemVerilog component layer for SoC IP. It provides clock/reset, CDC, stream, storage, address, register, and technology model primitives without requiring a parent SoC repository.

The preferred public directories are rtl/base, rtl/stream, rtl/bus, rtl/clock, rtl/cdc, and rtl/memory. Existing interfaces remain at their legacy paths for current users in the IP workspace.

Quick start

make doctor
make license-check
make format-check
make docs-check
make test-iverilog
make test-verilator
make synth
make formal

flist/rtl.f is the ordered synthesis/simulation source list. Unit tests are self-checking and write only below build/. format-check validates all tracked SystemVerilog sources with Verible and tracked Makefile sources with mbake using .bake.toml. docs-check verifies that every declared RTL unit has a maintained reference page. See docs/reference/ for the full catalog, docs/design.md for contracts, and AGENTS.md for contribution rules.

license-check requires every tracked SystemVerilog source to carry an SPDX identifier or an upstream license notice in its first 40 lines.

Register Primitives

rtl/utils/register.sv keeps the existing module names as a compatibility surface. Select the primitive by clock edge, reset style, reset value, and enable requirement:

Primitive familyClock edgeResetEnable
dffrisingnoneno
dfflrisingnoneyes
dffr, dfferrisingasynchronous active-low, zerono / yes
dffrh, dfferhrisingasynchronous active-low, all onesno / yes
dffrc, dffercrisingasynchronous active-low, configurableno / yes
dffsr, dffesrrisingsynchronous active-low, zerono / yes
dffsrc, dffesrcrisingsynchronous active-low, configurableno / yes
ndffr, ndfferfallingasynchronous active-low, zerono / yes
dffermrisingasynchronous active-low, per-array policyper element

Reset has priority over enable. A low enable holds the previous value. The dffercn type-parameterized asynchronous-reset variant remains for existing users; new fixed-width code should prefer dfferc. Register enable expresses data retention semantics. It does not guarantee clock-gate insertion; use the Common clk_icg/technology ICG wrapper at module level when clock gating is required and verify the mapped gate-level netlist.

The repository is licensed under Mulan PSL v2 unless an individual source file states another compatible upstream license. Third-party attributions and license notices are recorded in NOTICE and licenses/.

Third-Party Notices

The repository-level Mulan PSL v2 license applies unless an individual source file declares a compatible upstream license. Per-file copyright and SPDX notices take precedence. The following table is a concise attribution guide; NOTICE, licenses/README.md, and source headers are the authoritative records.

MaterialCopyright and licenseAffected scope and authoritative record
PULP platform common_cellsETH Zurich and University of Bologna; individual source notices identify additional authors. SHL-0.51.PULP-derived RTL carrying that SPDX identifier. The complete source-to-component mapping and reference snapshot are in licenses/pulp_common_cells_manifest.tsv and NOTICE.
PULP common_cells signal helpersETH Zurich, University of Bologna, EPFL, and OpenHW Group. Apache-2.0 WITH SHL-2.1.rtl/base/signal_helpers.sv, derived from PULP cc_read and cc_unread; see its exact source header and NOTICE.
lowRISC OpenTitan register field materiallowRISC contributors. Apache-2.0.rtl/utils/regfield.sv; see NOTICE.

Component Reference

Each declared RTL unit has a detailed integration page. The catalog is generated from rtl/; use the linked page for parameters, complete interfaces, reset/CDC constraints, and an instantiation example.

base

ComponentTypeFunction summary
bit_countmoduleCombinational population-count primitive.
component_math_pkgpackageCompile-time arithmetic helpers for parameterized components.
counting_bloom_filtermoduleCounting Bloom filter with explicit counter saturation.
credit_poolmoduleSaturating available-credit tracker for resource flow control.
hash_indicator_bankmoduleMulti-hash indicator-vector generator.
index_to_onehotmoduleBounded index-to-one-hot decoder.
interval_ones_maskmoduleInclusive contiguous mask generator between two bit positions.
leading_zero_countmoduleCombinational leading-zero counter with all-zero indication.
loop_trip_countermoduleProgrammable terminal-count loop counter.
onehot_checkmoduleOne-hot validity checker with optional all-zero acceptance.
onehot_to_indexmoduleOne-hot vector to index converter with validity output.
permutation_hashmoduleDeterministic non-cryptographic bit-mixing hash.
plru_victim_selectormodulePower-of-two pseudo-LRU cache-way victim selector.
prefix_ones_maskmoduleLow-order prefix-ones mask generator.
retry_backoffmodulePseudo-random exponential retry-delay controller.
sample_majority_filtermoduleSliding-window N-of-M single-bit sample filter.
secded_decodemoduleExtended-Hamming SECDED decoder, corrector, and error classifier.
secded_encodemoduleExtended-Hamming SECDED encoder.
secded_layout_pkgpackageShared SECDED codeword-layout helpers.
signal_sinkmoduleIntentional unused-signal terminator.
signal_tapmoduleNamed combinational signal pass-through for observability.
stable_level_filtermoduleConsecutive-sample debounce and stability filter.
trailing_zero_countmoduleCombinational trailing-zero counter with all-zero indication.

bus

ComponentTypeFunction summary
address_mapmoduleMasked address-map decoder with deterministic lowest-index priority.
address_range_decodermoduleInclusive address-range decoder.
address_regionmoduleMasked address-region matcher.
address_set_decodermoduleDecoder for a set of independently configured address regions.
axi4_regslicemoduleElastic register slice for all five AXI4 channels.

cdc

ComponentTypeFunction summary
async_gray_queuemoduleGray-pointer asynchronous FIFO wrapper.
async_reqackmoduleOne-entry four-phase asynchronous data mailbox.
cdc_2phasemoduleTwo-phase asynchronous request/acknowledge transfer.
cdc_2phase_dstmoduleDestination-side implementation of the two-phase CDC link.
cdc_2phase_srcmoduleSource-side implementation of the two-phase CDC link.
cdc_2phase_warm_flushmoduleSource-initiated warm-clear wrapper for a two-phase CDC link.
cdc_event_bridgemodulePulse/event transport over an asynchronous mailbox.
cdc_event_bridge_ackmoduleAcknowledged asynchronous event transport.
cdc_fifomoduleGray-pointer asynchronous FIFO.
cdc_fifo_dstmoduleDestination-side implementation of the asynchronous FIFO.
cdc_fifo_srcmoduleSource-side implementation of the asynchronous FIFO.
cdc_fifo_warm_flushmoduleSource-initiated warm-clear wrapper for an asynchronous FIFO.
cdc_remote_clear_requestmoduleRetained remote-clear request channel.
cdc_reset_barriermoduleTwo-domain reset barrier with synchronized release.
cdc_syncmoduleMulti-flop synchronizer for a control bit or independently encoded vector.
cdc_sync_detmoduleSynchronized control input with edge detection.
cdc_warm_flush_controllermoduleAcknowledged isolate-reset-resume controller for CDC warm flush.
clearable_async_queuemoduleAsynchronous queue with coordinated endpoint clear.
clearable_two_phase_linkmoduleTwo-phase link with coordinated endpoint clear.
four_phase_mailboxmodulePublic wrapper for the four-phase asynchronous mailbox API.
isochronous_handshakemoduleHandshake for fixed-ratio, STA-constrained isochronous clocks.
isochronous_stream_buffermoduleStream buffer for fixed-ratio, STA-constrained isochronous clocks.
synchronized_edgemoduleSynchronizes a control transition and emits a local edge indication.
test_reset_synchronizermoduleVerification-oriented reset synchronization helper.
two_phase_async_queuemoduleQueue API built from two-phase asynchronous transfers.

clkrst

ComponentTypeFunction summary
clk_int_div_simplemoduleRuntime-programmable integer divider with safe low-phase updates.
clk_int_even_divmoduleEven clock divider retaining requests until a safe boundary.
clk_int_even_div_staticmoduleStatic even integer clock divider.
clk_int_odd_div_staticmoduleStatic odd integer clock divider.
peak_delta_countermoduleUp/down counter with retained high-water mark.
rs_countermoduleResettable up/down counter.
rs_delta_countermoduleDelta-counting counter.
rst_syncmoduleAsynchronous-assert, synchronous-release reset synchronizer.

clock

ComponentTypeFunction summary
clock_dividermoduleRuntime-programmable divider that changes only at an output-low boundary.
clock_or_treemoduleOR tree for clocks already proven safe to combine.
safe_clock_muxmoduleGlitch-safe handover mux for two continuously running clocks.

interface

ComponentTypeFunction summary
ahbl_ifinterfaceTyped AHB-Lite interface with master and slave modports.
apb4_ifinterfaceClocked APB4 interface with master and slave modports.
apb4_pure_ifinterfaceClockless APB4 signal interface with master and slave modports.
axi4_addr_genmoduleAXI4 next-address generator for FIXED, INCR, and legal WRAP bursts.
axi4_ifinterfaceTyped AXI4 interface with master and slave modports.
axi4_stream_ifinterfaceTyped AXI4-Stream interface with source, sink, and monitor modports.
ram_ifinterfaceSimple RAM request/response interface with master and slave modports.
ready_valid_ifinterfaceTyped ready/valid interface with source, sink, and monitor modports.
ribp_ifinterfaceRIBP request/response interface with response-error signaling.

memory

ComponentTypeFunction summary
circular_storemoduleSequential circular store with bounded random reads.
memory_bank_adaptermodulePublic banked-memory request and response adapter.
memory_bank_adapter_detailmoduleBanked-memory request splitter and response gatherer.
sync_memorymodulePortable synchronous memory model with positive-logic controls.
tag_order_queuemoduleShared-pool queue preserving FIFO order within each tag.

model

ComponentTypeFunction summary
apb4_master_modelmoduleSimulation APB4 master model.

stream

ComponentTypeFunction summary
axi4_stream_regslicemoduleElastic AXI4-Stream register slice.
bypass_buffermoduleCombinational valid/ready stream pass-through.
latest_value_streammoduleValid-only stream adapter retaining the newest pending value.
memory_response_bridgemoduleResponse-order bridge between memory and stream interfaces.
round_robin_arbitermoduleFair transfer-driven round-robin arbiter.
stream_buffermoduleValid/ready stream wrapper around a spill register.
stream_collectormoduleCollects selected valid/ready inputs into one stream output.
stream_credit_limitermoduleLimits stream acceptance by available credits.
stream_crossbarmoduleArbitrates and routes multiple stream inputs to multiple outputs.
stream_delay_injectormoduleControlled stream delay injector for verification and stress.
stream_discard_gatemoduleConsumes input transfers while discard is asserted.
stream_elastic_registermoduleOne-entry elastic valid/ready register stage.
stream_fair_arbitermoduleFair round-robin arbiter for valid/ready stream inputs.
stream_fallthrough_buffermoduleOne-entry fall-through valid/ready buffer.
stream_queuemoduleParameterized valid/ready queue with optional fall-through.
stream_replicatormoduleRegistered one-item stream distributor with per-target completion.
stream_routermoduleRoutes one valid/ready input to a selected output.
stream_selectormoduleSelects one of several valid/ready inputs.
stream_shuffle_networkmoduleDeterministic stream-lane permutation network.
stream_window_guardmoduleLimits outstanding stream requests with explicit retire accounting.

tech

ComponentTypeFunction summary
clk_an2moduleBehavioral two-input clock AND model.
clk_bufmoduleBehavioral clock buffer model.
clk_icgmoduleBehavioral integrated clock-gate model.
clk_icg2moduleBehavioral two-input integrated clock-gate model.
clk_mux2moduleBehavioral two-input clock mux model.
clk_nmoduleBehavioral clock inverter model.
clk_nd2moduleBehavioral two-input clock NAND model.
clk_xor2moduleBehavioral two-input clock XOR model.
osc_pad_hmoduleHorizontal oscillator pad abstraction.
osc_pad_vmoduleVertical oscillator pad abstraction.
tech_pllmoduleTechnology PLL abstraction.
tech_rammoduleBehavioral single-port technology RAM model.
tech_ram_bmmoduleBehavioral byte-masked technology RAM model.
tech_regfilemoduleBehavioral technology register-file model.
tech_regfile_bmmoduleBehavioral byte-masked technology register-file model.
tri_pd_pad_hmoduleHorizontal pull-down pad abstraction.
tri_pd_pad_vmoduleVertical pull-down pad abstraction.
tri_pdu_pad_hmoduleHorizontal pull-down-up pad abstraction.
tri_pdu_pad_vmoduleVertical pull-down-up pad abstraction.
tri_pu_pad_hmoduleHorizontal pull-up pad abstraction.
tri_pu_pad_vmoduleVertical pull-up pad abstraction.

utils

ComponentTypeFunction summary
bin2graymoduleCombinational binary-to-Gray code converter.
dffmodulePlain D flip-flop primitive.
dffermoduleEnabled D flip-flop with asynchronous reset.
dffercmoduleEnabled D flip-flop with configurable reset value.
dffercnmoduleEnabled D flip-flop with active-low configurable reset value.
dfferhmoduleEnabled D flip-flop with all-one reset value.
dffermmoduleMasked-update D flip-flop with reset.
dffesrmoduleEnabled D flip-flop with synchronous reset.
dffesrcmoduleEnabled D flip-flop with synchronous reset and configurable reset value.
dfflmoduleLevel-sensitive latch primitive.
dffrmoduleD flip-flop with asynchronous active-low reset.
dffrcmoduleD flip-flop with configurable reset value.
dffrhmoduleD flip-flop with all-one reset value.
dffsrmoduleD flip-flop with synchronous reset.
dffsrcmoduleD flip-flop with synchronous reset and configurable reset value.
edge_detmoduleSingle-bit rising and falling edge detector.
edge_det_femoduleSingle-bit falling-edge detector.
edge_det_remoduleSingle-bit rising-edge detector.
edge_det_syncmoduleSynchronized single-bit rising and falling edge detector.
edge_det_sync_femoduleSynchronized single-bit falling-edge detector.
edge_det_sync_remoduleSynchronized single-bit rising-edge detector.
fifomodulePower-of-two synchronous FIFO with combinational head read.
gray2binmoduleCombinational Gray-to-binary code converter.
lfsr_fibonaccimoduleFibonacci-form pseudo-random linear-feedback shift register.
lfsr_galoismoduleGalois-form pseudo-random linear-feedback shift register.
ndffermoduleEnabled D flip-flop with falling-edge clock and asynchronous reset.
ndffrmoduleResettable multi-stage synchronizer register chain.
regfieldmoduleMasked register-field update primitive.
shift_regmoduleParameterized sequential shift register.
spill_registermoduleTwo-register spill stage for breaking ready timing paths.
stream_fifomoduleLegacy valid/ready wrapper around the synchronous FIFO.
valid_delay_linemoduleValid-only parameterized sequential delay line.
xcheckermoduleSimulation unknown-value checker.

About

A SystemVerilog Components Library

Resources

Code of conduct

Contributing

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages