6. Programming model

The SiliconCompiler project includes a Python API and programming model to facilitate development of advanced hardware compilation flows. The basic programming model includes the following ordered steps.

6.1. Object Creation

Compilation is based on a single chip object that follows the design from start to finish. A chip object is created by calling the Core API class constructor.

import siliconcompiler

chip = siliconcompiler.Chip('topmodule')

6.2. Setup

Once the chip object has been created, functions and data are all contained within that object. A compilation is set up by accessing methods and parameters from the chip object. Parameters can generally be configured in any order during setup. The exceptions are ['arg', 'flow', ...] and ['arg', 'pdk', ...] parameters, which must be set before calling chip.load_flow() or chip.load_pdk(), respectively.

The snippet of code below shows the basic principles.

chip.set('input', 'verilog', '<file>.v')

6.3. Run

Once all the parameters have been setup, compilation is done by a single atomic call to run().

chip.run()

6.4. Inspection

Once the compilation has completed, chip object can be queried and another run() can be called.

chip.summary()
print(chip.get('metric', 'syn', '0', 'cellarea')
#..do something else

For complete information, see the Core API section of the reference manual.