VLSIDA / OpenCache

An open-source custom cache generator.
BSD 3-Clause "New" or "Revised" License
28 stars 3 forks source link
cache python

OpenCache

An open-source cache generator using OpenRAM SRAM arrays.

What is OpenCache?

OpenCache is an open-source Python generator to create custom cache designs using OpenRAM's SRAM arrays. It generates a synthesizable Verilog file for cache logic and configuration files for internal SRAM arrays.

Documentation

This serves as the documentation of OpenCache that explains parameters, architecture, etc.

Basic Setup

Dependencies

The OpenCache has the following dependencies:

If you want to verify the design via simulation and/or synthesis, you will need:

For regression testing, you will need some Python packages, which can be installed with the following command:

pip3 install -r requirements.txt

Environment

You must set an environment variable:

For example, add this to your .bashrc file:

export OPENCACHE_HOME="$HOME/opencache/generator"

Usage

Basic Usage

Clone the repository.

git clone https://github.com/VLSIDA/OpenCache.git
cd OpenCache/generator

Create a Python configuration file. All configuration parameters can be found in here. A simple configuration file is:

# Data array size
total_size = 1024

# Data word bit size
word_size = 8

# Number of words per line
words_per_line = 4

# Address port size
address_size = 11

# Number of ways
num_ways = 1

# Replacement policy
replacement_policy = None

# Write policy
write_policy = "write-back"

# Output file name
output_name = "cache"

Run the generator.

python3 opencache.py config_file

OpenRAM Options

The openram_options option of OpenCache allows you to override configuration files for OpenRAM to generate SRAMs that you desire. An example is:

# Add this to OpenCache config file
openram_options = {
    "tech_name": "scn4m_subm",
    "nominal_corner_only": True,
    "analytical_delay": False,
}

Verification

In order to run verification, you need to add the following lines to your configuration file.

# For simulation
simulate = True

# For synthesis
synthesize = True

# To keep the results
keep_temp = True

Unit Tests

Regression testing performs a number of tests for OpenCache. From the generator directory, use the following command to run all regression tests:

python3 regress.py

To run a specific test:

python3 {unit test}.py

License

OpenCache is licensed under the BSD 3-Clause License.