Home

XS01 Script Production Example: Analyse Logic

Content outdated

We are in the process of migrating all content to impulse version 2.0.

In this example, the "1" phases are measured and written into an integer signal.


// input: an array of all input signals
// in0: primary input of type ISamplePointer,IReadableSamples
// in1..: additional inputs of type ISamplePointer,IReadableSamples
// out: output signal of type IIntegerSamplesWriter
// console: console output of type MessageConsoleStream
// iter: iterator of type ISamplesIterator
// progress: progess control of type  IScriptProgress

var start = -1;
progress.cont();
while ( iter.hasNext()) {
    var current <:Long:> = iter.next(out);
    if (!input[0].isNone()) {
        if (input[0].logicState() == STATE_1)
            start = current;
        if (input[0].logicState() == STATE_0 && start >= 0) {
            out.write(start, false, new java.lang.Long(current - start));
            start = -1;
        }
    }
}
// LOGIC STATES
//  Level 2 - 1 Bit
//  0: '0'    strong drive, logic zero
//  1: '1'    strong drive, logic one
//  Level 4 - 2 Bits
//  2: 'Z'    high impedance
//  3: 'X' strong drive, unknown logic value
//  Level 16 - 4 Bits
//  4: 'L' weak drive, logic zero
//  5: 'H'    weak drive, logic one
//  6: 'U' uninitialized
//  7: 'W' weak drive, unknown logic value
//  8: '-'    (STATE_D) don't care
//  9 - 14: 'J', 'K', 'M', 'N', 'O', 'P' to be defined by the user
About Signal Scripts Open JavaDoc Reference

Result


toem

technical software and tooling

Company

Contact Us

This email address is being protected from spambots. You need JavaScript enabled to view it.