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?
See Libraries
… 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 onceThe shared instance is frozen: calling
set,add,unset,remove, or usingEditableSchemaon it raises aSchemaFrozenError. 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
_thawcontext manager, which restores the frozen state on exit:with my_pdk._thaw(): my_pdk.set(*keypath, hashes, field="filehash")
… harden a parameterized module so I can reuse it as a macro?
A hardened macro has no parameters, so a parameterized module cannot be hardened directly. Use
Uniquified, which generates a parameter-free variant per used parameter combination plus a wrapper that dispatches to them. See the uniquify tutorial and the Uniquify API.from siliconcompiler import ASIC from siliconcompiler.targets import freepdk45_demo from siliconcompiler.tools.slang.utils.macro import Uniquified # parent_design: your Design that instantiates the parameterized module. uq = Uniquified(parent_design, ["mymodule"]) uq.build(target=freepdk45_demo) # harden every used parameterization project = ASIC(parent_design) project.add_fileset("rtl") freepdk45_demo(project) uq.wireup(project) # alias wrappers + inject macros
… find out which parameter values my module is actually instantiated with?
Construct
Uniquified(construction only elaborates and generates in memory – no disk writes, no tools) and read its state:uq = Uniquified(parent_design, ["mymodule"]) print(uq.variants) # {'mymodule': ['mymodule__N8', 'mymodule__N16']}
… rebuild only some hardened variants?
Pass
macrostoUniquified.build()as a variant name, a module name, or a glob; addrebuild=Trueto force a rebuild even if a cached macro exists.uq.build(target=freepdk45_demo, macros="mymodule__N8", rebuild=True)