Skip to content
ucb-substratePublic

About

A configurable SRAM generator

Resources

Stars

72 stars

Watchers

3 watching

Forks

Repository files navigation

SRAM22

SRAM22 is a configurable single-port SRAM generator for SKY130, developed at UC Berkeley.

Installation

Install with a current stable Rust toolchain and Cargo:

cargo install --git https://github.com/ucb-substrate/sram22 --locked sram22

Generate a macro

Save this as sram22.toml:

[[sram]]
num_words = 64
data_width = 32
mux_ratio = 4
write_size = 8
# Optional, with commercial features: pex_level = "rcc"

Then run:

sram22

SRAM22 writes GDS, LEF, SPICE, behavioral Verilog, and Liberty timing files to build/sram22_64x32m4w8/ beside the configuration file. Add more [[sram]] blocks to generate a batch. Each macro gets its own directory under build/, or under the directory selected with --output-dir <path>. A single configuration without the [[sram]] header is also accepted.

-c, --config <CONFIG>          TOML file (default: sram22.toml)
-o, --output-dir <OUTPUT_DIR>  Output directory
-f, --force                    Regenerate even if outputs already exist
-p, --parallel <PARALLEL>      Maximum concurrent macros (default: no limit)
    --progress <MODE>          auto, plain, or off (default: auto)
    --color <WHEN>             auto, always, or never (default: auto)
-v, --verbose                  Show plans, stages, and artifact directories
-q, --quiet                    Show only errors
-h, --help                     Show available options
-V, --version                  Show version

On an interactive terminal, a live table at the bottom shows each SRAM's SPICE, GDS, Verilog, LEF, and LIB stages. Requested DRC, LVS, and PEX stages appear in commercial builds. ✓ means complete, an animated spinner means running, · pending, ✗ failed, ! skipped because the SRAM failed during setup, and — not requested. LIB reports completed timing corners out of three. SRAMs waiting for a worker are labeled queued; use --parallel 2, for example, to run two SRAMs at a time.

The table updates in place. Completion and error messages appear above it and remain in scrollback; the table clears when the final summary is printed. Narrow terminals wrap stages beneath each SRAM name. Large batches prioritize running SRAMs, then queued SRAMs, and report how many of each are hidden. Use --verbose to print the complete batch plan before execution.

Redirected output automatically uses plain start/completion lines, with all status output on stderr. --progress plain selects this format explicitly; --progress off keeps startup information, errors, and the final summary. --quiet suppresses everything except errors and, if any SRAM failed, the final summary. Automatic color respects NO_COLOR; --color always and --color never override detection.

Existing complete outputs are reported as Reused. Each view is generated independently: if one stage fails, the remaining stages still run, and the SRAM is reported as failed with every stage error and the list of views that were written. Only a failure during setup skips all stages. Generation continues for other SRAMs if one fails, and exits unsuccessfully if any failed. Rerunning the same command retries incomplete SRAMs while reusing completed ones; --force regenerates every SRAM regardless. Duplicate output names and invalid configurations are rejected before any generation starts. A configuration without interpolated timing data gets a warning up front; its SPICE, GDS, Verilog, and LEF are still written and only LIB fails.

With the BWRC manifest, --liberate selects Liberate MX characterization; --drc and --lvs run Calibre verification. Setting pex_level to r, c, rc, or rcc runs extraction for that macro; it is ignored without commercial features. --all enables DRC and LVS but retains interpolated timing unless --liberate is also supplied. Liberate uses the extracted netlist when pex_level is set.

Liberty timing

By default, SRAM22 generates TT, SS, and FF Liberty files from an interpolation model. Its timing data supports write_size = 8, word widths from 8 to 128 bits, and depths of 64, 128, 256, 512, 1024, or 2048 words. Both mux ratios are supported except 64 words with mux ratio 8, which has too few rows. Other configurations require additional timing data or a BWRC build with --liberate. See the interpolation model for its assumptions. Liberty filenames include a corner suffix, such as sram22_64x32m4w8_tt_025C_1v80.lib, with SS ss_100C_1v60 and FF ff_n40C_1v95.

SPICE simulation

In an ngspice testbench, load the device-model library from your SKY130 PDK and the generated circuit netlist. Select the process corner on the .lib line and provide power supplies, stimuli, and temperature:

.lib "/path/to/skywater-pdk/libraries/sky130_fd_pr/latest/models/sky130.lib.spice" tt
.include "sram22_64x32m4w8.spice"
.temp 25

Load the model library once when simulating several macros together. For SRAM22's Rust simulation testbenches, set SKY130_OPEN_PDK_ROOT to the open PDK root:

export SKY130_OPEN_PDK_ROOT=/path/to/skywater-pdk

Configuration

Rows = num_words / mux_ratio; columns = data_width * mux_ratio. Valid configurations require a positive write_size, a power-of-two num_words, a mux ratio of 4 or 8, a data width divisible by write_size, at least 16 rows, and at least 16 columns. Address width is log2(num_words); write-mask width is data_width / write_size.

With write_size == data_width, wmask is a scalar whole-word write mask. Drive it high to allow writes.

See the documentation for the interface and integration outlines, and the published macro catalog for existing layouts and timing libraries. Published GDS files are compressed; run the catalog's unzip.sh or decompress individual .gds.gz files.

Advanced setup

Local checkout or custom fork

Use a checkout to modify SRAM22 or install a fork. Substitute your fork's URL:

git clone https://github.com/ucb-substrate/sram22.git
cd sram22
cargo install --path . --locked

BWRC installation

Commercial characterization and Calibre verification require the licensed tools, commercial PDK, and access to the BWRC Git repositories. Configure SSH access and add this to ~/.cargo/config.toml:

[net]
git-fetch-with-cli = true

Select the commercial manifest:

git clone https://github.com/ucb-substrate/sram22.git
cd sram22
cp Cargo.bwrc.toml Cargo.toml
make install

Set the commercial PDK root when running the BWRC build:

export SKY130_COMMERCIAL_PDK_ROOT=/path/to/commercial/sky130

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed under the BSD 3-Clause license, without any additional terms or conditions. Vendored third-party files retain their own notices and licenses; see tech/sky130 for provenance.

About

A configurable SRAM generator

Resources

Stars

72 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages