front_end.front_end_anno_cand module¶
-
class
front_end.front_end_anno_cand.
AnnotatedCandidates
(settings)¶ Bases:
circa.stages.front_end.front_end.FrontEnd
FrontEnd subclass that reads candidate information from annotations in the original design file.
Candidates in the Verilog design are annotated with a key word and optional approximation settings that are placed between the
module
keyword and the module name. The annotation keyword can be set in the configuration file. Default isANNOTATION_KEYWORD = r'<<<APPROX_CAND>>>'
.Raises: ValueError
– If there is no Key keyword in thesettings
dict, i.e. in the configuration file.-
class
ANNOTATION_REGEX_GROUP
¶ Bases:
object
Regex group names used to find and parse annotations.
-
ENTIRE_MATCH
= 'gEntireMatch'¶
-
APPROX_KEY
= 'gApproxKey'¶
-
APPROX_PARAMETERS
= 'gApproxParameters'¶
-
MODULE_NAME
= 'gModuleName'¶
-
MODULE_PORTS
= 'gModulePorts'¶
-
-
setup
(cfg_file, input_file)¶ Sets up the FrontEnd instance using config and input files. Provides default implementation.
Parameters: - cfg_file (str) – The absolute path to the configuration file in *.cfg format.
- input_file (str) – The absolute path to the input circuit file in Verilog format.
Raises: ValueError
– If cfg_file or input_file is invalid, i.e.None
or empty.
-
process
()¶ Returns a GeneralInformation instance: Must generate a CandidateSet, VariantSet and ApproximatedCircuits, set paths and create directories. Must also create Verilog and Blif format files of the original circuit.
- Parameters to set in GeneralInformation object:
- top_module pis pos cand_set variant_set approx_circuits base_directory (optional, default is input file path) output_dir (optional, default is input file path)
-
_extractAnnotationsAndCleanDesign
()¶ Parses the input file and searches for annotations in the code. Puts every annotation found into comments and stores the cleaned design. A key word is used to recognize annotations. The key is set in the config.
Returns: A list containing a dictionary for each annotation found in the input design file. Every dictionary has all keys specified in ANNOTATION_REGEX_GROUP
.Return type: list of dict Raises: RuntimeError
– If no annotations were found in the input circuit file.
-
_generateCandidates
(cand_set)¶ Uses annotations to extract candidate information, instantiates Candidate objects and stores them in the CandidateSet.
Parameters: cand_set ( CandidateSet
) – CandidateSet instance in which the Candidates are stored.
-
class