Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Modules are added to subsystems one at a time using the function

add_module(SYS, MOD)

The first argument is the subsystem while the second argument is the module (or subsystem) to add.  Once a module is added to a subsystem, it appears as a field within the object SYS.  The name of the field is determined by the module's name.  Modules can be added to subsystems in any order.  The run-time execution order is determined by the routing algorithm.

As modules are added to the subsystem, they are appended to the .module field.  You can use standard MATLAB programming syntax to access this information.  For example, to determine the number of modules in a subsystem:

count=length(SYS.module);

Or, to print out the names of all of the modules in a subsystem:

Code Block
for i=1:length(SYS.module)

...


      fprintf(1, '%s\n', SYS.module{i}.name);

...


end

connect.m

Creates a connection between two pins in a subsystem.  The general form is:

connect(SYS, SRCPIN, DSTPIN);

where SRCPIN and DSTPIN specify the source and destination pins, respectively.  Pins are specified as strings to the connect.m command using the syntax:

moduleName.pinName

Consider the system shown below and contained within multiplexor_example.m.

...

To connect the output of the sine generator1 to the second input of the multiplexor, use the command:

connect(SYS, 'sine1.out', 'mult.in2');

The module names "sine1" and "mult" are obvious because they were specified when the modules were created.  The pins names may not be obvious since they appear within the module's constructor function.  To determine the names of a module's pins, you can either utilize the detailed help function awe_help (recommended)

awe_help multiplexor_smoothed_module

...

or have MATLAB draw the module

Code Block
M=multiplexor_smoothed_module('foo');

...


draw(M)

...

Several short cuts shortcuts exists to simplify use of the connect.m command.: 

  • If the module has only a single input or output pin, then you need only specify the module name; the pin name is assumed.  Since the sine wave generator module in the multiplexor example has only a single output pin, the example above reduces to:
    connect(SYS, 'sine1', 'mult.in2');

  • Inputs and outputs to the subsystem are specified by the empty string.  Thus,
    connect(SYS, '', 'mult.in1');
    connects the input of the system to the first input of the multiplexor.  Similarly,
    connect(SYS, 'mult', '');
    connects the output of the multiplexor to the output of the system.

  • By default, the connect command performs rudimentary error checking.  The function verifies that the named modules and pins exist within the subsystem.  At build time, however, exhaustive checking of all connections is done.  Audio Weaver verifies that all connections are made to compatible input and output pins (using the range information within the pin type).  You can enable this exhaustive checking when a connection is made by supplying a 4th argument:
    connect(SYS, 'mult', '', 1)
    This is useful when debugging wiring failures that are revealed at build time.

Output pins are permitted to fan out to an arbitrary number of input pins.  Input pins, however, can only have a single connection.

Audio Weaver is set up to handle several special cases of connections at build time.  First, if an input pin has no connections, Audio Weaver inserts a source module and connects it to the unconnected input.  Either a source_module.m (float) or source_fract32_module.m is added based on the first input to the system [3](Audio Weaver is guessing at the type of pin that needs to be connected).  If a module has an output pin without a connection, Audio Weaver inserts a sink module based on the data type of the unconnected pin[4]pin. This is always correct since the pin type is inherited from the module's output pin.

Code Block
sink_module.m                  Floating-point data

...


sink_fract32_module.m          Fixed-point data

...

=
sink_int_module.m              Integer data

If the subsystem has a direct connection from an input pin to an output pin, then a copier_module is inserted.  If a module output fans out to N outputs of the subsystem, then N-1 copier modules are inserted[5]. This is required since each output of the subsystem is stored in a separate buffer.

get_variable.m and set_variable.m
Anchor
get_variable.mandset_variable.m
get_variable.mandset_variable.m

Extract and assign individual @awe_variable objects within an audio module.  This is needed because of the object-oriented nature of the Audio Weaver interface.  When accessing a variable "var" within a module "M", as in:

M.var

Audio Weaver returns the value of the variable, not the variable object itself.  If you wish to gain access to the actual variable object, use the call:

V=get_variable(M, NAME)

where:

  • M — the @awe_module object.

  • NAME — a string specifying the name of the variable.

The function returns an @awe_variable object.  For example, the following code gets the underlying @awe_variable object for the "gain" variable of a smoothed scaler module:

Code Block
M=scaler_smoothed_module('scaler');

...


V=get_variable(M, 'gain');

Similary, the set_variable.m command can be used to replace an existing variable with a given @awe_variable object.  "Replace" is used because the variable must already exist within the audio module.  The syntax for this command is:

M=set_variable(M, NAME, VAR)

where:

  • M — the @awe_module object.

  • NAME — a string specifying the name of the variable.

  • VAR - @awe_variable object.

The get_variable.m and set_variable.m functions are rarely used in practice.  You can always access the internal fields of a @awe_variable object even when it is part of an audio module.  For example, to access the "range" field of the variable "gain", use:

range=M.gain.range;

Note: get_variable.m and set_variable.m also apply to @awe_subsystem objects.

Module for AWE Designer

This section focus on the module browser information related to AWE Designer. Every module must initialize the moduleBrowser and shapeInfo structure of the MATLAB module object. Below is the example settings of downsampler_example_module.m module. Refer the section 3.2 for complete information of these structures.

...