HAL  v4.5.0-258-gf372a0264
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::GateLibraryParser Class Referenceabstract

#include <hal_core/netlist/gate_library/gate_library_parser/gate_library_parser.h>

Inheritance diagram for hal::GateLibraryParser:
Inheritance graph
Collaboration diagram for hal::GateLibraryParser:
Collaboration graph

Public Types

enum class  ParseStatus { NoError , NeedsUpgrade , UnknownError }
 

Public Member Functions

 GateLibraryParser ()
 
virtual ~GateLibraryParser ()
 
virtual Result< std::unique_ptr< GateLibrary > > parse (const std::filesystem::path &file_path)=0
 

Static Public Member Functions

static ParseStatus get_parse_status ()
 
static void request_upgrade ()
 

Static Protected Member Functions

static void set_parse_status (ParseStatus status)
 
static bool is_upgrade_requested ()
 

Detailed Description

The gate library parser is the base class that needs to be inherited from all parsers that shall be registered with HAL.

Definition at line 42 of file gate_library_parser.h.

Member Enumeration Documentation

◆ ParseStatus

The outcome of the most recent parse as reported by the parser.

Enumerator
NoError 

The gate library was parsed successfully.

NeedsUpgrade 

The file format is outdated, it gets upgraded by parsing it again after request_upgrade.

UnknownError 

Parsing failed for any other reason, or the parser does not report its status.

Definition at line 48 of file gate_library_parser.h.

Constructor & Destructor Documentation

◆ GateLibraryParser()

hal::GateLibraryParser::GateLibraryParser ( )

Sets the parse status to UnknownError until the parser reports otherwise.

Definition at line 14 of file gate_library_parser.cpp.

References UnknownError.

◆ ~GateLibraryParser()

hal::GateLibraryParser::~GateLibraryParser ( )
virtual

Withdraws a pending upgrade request, so that it applies to a single parse only.

Definition at line 19 of file gate_library_parser.cpp.

Member Function Documentation

◆ get_parse_status()

GateLibraryParser::ParseStatus hal::GateLibraryParser::get_parse_status ( )
static

Get the outcome of the most recent parse, e.g., to find out why loading a gate library failed.

If loading fails before any parser is involved, e.g., because the file does not exist, the status still refers to an earlier parse.

Returns
The parse status.

Definition at line 24 of file gate_library_parser.cpp.

◆ is_upgrade_requested()

bool hal::GateLibraryParser::is_upgrade_requested ( )
staticprotected

Check whether the current parse may upgrade a gate library file in an outdated format.

Returns
true if an upgrade was requested, false otherwise.

Definition at line 39 of file gate_library_parser.cpp.

◆ parse()

virtual Result<std::unique_ptr<GateLibrary> > hal::GateLibraryParser::parse ( const std::filesystem::path &  file_path)
pure virtual

Parses the gate library definition file.

Parameters
[in]file_path- Path to the file containing the gate library definition.
Returns
The gate library on success, an error otherwise.

Implemented in hal::LibertyParser, and hal::HGLParser.

◆ request_upgrade()

void hal::GateLibraryParser::request_upgrade ( )
static

Allow the next parse to upgrade a gate library file in an outdated format.

The upgrade replaces the file, so it must only be requested with the consent of the user. The request applies to the next parse only and is withdrawn once that parse is done.

Definition at line 29 of file gate_library_parser.cpp.

◆ set_parse_status()

void hal::GateLibraryParser::set_parse_status ( ParseStatus  status)
staticprotected

Report the outcome of the current parse.

Parameters
[in]status- The parse status.

Definition at line 34 of file gate_library_parser.cpp.

References hal::status.

Referenced by hal::HGLParser::parse().


The documentation for this class was generated from the following files: