Note

This is a WIP Beta version. All content is subject to change.

# Getting Started with CIRCA¶

## Introduction [1]¶

CIRCA’s architecture is shown in the overview figure. We target search-based approximation approaches with different approximation techniques, and formal verification as well as testing for circuit validation. The framework is divided into three stages: the input stage, the QUAES stage, and the output stage. The input stage processes user-provided information, which in any case comprises a configuration file and a description of the original, exact circuit. The configuration file defines the employed functionality in the QUAES stage and specifies the target metric as well as the quality constraints for the approximated circuits. The circuit description may contain annotations, added, for example, by the user to mark subcircuits amenable to approximations. Since our framework supports also testing as quality assurance technique, the input can include a test vector set.

The main stage for generating approximate circuits is the QUAES stage. The split of the corresponding functionality into the four processing blocks Quality Assurance, Approximation, Estimation and Search Space Exploration (QUAES) is key to achieving a modular and extensible architecture. We denote the subcircuits in the input Verilog code subject to approximations as candidates, and the different approximated versions of these candidates as variants. The overall circuit with instantiated variants for the candidates is called a circuit configuration.

The structure of the search space exploration is kept rather general, and thus, sufficiently flexible to support a wide range of search algorithms. The search space is iteratively explored by creating and visiting configurations, which form the nodes of the search space, by applying the three steps Select, Expand, and Evaluate.

The evaluation step takes a set of configurations and determines estimated values for parameters of interest. Typically these parameters cover metrics related to area, delay, and power but can also include estimates of the error metrics. The actual estimation functions are encapsulated in the estimation block to clearly separate estimation from the search space exploration.

The select step receives a set of configurations, each with an annotated vector of estimated parameters, and selects the next configuration to be further considered, i.e., to be expanded. This selection relies on a search heuristic. The selected configuration is subsequently validated. To this end the configuration, now called Circuit-under-Test (CUT), is sent to the quality assurance block. This block either employs formal verification or testing to decide if the CUT satisfies the quality constraints and passes the check or not. If a CUT fails quality assurance, the select step will, depending on the configuration file, either abort the search or pick the next best configuration for validation. In the latter case, the search terminates if there are no more valid configurations.

If a CUT passes validation, the configuration and thus the search space is expanded by creating a number of new configurations. For creating new configurations the approximation block applies certain approximation techniques. Depending on the actual configuration of the framework, one or more candidates of the configuration can be approximated and one or more approximation techniques can be applied.

The approximation block accesses a library of approximated subcircuits, which is beneficial for two reasons: First, it is rather likely that one circuit component will be approximated for several times. This happens when the overall circuit contains identical candidates, e.g., multiple occurrences of an 8-bit unsigned adder. Storing the approximated versions of such components and retrieving them the next time can greatly save computations. Second, there are already libraries available of approximated components which can then be leveraged by CIRCA.

During the QUAES stage, all validated configurations are stored. The output stage performs post-processing on these configurations to return either the best approximated circuit, e.g., a circuit that respects the error constraints and has minimal area or energy, or a Pareto-filtered set of circuits.

## Installation¶

### Prerequisites¶

• Have Python 3.6.0 or newer installed
• Whatever ABC and Yosys require (see respective website)
• Go to circa base directory

### On first installation¶

cd abc/
make -j 8
cd ..

cd yosys/
make -j 8
cd ..


### Before each terminal session¶

Source CIRCA settings to set up CIRCA’s environment:

cd circa/
source settings.sh
cd ..


### Try out demo¶

(Not required for installation)

Small sequential circuit with two modules as approximation candidates and a configuration file that sets the approximation method to precision scaling:

cd demo/anno_gradient/
# Calling CIRCA: circa <cfg. file> <input design *.v>
circa example.cfg test_seq.v


## Next Steps¶

Now that you have successfully installed and tested CIRCA, you can continue by reading the user guide to learn how to use CIRCA to generate approximate circuits yourself, or you can go on to the developer guide and learn everything you need to design and implement your own CIRCA components.