cana.io.cnet module
BNS / Cell Collective .cnet (BLIF-like) import and export.
- cana.io.cnet.parse_cnet(text)[source]
Parse BNS / Cell Collective
.cnettext into a node list.Format sketch:
.v <N> .l <id> <name> .n <id> <k> <in1> ... <ink> <binstate> <out> # don't-care bits are ``-`` (legacy ``2`` also accepted) .e
Per-node heuristic: if any logic line uses don’t-care
-/2, store that node’s cover asone_symbol_schemataonly; otherwise import as a densebit_lut(including ON-only minterm listings with implied 0s).Import is faithful: missing peer representations are not filled. Call
BooleanNetwork.fill_function_representation(...)(or the node helper) when you need the other slot.- Parameters:
text (str)
- Return type:
List[BooleanNode]
- cana.io.cnet.nodes_to_cnet(nodes, *, adjust_no_input=False, one_symbol_schemata=False)[source]
Export a node list to BNS / Cell Collective
.cnettext.- Parameters:
nodes (Sequence[BooleanNode]) – Dense
list[BooleanNode]hub (nodes[i].id == i).adjust_no_input (bool) – If True, rewrite empty-input nodes as self-loops with identity LUT
[0, 1](BNS compatibility).one_symbol_schemata (bool) – If True, export one-symbol (wildcard) covers; if False (default), export dense
2**kLUT rows.
- Return type:
str
Dense export materializes
bit_lutviaBooleanFunction.get_bit_lut()when only expression/schemata are present. Schemata export materializesone_symbol_schematasimilarly. If a representation cannot be derived, raisesValueError.