Download Getting Started with LSE

Transcript
Chapter 5. Module Writing
When a port is declared to have a handler, resolution of any signal on any port instance of that port need not cause
an invocation of the phase function. However, any status change on the port WILL cause at least one invocation of
the corresponding handler.
Declaring Leaf Modules
To declare a leaf module, one still uses the module keyword. However, leaf modules always set the system
defined tar_file variable to specify where to find the code for the module. Leaf modules may not have
sub-instances. The tar file will be searched for on the module search path (the same path used to find lss files.)
The following listing shows all the parameters being set to a particular value and explains their function.
module modulename {
inport portname:type;
...
tar_file = filename;
portname.handler = TRUE; Ê
portname.independent = TRUE; Ë
...
phase = TRUE; Ì
phase_start = TRUE; Í
phase_end = TRUE; Î
reactive = FALSE; Ï
};
Ê
Flag that tells the LSE framework if this port has a corresponding handler.
Ë
Flag that tells the LSE framework if this port is independent.
Ì
Flag that specifies if instances have a phase function.
Î
Flag that specifies if instances have a phase_end function.
Í
Flag that specifies if instances have a phase_start function.
Ï
If TRUE, module instances only generate outputs in response to input changes.
Automatic Generation of Skeletons
LSE has a script called ls-create-module that will automatically create a skeleton for a module. Typing
ls-create-module -h will explain how to use the script.
This script will create create a directory and stub files for a new leaf module in the first directory specified in the
LIBERTY_SIM_USER_PATH (A colon separated list of places to find modules). The ls-build script will also
cause lss to search for modules in these directories.
36