previous up next index
Previous: Passing of Parameters to Software Functions Up: Parameter Passing Next: Tokens

Passing of Parameters to Hardware Functions

There are two candidate mechanisms for implementing parameter passing for function implemented solely in hardware. One is to provide a software function for each standalone hardware function, which does any necessary pre-processing of the input parameters and writes them to the memory-mapped hardware configuration registers. The other is to provide a structure defining the mapping between parameters and hardware configuration registers, and use a generic loader to interpret the mapping in the context of a particular set of parameters.

While I believe the flexibility of the former is a deciding factor, I am testing the latter in this implementation. If it works, it will be easy to build self-configuring special purpose processors.

The loading of the hardware configuration registers takes place before beginning execution of the software component of a function. The software function will receive the function parameter list already used for loading hardware registers.

The parameter_map structure defines the mapping between parameters and hardware registers. It contains a list of write operations, each requiring an address and a pair of indices into the function parameters. In addition, tagged constants (using the same format as the parameters list) are stored in a constant pool, for storing hardware specific configuration values.

Using a Parameter Map to configure a function

The configuration register writes are to be performed sequentially, and are each described by three values:

A C version of the parameter_map structure is provided here:

#define MAX_PARAMETER_WRITES            64
#define PARAMETER_CONSTANT( constant )  (MAX_PARAMETER_WRITES + (constant))
#define PARAMETER_SCALAR                0xFFFE
#define PARAMETER_PASS_BY_NAME          0xFFFF

typedef struct parameter_write {
  unsigned long   address;   /* address to write  */
  unsigned short  index;     /* index of parameter to write */
  unsigned short  offset;    /* offset into aggregate parameters */
} parameter_write;

typedef struct parameter_map {
  int             num_writes;               /* number of register writes  */
  parameter_write write[ MAX_PARAMETER_WRITES ];  /* register write descs */
  parameter_t     constant[ 1 ];            /* common pool of constants   */
} parameter_map;


previous up next index
Previous: Passing of Parameters to Software Functions Up: Parameter Passing Next: Tokens

magiceight-web@media.mit.edu