Skip to content

Netlist Utilities

SJulianS edited this page Oct 31, 2022 · 11 revisions

The netlist utils class provides several utility functions that aid reverse engineering.

Get Subgraph Function

It is often desirable to generate a boolean function that combines multiple gates. Therefore the get_subgraph_function can be used. It takes a set of gates and the output net as input, for which a boolean function, depending on the provided set of gates, should be generated (see the python doc). It is important to note that the variables in the Boolean function are the IDs of the nets in the netlist. Furthermore, the generated Boolean function is not optimized yet. An example code looks as follows:

gate1 = netlist.get_gate_by_id(1)
gate2 = netlist.get_gate_by_id(2)

subgraph = [gate1, gate2]

output_net = netlist.get_net_by_id(10)

bf = hal_py.NetlistUtils.get_subgraph_function(output_net, subgraph)

print(bf.simplify())

This might return the following output: 3 & 4 & 5 & 6 & 7 & 8 & 9

More to come

We will extend this class with more useful functions over time 👍

Clone this wiki locally