5. Data model

The SiliconCompiler Schema is a data structure that stores all configurations and metrics gathered during the compilation process. Each schema entry (“parameter”) is a self contained leaf cell with a required set of standardized key/value pairs (“fields”). The example below shows the definition of one of the parameters named ‘design’.

scparam(cfg,['design'],
        sctype='str',
        scope='global',
        require='all',
        shorthelp="Design top module name",
        switch="-design <str>",
        example=["cli: -design hello_world",
                "api: chip.set('design', 'hello_world')"],
        schelp="""Name of the top level module or library. Required for all
        chip objects.""")

The table below summarizes mandatory fields used in all parameter definitions.

Field

Description

Values

type

Parameter type

file, dir, str, float, bool, int, [], (a,b)

defvalue

Default schema value

Type dependent

shorthelp

Short single line help string.

String

help

Multi-line documentation string

String

example

Usage examples for CLI ad API

String

lock

Enable/disable for set()/add() methods

True / False

require

Flow based use requirements

String

switch

Mapping of parameter to a CLI switch

String

The file type parameters have the additional required fields show in the table below:

Field

Description

Legal Values

author

File author

String

date

File date stamp

String

signature

Author signature key

String

filehash

File hash value

String

hashalgo

Hashing algorithm used

sha256,md5,…

copy

Whether to copy files into build directory

True / False

Accessing schema parameters is done using the set(), get(), and add() Python methods. The following shows how to create a chip object and manipulate a schema parameter in Python.

import siliconcompiler
chip = siliconcompiler.Chip('hello_world')
chip.set('input', 'verilog', 'hello_world.v')
print(chip.get('input', 'verilog'))

Reading and writing the schema to and from disk is handled by the read_manifest() and write_manifest() Python API methods. Supported export file formats include TCL, JSON, and YAML. By default, only non-empty values are written to disk.

import siliconcompiler
chip = siliconcompiler.Chip('hello_world')
chip.write_manifest('hello_world.json')

The JSON structure below shows the ‘design’ parameter exported by the write_manifest() method.

"design": {
    "defvalue": null,
    "example": [
        "cli: -design hello_world",
        "api: chip.set('design', 'hello_world')"
    ],
    "help": "Name of the top level module or library. Required for all\nchip objects.",
    "lock": "false",
    "notes": null,
    "require": "all",
    "scope": "global",
    "shorthelp": "Design top module name",
    "signature": null,
    "switch": "-design <str>",
    "type": "str",
    "value": "hello_world"
},

To handle complex scenarios required by advanced PDKs, the Schema supports dynamic nested dictionaries. A ‘default’ keyword is used to define the dictionary structure during object creation. Populating the object dictionary with actual keys is done by the user during compilation setup. The example below illustrates how ‘default’ is used as a placeholder for the timing model filetype and corner. These dynamic dictionaries makes it easy to set up an arbitrary number of libraries and corners in a PDK using Python loops.

filetype = 'default
corner = 'default'
# ...
scparam(cfg,['model', 'timing', filetype, corner],
         sctype='[file]',
         scope='global',
         shorthelp=f"Model: Timing",
         switch=f"-model_timing 'filetype corner <file>'",
         example=[
             f"cli: -model_timing 'nldm-libgz ss ss.lib.gz'",
             f"api: chip.set('model','timing','nldm-ldb','ss','ss.ldb')"],
         schelp=f"""
         Filepaths to static timing models specified on a per filetype and
         per corner basis.  Examples of filetypes include: nldm, nldm-ldb,
         nldm-libgz, ccs, ccs-libgz, ccs-ldb, scm, scm-libgz, scm-ldb,
         aocv, aocv-libgz, aocv-ldb.""")

The SiliconCompiler Schema is roughly divided into the following major sub-groups:

Group

Parameters

Description

option

47

Compilation options

tool

24

Individual tool settings

flowgraph

8

Execution flow definition

pdk

46

PDK related settings

asic

45

ASIC related settings

fpga

5

FPGA related settings

constraint

7

Advanced timing analysis settings

model

7

Models/abstractions of design

metric

40

Metric tracking

record

15

Compilation history tracking

package

28

Packaging manifest

datasheet

36

Design interface specifications

units

9

Global units

total

317

Refer to the Schema and Python API sections of the reference manual for more information. Another good resource is the single file Schema source code.