|
HAL
v4.5.0-283-g3f42a39fa
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
|
Functions | |
| bool | needs_upgrade (const rapidjson::Document &document) |
| Result< std::vector< std::string > > | upgrade_document (rapidjson::Document &document) |
| std::filesystem::path | get_backup_path (const std::filesystem::path &file_path) |
| Result< std::filesystem::path > | replace_file (const rapidjson::Document &document, const std::filesystem::path &file_path) |
| Result< u32 > | get_version (const rapidjson::Document &document) |
Variables | |
| const u32 | TARGET_VERSION = 6 |
Upgrade of gate library files in HGL format from an older format version to version 6.
What changed in version 6:
{data_identifier, data_category, bit_order} is replaced by an output_pins array, where each entry specifies the output pin, its data_identifier, bit_offset, bit_count, is_ascending and input_pins. The flat configuration made every LUT output pin depend on all input pins and the whole INIT value, so every LUT output pin is migrated to exactly that.parameters section, so that INIT identifiers can be resolved by name and size: one bit_vector parameter of size 2^n per LUT identifier, of size 1 per flip-flop or latch identifier, and of size bit_size / count per RAM identifier.c_ prefix (buffer, carry, mux, lut) are renamed to their canonical forms. | std::filesystem::path hal::hgl_upgrade::get_backup_path | ( | const std::filesystem::path & | file_path | ) |
Get the file name the original gate library is kept under after its upgrade.
The .hgl extension is replaced by .json, so that the original file does not get selected as a gate library by accident. If that file exists already, e.g., from an earlier upgrade, a number is added to the name, i.e., <name>.1.json, <name>.2.json, and so on.
| [in] | file_path | - The path of the gate library file. |
Definition at line 394 of file upgrade_hgl.cpp.
Referenced by replace_file().
Definition at line 289 of file upgrade_hgl.cpp.
Referenced by needs_upgrade(), and upgrade_document().
| bool hal::hgl_upgrade::needs_upgrade | ( | const rapidjson::Document & | document | ) |
Check whether a parsed HGL document has to be upgraded.
This is the case for documents below the target version, and for documents at the target version that still contain LUT configurations in the flat format, which earlier upgrades left behind for multi-output LUTs.
| [in] | document | - The parsed HGL document. |
true if the document has to be upgraded, false otherwise. Definition at line 306 of file upgrade_hgl.cpp.
References get_version(), and TARGET_VERSION.
Referenced by upgrade_document().
| Result< std::filesystem::path > hal::hgl_upgrade::replace_file | ( | const rapidjson::Document & | document, |
| const std::filesystem::path & | file_path | ||
| ) |
Replace a gate library file by an upgraded document.
The original file is renamed as given by get_backup_path and the document is written under the original name, so that projects referring to the gate library need no changes. If writing fails, the original file is restored.
| [in] | document | - The upgraded HGL document. |
| [in] | file_path | - The path of the gate library file to replace. |
Definition at line 409 of file upgrade_hgl.cpp.
References ERR, get_backup_path(), OK, and hal::gate_library_manager::remove().
| Result< std::vector< std::string > > hal::hgl_upgrade::upgrade_document | ( | rapidjson::Document & | document | ) |
Upgrade a parsed HGL document in place.
A document that does not need an upgrade according to needs_upgrade is left unchanged. The version of the document is only set to the target version if all cells were migrated. If any cell cannot be migrated, an error naming all such cells is returned and the document must be discarded.
| [in,out] | document | - The parsed HGL document. |
Definition at line 327 of file upgrade_hgl.cpp.
References ERR, ERR_APPEND, hal::error, get_version(), needs_upgrade(), OK, and TARGET_VERSION.
| const u32 hal::hgl_upgrade::TARGET_VERSION = 6 |
The format version gate libraries are upgraded to.
Definition at line 59 of file upgrade_hgl.h.
Referenced by needs_upgrade(), and upgrade_document().