slang-netlist  0.9.0
Loading...
Searching...
No Matches
slang::netlist::NetlistSerializer Struct Reference

#include <NetlistSerializer.hpp>

Static Public Member Functions

static auto serialize (NetlistGraph const &graph) -> std::string
 Serialise graph to a pretty-printed JSON string.
static void deserialize (std::string_view json, NetlistGraph &graph)

Static Public Attributes

static constexpr int formatVersion = 2

Detailed Description

Serialise and deserialise a NetlistGraph to/from JSON.

Format (version 2):

{
"version": 2,
"fileTable": ["test.sv", "other.sv"],
"nodes": [
{"id": 1, "kind": "Port", "path": "m.a", "name": "a",
"bounds": [0, 0], "direction": "In",
"location": {"fileIndex": 0, "line": 2, "column": 31}}
],
"edges": [
{"source": 1, "target": 3, "edgeKind": "None",
"symbol": {"name": "a", "path": "m.a",
"location": {"fileIndex": 0, "line": 2, "column": 31}},
"bounds": [0, 0], "disabled": false}
]
}

Member Function Documentation

◆ deserialize()

void slang::netlist::NetlistSerializer::deserialize ( std::string_view json,
NetlistGraph & graph )
static

Deserialise a JSON string into graph. The graph must be empty. FileTable is populated from the JSON.

Exceptions
std::runtime_erroron parse failure or unsupported version.

◆ serialize()

auto slang::netlist::NetlistSerializer::serialize ( NetlistGraph const & graph) -> std::string
static

Serialise graph to a pretty-printed JSON string.

Member Data Documentation

◆ formatVersion

int slang::netlist::NetlistSerializer::formatVersion = 2
staticconstexpr

The documentation for this struct was generated from the following file: