![]() |
|
|
Like Logic, Logic.Modules provides for the creation of technology-independent designs - they will work for any technology supported by JHDL. Logic.Modules does its work by simply calling appropriate combinations of Logic routines such as the add() routine in the example in the previous section. This has the advantage that designs done using only Logic and Logic.Modules are portable to any technology JHDL supports. The disadvantage of this is that Logic.Modules calls cannot take advantage of technology-specific FPGA features. Users will have to weigh the convenience of using a generic module from Logic.Modules against the speed/area penalty it may have over a technology-optmized version of the same function and the work associated with creating such a technology-optimized module.
import byucc.jhdl.Logic.Modules.*;
public upcnt(Node parent, Wire clr, Wire inc, Wire ld, Wire ldval, Wire q, String instanceName) {and can be directly instantiated using the new keyword like any other design. If you read the Logic.Modules package documentation you will see that this one constructor can create any one of 8 different counters (clearable, incrementable, loadable - there are 8 combinations of these features). To signify that you don't want the counter to have a clear function, you simply pass a null into the constructor in place of the clr wire. The constructor tests the parameters against null and thus can tell what kind of counter to generate.
The second second kind of class in Logic.Modules will have a name that is all uppercase such as COUNTERS. This is a class that contains only static methods for instancing various building blocks. Thus, instead of directly instantiating an upcnt object from above, you can call methods from COUNTERS to do that for you like this:
// Create an upcounter that is clearable and incrementable COUNTERS.Clr_UpCnt(this, clrSignal, incSignal, q); // Create an upcounter that is clearable and loadable (always // incrementing if not clearing or loading) COUNTERS.ClrLd_UpCnt(this, clrSignal, ldSignal, ldValue, q); // Create an upcounter that is clearable, incrementable, and loadable COUNTERS.ClrIncLd_UpCnt(this, clrSignal, incSignal, ldSignal, ldValue, q);Note that since these are static methods, they must be prefixed by the name of the class they are from (COUNTERS) and this must be passed as the parent node.
In the case of the up counter, there are at least eight such methods, each with a different name and slightly different set of parameters. Each such method simply instances an upcnt module by calling its constructor with null values for the appropriate parameters.
In addition to the COUNTERS class introduced above, there are a number of others as well. Each contains only static methods suitable for instancing various circuit modules contained in Logic.Modules. Consult the Logic.Modules API documentation for details on how to call the methods in these classes. To date, the following classes of static methods are available:
Finally, a sub-packages of Logic.Modules has been created, and it is anticipated that others may be in the future. The documentation will reflect that if it occurs. Currently, there is is a Logic.Modules.FloatingPoint package for all floating point modules. Consult the API documentation for details.
Don't reinvent the wheel! The chances are that some of the modules you need have already been designed and are in the Logic.Modules package. Be sure to consult its API documentation to see what is available in the package and take full advantage of it.
To alleviate this, a small set of technology-optimized module
generators have been created. These include delays, array
multipliers, and a few other items and are described in the next
section Level 4 - Technology-Specific Module
Generators.
| JHDL Home Page | Configurable Computing Lab | Prev (Logic Package) | Next (Module Generators) | |
JHDL 0.3.45
Copyright (c) 1998-2003 Brigham Young University. All rights reserved.
Last updated on 11 May 2006