NAME
SystemPerl - SystemPerl Lanugage Extension to SystemC
DESCRIPTION
SystemPerl is a version of the SystemC language. It is designed to expand text so that needless repitition in the language is minimized. By using sp_preproc
, SystemPerl files can be expanded into C++ files at compile time, or expanded in place to make them valid stand-alone SystemC files.
The concept of SystemPerl is based upon the AUTOS in the verilog-mode
package for Emacs, by the same author.
LANGUAGE
- #sp
-
#sp directives are recognized by SystemPerl to split up files and control preprocessing. Use of any #sp's forces use of SystemPerl preprocessing, and removes full SystemC compatibility.
- /*AUTOS*/
-
AUTOmatics provide a way of expanding interconnections, while potentially retaining fully compatible SystemC code. The preprocessor can edit the source code file directly, resulting in the source code having the expanded automatics.
Code with expanded AUTOs are fully valid SystemC code, and can be sent to anyone who does not even have system perl. Anyone with SystemPerl has the benefit of being able to automatically regenerate them, and saves coding time.
LANGUAGE REQUIREMENTS
SystemPerl requires the following coding conventions. These tokens are not changed in any way, but are simply required for SystemPerl to be able to derrive required information from the source code.
- SP_CELL (instname, refname)
-
SP_CELL instantiates the given module named refname as a instantiation called instname. The instname is also passed as a parameter to refname as a string.
- SC_MODULE (modulename)
-
Though a standard optional SystemC construct, SystemC requires use of the SC_MODULE macro when defining a module class. For example "struct mod1 : public sc_module" must instead be coded as "SC_MODULE(mod1)".
- SP_PIN (instname, portname, netname)
-
SP_PIN declares a connection of a instantation's port to the specified net.
EXPANSIONS
SystemPerl expands the following special tokens.
- __MODULE__
-
__MODULE__ is predefined to the name of the module, from the basename of the filename. This allows files to be more easily replicated, and to avoid obscure errors when the filename does not match the module name.
For example:
SC_MODULE (__MODULE__) { ...
- /*AUTOINST*/
-
AUTOINST connects any unreferenced ports for the current SP_CELL to signals named the same as the port name.
For example:
SC_MODULE(submod) { sc_in_clk clk; ...
SC_MODULE(mod) { SC_CTOR(mod) { SP_CELL (sub, submod); /*AUTOINST*/
Becomes:
SC_MODULE(mod) { SC_CTOR(mod) { SP_CELL (sub, submod); // Beginning of SystemPerl automatic instantiation pins SP_PIN (sub, clk, clk); // End of SystemPerl automatic instantiation pins
- /*AUTOSUBCELLS*/
-
AUTOSUBCELLS declares the submodules instantiated in SP_CELL declarations.
For example:
SC_MODULE(mod) { /*AUTOSUBCELLS*/ SC_CTOR(mod) { SP_CELL (sub, submod); SP_PIN (sub, a, a);
Becomes:
SC_MODULE(mod) { /*AUTOSUBCELLS*/ // Beginning of SystemPerl automatic subcells submod *sub; // End of SystemPerl automatic subcells
SC_CTOR(mod) { SP_CELL (sub, submod); SP_PIN (sub, a, a);
- /*AUTOSIGNAL*/
-
AUTOSIGNAL declares any signals used in SP_PIN connections that are not declared elsewhere.
For example:
SC_MODULE(mod) { /*AUTOSIGNAL*/ SC_CTOR(mod) { SP_CELL (sub, submod); SP_PIN (sub, a, a);
Becomes:
SC_MODULE(mod) { /*AUTOSUBCELLS*/ // Beginning of SystemPerl automatic signals sc_signal<bool> a; // For submod // End of SystemPerl automatic signals
SC_CTOR(mod) { SP_CELL (sub, submod); SP_PIN (sub, a, a);
- #sp interface
-
Interface specifies the following code should be moved into a the header file. This allows a common .sp file to contain both .h and .cpp information. SystemPerl automatically adds include guards in the header, to protect against multiple inclusion.
- #sp implementation
-
The Interface specifies the following code should be part of the cpp file. This allows a common .sp file to contain both .h and .cpp information.
SEE ALSO
sp_preproc
SystemC::Netlist
SystemC::Parser
DISTRIBUTION
The latest version is available from CPAN and from http://veripool.com/
.
AUTHORS
Wilson Snyder <wsnyder@wsnyder.org>