slang::netlist::NetlistSerializer struct

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}
  ]
}

Public static variables

static int formatVersion constexpr

Public static 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)

Function documentation

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

Exceptions
std::runtime_error on parse failure or unsupported version.

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