Module Fnf_core

module Fnf_core: sig .. end
Free Netlist Format (FNF) Core Functions


Netlist Exceptions


exception Error of string

Netlist Types


type scope 
A scope is a hierarchical object that contains cells, properties, and subscopes.
type cell 
A cell is a primitive logic operation.
type port 
A port is an input to a cell.
type cell_info = 
| Input of string * int
| Output of string * int
| Name of string * int
| Dangle
| Const of string
| Buf of int
| Not of int
| And of int
| Xor of int
| Or of int
| Concat of int * int
| Select of int * int
| Eq of int
| Lt of int
| Add of int
| Sub of int
| Mul of int
| Mux of int
| Ff of int
| Ffc of int
| Bbox of string * int * int * int list
Cell info gives the netlist user visability to cell information.
type item = 
| Scope of scope
| Cell of cell
A scope item can be either a subscope, a cell, or a property.

Scope Manipulation


val create_root_scope : string -> scope
Creates a root scope and global netlist.
val create_sub_scope : scope -> string -> string -> scope
Creates a sub scope.
val parent_of_scope : scope -> scope
Returns the parent of a scope. If the scope is root, it returns itself.
val root_of_scope : scope -> scope
Returns the root scope.
val items_of_scope : scope -> item list
Returns the items of a scope.
val all_cells : scope -> cell list
Returns a list of all cells.
val module_name_of_scope : scope -> string
Returns the module name of a scope.
val instance_name_of_scope : scope -> string
Returns the module name of a scope.
val scope_of_cell : cell -> scope
Returns the enclosing scope of a cell.
val path_of_scope : scope -> string list
Retuns the hierarchical scope path of a scope.
val path_of_cell : cell -> string list
Retuns the hierarchical scope path of a cell.

Cell Manipulation


val info_of_cell : cell -> cell_info
Returns cell information.
val name_of_cell : cell -> string
String name of cell.
val width_of_cell : cell -> int
Output width of a cell.
val width_of_port : port -> int
Input width of a cell port.
val arity_of_cell : cell -> int
The number of input ports of a cell.
val is_port_dangling : port -> bool
Checks if port is dangling.
val is_cell_producer : cell -> bool
Checks if cell is a valid producer, i.e., not a dangle, output, or a name.
val id_of_cell : cell -> int
Cell id of cell.
val cell_of_port : port -> cell
Cell of port.
val ports_of_cell : cell -> port list
Ports of a cell.
val port_of_cell : cell -> int -> port
One port of a cell.
val connect : cell -> port -> unit
Connects a cell to a port. Port must be dangling prior to connection.
val reconnect : cell -> port -> unit
Reconnects a cell to a port.
val consumers_of_cell : cell -> port list
Consuming ports of a cell.
val producer_of_port : port -> cell
Producing cell of port.

Cell Creation


val dangle : scope -> cell
The special cell that represents unconnected inputs.
val create_input : scope -> string -> int -> cell
Creates a new input cell.
val create_output : scope -> string -> int -> cell * port
Creates a new output cell.
val create_name : scope -> string -> int -> cell * port
Creates a new signal name cell.
val create_const : scope -> string -> cell
Creates a constant cell.
val create_buf : scope -> int -> cell * port
Creates a buffer cell.
val create_not : scope -> int -> cell * port
Creates a NOT gate.
val create_and : scope -> int -> cell * port * port
Creates a AND gate.
val create_xor : scope -> int -> cell * port * port
Creates a XOR gate.
val create_or : scope -> int -> cell * port * port
Creates a OR gate.
val create_concat : scope -> int -> int -> cell * port * port
Creates a concatenation.
val create_select : scope -> int -> int -> cell * port
Creates a bit selection.
val create_eq : scope -> int -> cell * port * port
Creates a equal comparison.
val create_lt : scope -> int -> cell * port * port
Creates a less than comparison.
val create_add : scope -> int -> cell * port * port
Creates an adder.
val create_sub : scope -> int -> cell * port * port
Creates a subtractor.
val create_mul : scope -> int -> cell * port * port
Creates a multiplier.
val create_mux : scope ->
int -> cell * port * port * port
Creates a mux.
val create_ff : scope -> int -> cell * port * port
Creates an ff.
val create_ffc : scope ->
int -> cell * port * port * port
Creates an ffc.
val create_bbox : scope ->
string -> int -> int -> int list -> cell * port
Creates an black box.