LFO Setup Instruction Format
The DRE has four low frequency oscillators (LFOs) which must be set up before use.
These instructions may occur anywhere in the assembly file.
To set the parameters (amplitude, frequency, and waveshape), use the LFO Setup Instruction, formatted as follows:
LFOn WAVESHAPE AMP=a FREQ=f [XFAD=x] [; COMMENTS]
Note: Square brackets “[“ and “]” denote optional fields.
Select LFOs 0-3 by setting n.
WAVESHAPE can be either "SIN" for sinusoid, "TRI" for triangle wave, or "SAW" for sawtooth.
The AMPlitude coefficient is a 15-bit unsigned number (a range of 0-32767 or $0-$7FFF), and gives a waveform amplitude of ±AMP/8 samples.
The FREQuency coefficient is a 13-bit unsigned number (a range of 0-8191 or $0-$1FFF).
XFAD selects the crossfade shape to use for pitch transposition algorithms. This setting is only valid when the waveshape is set to SAW. Valid crossfade settings are: 1, 1/2, 1/8, 1/16.
To calculate the frequency produced by the oscillators, use the following formula.
F(Sinusoids) = (f/M) Fs/(2p)
where
f = 13-bit frequency coefficient FREQ,
Fs = Sample rate,
M = 262143 (0x3FFFF, internal maximum 18 bit value).
For a sample rate of 48kHz, F(Sinusoids) = 0.029142 f
F(Triangles) = (f/M) Fs (C/4H)
where
f = 13-bit frequency coefficient FREQ,
Fs = Sample rate,
C = 4194304 (0x400000, a constant used internally in the LFO),
M = 262143 (0x3FFFF, internal maximum 18-bit value),
H = 8388607 (0x7FFFFF, maximum positive 24-bit value).
For a sample rate of 48kHz, F(Triangles) = 0.022888 f
F(Sawtooths) = 2 F(Triangles)
For a sample rate of 48kHz, F(Triangles) = 0. 045777 f
For example:
LFO0 SIN AMP=0x3FFF FREQ=0x200 ; 14.9Hz, 1/2 amplitude sine
LFO1 TRI AMP=10000 FREQ=3000 ; 68.7Hz triangle
LFO2 SAW AMP=$400 FREQ=512 XFAD=1/8 ; 11.7Hz, 1/32 amplitude saw
Multiply/Accumulate Instruction Format
The Multiply/Accumulate (MAC) Instruction format is generally as follows:
[CHRn] OPCODE ADDRESS [[K=]COEFFICIENT|CHORUS CONTROLS] [; COMMENTS]
Note: Square brackets “[“ and “]” denote optional fields.
CHRn selects a chorus instruction, and the n selects the associated LFO to drive the instruction.
The ADDRESS specifies an I/O (address 0 is the left channel, address 1 is the right), a relative Data RAM address, or a memory label.
The COEFFICIENT specifies the multiplier value, and if omitted, is assumed to be 0.
CHORUS CONTROLS are an unordered list of parameters which activate certain functions for a chorus instruction.
The following opcode mnemonics control the basic functions of the MAC.
It defines a read or write operation, and selects which register (none, Acc, B, or C) is added to the multiplier output.
Register B can store the current instruction’s multiplicand, and register C can store the same value as Acc.
Read Instructions
For read operations, Product = K*[ADDRESS], so register B stores either the Left Input, Right Input, or the Data RAM value specified by the address or label.
RZP Read, Acc = Zero + Product
RAP Read, Acc = Acc + Product
RBP Read, Acc = B Register + Product
RCP Read, Acc = C Register + Product
RZPB Read, Acc = Zero + Product, Load B register
RAPB Read, Acc = Acc + Product, Load B register
RBPB Read, Acc = B Register + Product, Load B register
RCPB Read, Acc = C Register + Product, Load B register
RZPC Read, Acc = Zero + Product, Load C register
RAPC Read, Acc = Acc + Product, Load C register
RBPC Read, Acc = B Register + Product, Load C register
RCPC Read, Acc = C Register + Product, Load C register
RZPBC Read, Acc = Zero + Product, Load B and C registers
RAPBC Read, Acc = Acc + Product, Load B and C registers
RBPBC Read, Acc = B Register + Product, Load B and C registers
RCPBC Read, Acc = C Register + Product, Load B and C registers
Write Instructions
For write operations, Product = k*Acc, so register B stores the Acc value from the last tick. Writes to memory stores the result of the previous instruction, while writes to outputs transfers
the result of the current instruction.
WZP Write, Acc = Zero + Product
WAP Write, Acc = Acc + Product
WBP Write, Acc = B Register + Product
WCP Write, Acc = C Register + Product
WZPB Write, Acc = Zero + Product, Load B register
WAPB Write, Acc = Acc + Product, Load B register
WBPB Write, Acc = B Register + Product, Load B register
WCPB Write, Acc = C Register + Product, Load B register
WZPC Write, Acc = Zero + Product, Load C register
WAPC Write, Acc = Acc + Product, Load C register
WBPC Write, Acc = B Register + Product, Load C register
WCPC Write, Acc = C Register + Product, Load C register
WZPBC Write, Acc = Zero + Product, Load B and C registers
WAPBC Write, Acc = Acc + Product, Load B and C registers
WBPBC Write, Acc = B Register + Product, Load B and C registers
WCPBC Write, Acc = C Register + Product, Load B and C registers
For example:
RZP delay” K=.500 ; Read (middle of delay)/2 into Acc
WAP delay+125 192 ; Write to 125th delay tap, Acc = -0.5*Acc
RAPB delay' K=128 ; Acc = -1*(end of delay)+Acc, B = end of delay
WBPC delay’-1 ; Write to next-to-last delay tap, Acc & C = B + 0*Acc
RCP ADCL K=0x7F ; Read ~1*(Left Input) into Acc and C
WCPB OUTR K=-0x40 ; B=Acc, write C-0.5*Acc into Right Output and Acc
Chorus Controls
These statements define instructions as chorus commands.
They redefine the coefficient bits to alternate meanings, and thus the lack of coefficients in chorus instructions.
Two adjacent commands are used to create chorusing, in order to interpolate to the exact fraction of a sample between two (integer) samples.
The Chorus Controls consist of the following parameters:
[+SIN|-SIN|+COS|-COS] [COMPK] [COMPA] [MASKA] [LATCH] [COMPS]
+SIN Use +sine output of selected LFO.
-SIN Use -sine output of selected LFO.
+COS Use +cosine output of selected LFO.
-COS Use -cosine output of selected LFO.
The LFOs each have four taps: a ±sine output and a ±cosine output.
The parameters described above indicate which tap to use.
If this parameter is omitted, the default value used is +SIN. The sign is mandatory, "SIN" will be flagged as an error and prevent assembly.
COMPK One's complement the chorus interpolation coefficient.
The LFO output is split into two parts: an offset address and an interpolation coefficient.
The offset address is sent to the address generator for the Data RAM, and is not accessible to the user.
The interpolation coefficient should be applied to the value at the specified address, the 1's complement of the coefficient then applied to the value at address+1.
The COMPK parameter will perform a one's complement on the coefficient.
COMPA One's complement the chorus interpolation address.
This parameter will perform a one's complement on the chorus interpolation address, effectively shifting the phase of the chorus waveform by 180°.
Specifying COMPA with +SIN is equal to specifying -SIN. In fact -SIN or -COS sets the same bit as COMPA.
This statement is implemented for use in pitch transposition for increasing source code clarity. Proper use of the LFO output statements will make this command superfluous.
MASKA Mask chorus generator offset address, select the crossfade coefficient.
When the two interpolations required by pitch transposition are complete, they must be read back from memory and summed using the crossfade coefficient.
In a chorus command, the address generator will want to add the chorus offset address when generating the absolute address.
This can be overridden with the MASKA parameter so that the offset is masked off,
and the address read from is as specified in the instruction. This parameter also indicates that the crossfade coefficients selected by the LFO Setup Instruction be used.
LATCH Latch the data from selected LFO.
When pairs of chorus commands are implemented, the LFO data must be latched; otherwise, the LFO could change during the execution of the commands, and unpredictable results could occur.
This is required on the first chorus command, but must be omitted from the second.
COMPS One's complement the sign bit of the chorus offset address.
This parameter will perform a one's complement of the sign bit of the chorus offset address.
This is a leftover from a previous ASIC revision and is included here for informational purposes.
For example:
CHR0 RZP mem -COS COMPK LATCH ; Read fractional -COS chorus of mem
CHR0 RAP mem+1 -COS ; Sum with fractional of 2nd address
CHR1 RZP stor1 COMPK MASKA LATCH ; Read fractional crossfade of stor1
CHR1 RAP stor2 MASKA ; Sum with fractional crossfade of stor2
you can find more datail here:
http://www.wavefrontsemi.com/index.php?id=11,14,0,0,1,0
and in the attached documents...