[][src]Function xc2bit::get_device_structure

pub fn get_device_structure<N, W, C>(
    device: XC2Device,
    node_callback: N,
    wire_callback: W,
    connection_callback: C
) where
    N: FnMut(&str, &str, u32, u32) -> usize,
    W: FnMut(&str) -> usize,
    C: FnMut(usize, usize, &'static str, u32, (u32, u32)), 

This function calls the passed-in callbacks to provide information about the structure of the CPLD. node_callback is called to "create" a new node, wire_callback is called to "create" a new wire, and connection_callback is called to connect one port on a node to a wire. The arguments to the callbacks are:

  • node_callback: node unique name, node type, function block index, index within function block
  • wire_callback: wire unique name
  • connection_callback: value returned from node_callback, value returned from wire_callback, port name, index within port, extra data

This interface was designed specifically for the place-and-route tool to build up a model of the device. However, it is sufficiently generic to be useful for other programs as well. The interface is designed around callbacks so that it does not dictate the data structures that the calling program will use, and so that it does not needlessly build up a graph data structure that the calling program will quickly discard. Nodes and wires are identified with strings (rather than numbers) as a compromise between performance and convenience to the caller.

Note that mux sites are not represented here. They just appear as multiple drivers onto the same wire.

FIXME: Explain what the extra data is for (it's a hack fo the ZIA)