FAQ#

This is a list of Frequently Asked Questions about SiliconCompiler. Feel free to suggest new entries!

How do I…#

… set up a new tool?

See Tools

… set up a new flow?

See Flows

… set up a new pdk?

See PDKs

… set up a new library?

… set up a new target?

See Targets

… create a design object?

from siliconcompiler import Design
design = Design('<design>')

… create an asic project object?

from siliconcompiler import ASIC
project = ASIC(design)

… active filesets?

project.add_fileset("rtl")

… run a compilation?

project.run()

… display my layout?

project.show()

… display a previous run from the command line?

sc-show -design <name>

… change the logger level?

project.logger.setLevel(<INFO|DEBUG|WARNING|ERROR>)

… check my setup before running?

project.check_manifest()

… change the build directory?

project.option.set_builddir(<dirpath>)

… change the caching directory?

project.option.set_cachedir(<dirpath>)

… use the setup json manifest file from a previous run?

project = Project.from_manifest(<filepath>)

… control the thread parallelism for a task?

<task class>.find_task(project).set_threads(<n>, step=<step>, index=<index>)

… start a fresh run?

project.option.set_clean(True)

… start a fresh run and keep the old one?

project.option.set_clean(True)
project.option.set_jobincr(True)

… start a fresh run using the previous run information?

project.option.set_clean(True)
project.option.set_jobincr(True)
project.option.add_from('floorplan')

… register a new source of files?

design.set_dataroot("<name>", "<path>", "<reference>")

… register a new source of files relative to my current file?

design.set_dataroot('<name>', __file__)

… preserve options, like scheduler information, across sessions?

project.option.write_defaults()

… avoid rebuilding an expensive object (such as a PDK) many times?

If a schema object is a pure function of its construction arguments, base it on CachedSchema. Instances are built once per unique (hashable) set of arguments, and the shared, frozen instance is returned on subsequent constructions. This is useful for heavy objects, like PDKs, that would otherwise be re-created dozens of times while loading a target.

from siliconcompiler import PDK
from siliconcompiler.schema import CachedSchema

class MyPDK(PDK, CachedSchema):
    def __init__(self):
        super().__init__("mypdk")
        # ... expensive schema population ...

MyPDK() is MyPDK()   # True -- same shared instance, built only once

The shared instance is frozen: calling set, add, unset, remove, or using EditableSchema on it raises a SchemaFrozenError. This protects the shared object from accidental modification.

… get a modifiable version of a frozen (cached) object?

Use copy(). A copy is always mutable and fully independent of the shared instance, so you are free to modify it. Objects reloaded from a manifest (for example, inside a run) are likewise mutable.

my_pdk = MyPDK()          # frozen, shared
local = my_pdk.copy()     # mutable, independent
local.set("pdk", "foundry", "virtual")

To modify a frozen object in place (for example, to write resolved file paths or hashes back into a shared object during a run), use the _thaw context manager, which restores the frozen state on exit:

with my_pdk._thaw():
    my_pdk.set(*keypath, hashes, field="filehash")