I'm in the process of putting together SAOL programs designed to test opcode
behaviour in an effort to highlight some of the problems that I'm sure exist
between the various SAOL implementations. Although the new Corrigendum 1
specifications on opcode behaviour clarify the general approach, there are
still a few specific implementation question that need to be addressed that
relate to opcodes embedded in if and while statements, and oparrays.
I'm not particularly attached to any particular interpretation of the
standard; however, I think it would be a good thing if we could at least
ensure that existing SAOL compilers produce consistent results for a test
program that probes behaviour for at least the common cases. I'm also sure
that trying to put together a SAOL program to test for opcode behaviour will
serve as a useful framework for discussion of standards issues.
That being said, I got tied up very early in the process with a standards
question that I need to resolve before I get any further. Admittedly, it's a
pretty fundamental kind of question. Here goes:
Question 1: What does this instrument output?
instr TestInstrument() {
ivar iValue;
asig aVar1, aVar2;
iValue = 0;
aVar1 = iValue;
iValue = 1;
aVar2 = iValue;
output (aVar1, aVar2);
}
Question 2: What does this instrument output?
iopcode IValue(ivar val) {
return (val);
}
aopcode TestOpcode() {
ivar iValue;
asig aVar1, aVar2;
iValue = 0;
aVar1 = IValue(iValue);
iValue = 1;
aVar2 = IValue(iValue);
return (aVar1, aVar2);
}
instr TestInstr() {
output (TestOpcode());
}
(1) A stereo stream for which left values are equal to zero, and right
values are equal to one.
(2) A stereo stream for which left valuse and right values are both equal to
1.
(3) Other.
Answers for the Sfxx compiler:
Question 1: (1) Zero for the left channel, one for the right channel.
When evaluating the expression "aVar1 = iValue;", the statement is
determined to be a-rate. The i-rate variable iValue must be converted to
a-rate, and this is done by creating a temporary variable to save the
results of iValue until a-rate execution time. When executing "aVar2 =
iValue;" a separate temporary variable is created to hold the results of the
expression "iValue".
Although I have a hard time pointing to the place in the standard that
mandates this behaviour, for some reason it seems to have lodged in my mind
as an implied requirement, neccessary to ensure consistent behaviour of a
host of language features. I'm open to suggestions on standards sections or
interpretations that show this approach to be incorrect.
I'm guessing this isn't a majority interpretation.
Question 2: (1) Zero for the left channel, one for the right channel.
For much the same reasons. The return value if IValue(iValue) is saved to a
temporary variable for use at a-rate execution time.
This example is more interesting because it does appear to have direct
support in Corrigendum 1. The results of the IValue opcode calls are saved
for a-rate use on the first use of the opcode call in the opcode following
each k-cycle. (Or so the argument goes).
I'm guessing this is the correct behaviour, although I'd be grateful for
opinions.
Regards,
Robin.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
This archive was generated by hypermail 2b29 : Mon Jan 28 2002 - 12:11:07 EST