Module genie
Global functions and classes provided natively by the GENIE executable.
The contents of this package come pre-loaded into the global environment in a table called 'genie'.
-
get_object (name)
-
Get a reference to a GENIE object by hierarchical name.
Parameters:
- name
string
absolute path of object
Returns:
string
reference to the object
Raises:
error if object not found
-
get_objects ()
-
Get all immediate children of the root (all System and Node prototypes)
Returns:
table(string,HierObject)
child objects keyed by name
-
get_systems ()
-
Get all Systems.
Returns:
table(string,System)
Systems keyed by name
-
make_exclusive (links)
-
Marks a set of RS Links as temporally exclusive
Parameters:
- links
array(Link) or Set(Link)
Array or Set of RS Links
-
clog2 (x)
-
Ceiling of log base 2
Parameters:
- x
number
Unsigned integer
Returns:
number
-
HierObject:get_name ()
-
Get the object's name
Returns:
string
name
-
HierObject:get_hier_path ([get])
-
Get the object's absolute path.
Parameters:
- get
HierObject
path relative to this parent, rather than the root
(optional)
Returns:
string
path
-
HierObject:get_parent ()
-
Get the object's parent.
Returns:
HierObject
handle to parent object or nil if called on the hierarchy root
-
HierObject:get_child (name)
-
Get a child object by name.
Parameters:
- name
string
hierarchical path to child object, relative to this object
Returns:
HierObject
handle of the child object
Raises:
error if object does not exist
-
HierObject:get_children ()
-
Returns all immediate children
Returns:
table(string,HierObject)
child objects keyed by name
-
HierObject:__tostring ()
-
Lua metafunction for converting to string.
Calls HierObject:get_hier_path.
Returns:
string
See also:
Represents a Verilog module or its instance.
Inherits from:
HierObject.
Direct superclass of:
System.
-
Node:new (name, modname)
-
Constructor.
Creates a blank Node and registers it with GENIE.
It's static and called with genie.Node.new(...)
Parameters:
Returns:
Node
new instance
-
Node:add_port (name, type, dir)
-
Creates a new Port within the Node.
Parameters:
Returns:
Port
-
Node:def_param (parameter[, value])
-
Defines and/or sets a parameter.
A parameter can be defined without providing a value. One can be provided later
with a second call.
Parameters:
- parameter
string
name
- value
string or number
value
(optional)
Raises:
error if parameter already defined, or bad value expression
-
Node:get_ports ()
-
Get all Ports.
Returns:
array(Port)
-
Node:get_port (name)
-
Get Port by name.
Parameters:
Returns:
Port
-
System:new (name)
-
Constructor.
Creates a new System and registers it with GENIE. Call using genie.System.new(...)
Parameters:
Returns:
System
-
System:add_node (name, prototype)
-
Instantiates a Node within this System.
Parameters:
- name
string
instance name
- prototype
string or Node
absolute hierarchy path or handle of Node to instantiate
Returns:
Node
the new instance
-
System:add_split (name)
-
Create a Split Node.
Should only be called within Topology Functions.
Parameters:
Returns:
Node
-
System:add_merge (name)
-
Create a Merge Node.
Should only be called within Topology Functions.
Parameters:
Returns:
Node
-
System:add_buffer (name)
-
Create a Buffer Node.
Should only be called within Topology Functions.
Parameters:
Returns:
Node
-
System:splice_node (link, obj)
-
Splices a Node instance into the middle of an existing Link.
The Node must already be an instance within a System.
The Node must have a single input and single output Port of the same network type
as the original Link. Post-splice, the original Link will terminate at the input
Port of the provided object, and a new Link will be created from its output Port
and terminate wherever the original Link did.
Parameters:
- link
Link
the original Link to splice
- obj
string or Node
absolute hierarchy path or handle to the Node instance
Returns:
Link
the new second Link
-
System:add_link (source, sink[, type])
-
Creates a new Link.
Creates a new Link between a source and a sink. The network type
is automatically deduced by default, but can be explicitly specified too.
Parameters:
Returns:
Link
-
System:get_links ([src[, sink[, type]]])
-
Gets the System's Links.
Comes in four varieties:
(no args) - returns every link of every type
(nettype) - returns every link of the given type
(src, sink) - returns all links between src and sink of every nettype
(src, sink, nettype) - returns all links between src and sink of given nettype
Parameters:
Returns:
table
array of Link
-
System:make_export (port, name)
-
Exports a Port of a Node instance within the System.
Automatically creates a Link between the original and exported Port.
Parameters:
Returns:
exported Port
-
System:create_latency_query (link, parmname)
-
Creates an RS latency query.
Creates a new System parameter containing the latency of the specified RS Link.
Parameters:
- link
Link
the RS Link to query
- parmname
string
the name of the parameter to create
-
System:get_untopo_rs_links ()
-
Returns un-topologized RS Links.
Returns all RS links whose source and sink Ports lack
Topology connections.
Useful for writing topology functions.
Returns:
array(Link)
-
System:get_nodes ()
-
Get all contained Nodes.
Returns:
array(Node)
-
System:get_object (name)
-
Alias for HierObject:get_child.
Parameters:
Returns:
HierObject
See also:
-
System:get_objects ()
-
Alias for HierObject:get_children.
Returns:
array(HierObject)
See also:
-
System:get_ports ()
-
Get all Ports.
These are the Ports that connect the System to the outside. This is consistent with a System actually
being a Node that can be instantiated elsewhere.
Returns:
array(Port)
-
Link:get_src ()
-
Get source object
Returns:
Port or nil
-
Link:get_sink ()
-
Get sink object
Returns:
Port or nil
-
Link:__tostring ()
-
Lua metafunction for converting to string.
Returns a useful string in the form:
source -> sink (nettype)
Returns:
string
-
Link:add_parent (link)
-
Add parent Link.
The other Link will become one of this Link's parents.
This Link will automatically be added as one of the other Link's children.
Parameters:
Returns:
Link
parent Link
-
Link:add_child (link)
-
Add child Link.
The other Link will become one of this Link's children.
This Link will automatically be added as one of the other Link's parents.
Parameters:
Returns:
Link
child Link
-
Link:get_children (type)
-
Get all direct and indirect child Links.
Considers children and children's children and so on, finding all Links of a given network type.
Parameters:
Returns:
array(Link)
-
Link:get_parents (type)
-
Get all direct and indirect parent Links.
Considers parents and parents' parents and so on, finding all Links of a given network type.
Parameters:
Returns:
array(Link)
Endpoint for communication. Is owned by a
Node. Associates a subset of the
Node's Verilog module's ports
with a single communication-related role (clock sink, Routed Streaming source, etc).
Inherits from:
HierObject.
Direct superclass of:
RSPort.
-
Port:add_signal (role[, tag], name, width)
-
Associate a Verilog input/output port with the Port.
The allowable roles depend on this Port's type. The direction of the signal is implied by the Port's
direction and the signal's role. For some roles, many signals can be added to a Port with the same role, and
require further differentiation via a string tag parameter. The signal width may contain an expression and
reference parameters.
Parameters:
- role
string
the signal's role
- tag
string
a user-defined tag unique among this Port's other signals of the same role
(optional)
- name
string
the name of the input/output port in the Verilog module
- width
string or number
signal width in bits
-
Port:get_type ()
-
Get network type.
Returns:
string
network type
-
Port:get_dir ()
-
Get direction.
Returns:
string
port direction
-
Port:get_links ([type])
-
Get connected Links.
Optionally filters by network type.
Parameters:
- type
string
network type
(optional)
Returns:
array(Link)
A Routed Streaming Port.
Can have Linkpoints. Created and returned by
Node:add_port when given a network type of
rs
.
Subclass of
Port.
-
RSPort:add_linkpoint (name, id, type)
-
Defines a new Linkpoint.
Only
broadcast
linkpoints are currently supported.
Parameters:
- name
string
Linkpoint's name, unique within this RSPort
- id
string
Linkpoint ID, specified in Verilog constant notation (eg. 3'b101)
- type
string
must be
broadcast
for now
Returns:
RSLinkpoint
-
RSPort:get_rs_port ()
-
Returns itself.
RS Links may terminate at either RSPorts or RSLinkpoints. It is useful to be able to obtain a handle
to the physical RSPort that an RS Link is connected to, by calling this function.
Returns:
RSPort
self
A named sub-entity residing within an
RSPort. Can be a source or sink for RS
Links.
Inherits from:
Port.
-
RSLinkpoint:get_topo_port ()
-
Get parent RSPort's associated Topology Port.
Returns:
Port
-
RSLinkpoint:get_rs_port ()
-
Get parent RSPort.
RS Links may terminate at either RSPorts or RSLinkpoints. It is useful to be able to obtain a handle
to the physical RSPort that an RS Link is connected to, by calling this function.
Returns:
RSPort
parent