F004 Scopes and numerical data

A Scope is an organisational element (like a folder, module, subsystem, processes,..) to group signals.

Data types

  Integer Float  
Java
  • int (byte,short)
  • long
  • BigInteger
  • float
  • double
  • BigDecimal
 
c
  • signed*/unsigned*
  • any size

+ size and signed parameter

  • float*
  • double*

+ size parameter

 
Python
  • int
  • long
  • float
 
TypeScript
  • number
  • number
 
JavaScript
  • number
  • number
 

 

Adding Scopes

The method flxAddScope/addScope adds a scope item to the trace. Scopes shall be used to organize large amounts of signals. The arguments are:

  • the trace object (c-language only),
  • itemId for the scope,
  • parentId, here 0 for the root scope,
  • a name,
  • and a description
  • Java

            // add integer signals
            trace.addScope( 1, 0, "Integers", "Scope Description");
            trace.addSignal( 2, 1, "0-255", "Signal Description", Flx.TYPE_INTEGER, null);
            trace.addSignal( 3, 1, "-10000-40000", "Signal Description", Flx.TYPE_INTEGER, null);
            trace.addSignal( 4, 1, "0-64535", "Signal Description", Flx.TYPE_INTEGER, null);
            trace.addSignal( 5, 1, "0-50000^2", null, Flx.TYPE_INTEGER, null);
    
            // add float signals
            trace.addScope( 11, 0, "Floats", "another Scope");
            trace.addSignal( 12, 11, "a double", null, Flx.TYPE_FLOAT, null);
            trace.addSignal( 13, 11, "another double", null, Flx.TYPE_FLOAT, null);
    
  • C/C++

    		// add integer signals
    		flxAddScope(trace, 1, 0, "Integers", "Scope Description");
    		flxAddSignal(trace, 2, 1, "0-255", "Signal Description", FLX_TYPE_INTEGER, 0);
    		flxAddSignal(trace, 3, 1, "-10000-40000", "Signal Description", FLX_TYPE_INTEGER, 0);
    		flxAddSignal(trace, 4, 1, "0-64535", "Signal Description", FLX_TYPE_INTEGER, 0);
    		flxAddSignal(trace, 5, 1, "0-50000^2", 0 /* no description*/, FLX_TYPE_INTEGER, 0);
    
    		// add float signals
    		flxAddScope(trace, 11, 0, "Floats", "another Scope");
    		flxAddSignal(trace, 12, 11, "a double", 0, FLX_TYPE_FLOAT, 0);
    		flxAddSignal(trace, 13, 11, "another double", 0, FLX_TYPE_FLOAT, 0);
    
    
  • Python

            # add integer signals
            trace.addScope( 1, 0, "Integers", "Scope Description");
            trace.addSignal( 2, 1, "0-255", "Signal Description", Flx.TYPE_INTEGER, None);
            trace.addSignal( 3, 1, "-10000-40000", "Signal Description", Flx.TYPE_INTEGER, None);
            trace.addSignal( 4, 1, "0-64535", "Signal Description", Flx.TYPE_INTEGER, None);
            trace.addSignal( 5, 1, "0-50000^2", None, Flx.TYPE_INTEGER, None);
    
            # add signals
            trace.addScope( 11, 0, "Floats", "another Scope");
            trace.addSignal( 12, 11, "a double", None, Flx.TYPE_FLOAT, None);
            trace.addSignal( 13, 11, "another double", None, Flx.TYPE_FLOAT, None);
    
  • TypeScript

            // add integer signals
            trace.addScope(1, 0, "Integers", "Scope Description");
            trace.addSignal(2, 1, "0-255", "Signal Description", Flx.TYPE_INTEGER, null);
            trace.addSignal(3, 1, "-10000-40000", "Signal Description", Flx.TYPE_INTEGER, null);
            trace.addSignal(4, 1, "0-64535", "Signal Description", Flx.TYPE_INTEGER, null);
            trace.addSignal(5, 1, "0-50000^2", null, Flx.TYPE_INTEGER, null);
            
            // add float signals
            trace.addScope(11, 0, "Floats", "another Scope");
            trace.addSignal(12, 11, "a double", null, Flx.TYPE_FLOAT, null);
            trace.addSignal(13, 11, "another double", null, Flx.TYPE_FLOAT, null);
        
  • JavaScript

        	// add integer signals
            trace.addScope(1, 0, "Integers", "Scope Description");
            trace.addSignal(2, 1, "0-255", "Signal Description", Flx_1.Flx.TYPE_INTEGER, null);
            trace.addSignal(3, 1, "-10000-40000", "Signal Description", Flx_1.Flx.TYPE_INTEGER, null);
            trace.addSignal(4, 1, "0-64535", "Signal Description", Flx_1.Flx.TYPE_INTEGER, null);
            trace.addSignal(5, 1, "0-50000^2", null, Flx_1.Flx.TYPE_INTEGER, null);
            
            // add float signals
            trace.addScope(11, 0, "Floats", "another Scope");
            trace.addSignal(12, 11, "a double", null, Flx_1.Flx.TYPE_FLOAT, null);
            trace.addSignal(13, 11, "another double", null, Flx_1.Flx.TYPE_FLOAT, null);
        

Writing numerical data

The standard parameters for writing data (flxWriteXXXAt/writeXXXAt) are:

  • the trace object (c-language only),
  • itemId of the signal,
  • the tag flag (samples can have a tag, e.g. error),
  • domain position,
  • isRelative flag (1: relative, 0:absolute),
  • the value,
  • plus optional arguments.

c-language

The actual size of a value (if it is a bytes or an 64 bit integer) is added as a separate parameter after the value pointer. For float signals, the size is limited to 4 (float) or 8(double), for integer it can be any size (size>=1).

The signed parameter in flxWriteIntAt/writeIntAt states if the pointer contains a signed or unsigned value.

// iterate over n

	// values
	unsigned char i0 = n % 8;
	int i1 = n;
	unsigned short i2 = n * 3;
	long long = n * n;
	float f1 = sin(n / 1000.);
	double f2 = cos(n / 100.);
    
	// write integer values of multiple types
	flxWriteIntAt(trace, 2, 0, n * 10, 0, &i0, sizeof(char), 0);
	flxWriteIntAt(trace, 3, 0, 0, 1, &i1, sizeof(int), 1);
	flxWriteIntAt(trace, 4, 0, 0, 1, &i2, sizeof(short), 0);
	flxWriteIntAt(trace, 5, 0, 0, 1, &i3, sizeof(long long), 1);

	// write float values of multiple types (5ns later)
	flxWriteFloatAt(trace, 12, 0, 5, 1, &f1, sizeof(float));
	flxWriteFloatAt(trace, 13, 0, 0, 1, &f2, sizeof(double));

Object-oriented languages

You just have to pass a numerical object to the writeIntAt nad writeFloatAt methods.

  • Java

            // values
            i0 = (short) (n % 255);
            i1 = n-10000;
            i2 = (n * 3) & 0xffff;
            i3 = 1l * n * n;
            f1 = ((n % 255) / 1000.d);
            f2 = ((n % 65535) / 100.d);               
            
            // write integer values
            trace.writeIntAt( 2, 0, current, false, i0);
            trace.writeIntAt( 3, 0, 0, true, i1);
            trace.writeIntAt( 4, 0, 0, true, i2);
            trace.writeIntAt( 5, 0, 0, true, i3);
    
            // write float values (5ns later)
            trace.writeFloatAt( 12, 0, 5, true, f1);
            trace.writeFloatAt( 13, 0, 0, true, f2);
    
  • Python

            # values
            i0 = (n % 255);
            i1 = n-10000;
            i2 = (n * 3) & 0xffff;
            i3 = 1l * n * n;
            f1 = ((n % 255) / 1000.);
            f2 = ((n % 65535) / 100.);               
            
            # write integer values
            trace.writeIntAt( 2, 0, current, False, i0);
            trace.writeIntAt( 3, 0, 0, True, i1);
            trace.writeIntAt( 4, 0, 0, True, i2);
            trace.writeIntAt( 5, 0, 0, True, i3);
    
            # write float values (5ns later)
            trace.writeFloatAt( 12, 0, 5, True, f1);
            trace.writeFloatAt( 13, 0, 0, True, f2);
    
  • TypeScript

            // values
            i0 = ((n % 255)|0);
            i1 = n - 10000;
            i2 = (n * 3) & 65535;
            i3 = 1 * n * n;
            f1 = ((n % 255) / 1000.0);
            f2 = ((n % 65535) / 100.0);
            
            // write integer values
            trace.writeIntAt(2, 0, current, false, i0);
            trace.writeIntAt(3, 0, 0, true, i1);
            trace.writeIntAt(4, 0, 0, true, i2);
            trace.writeIntAt(5, 0, 0, true, i3);
            
            // write float values  (5ns later)
            trace.writeFloatAt(12, 0, 5, true, f1);
            trace.writeFloatAt(13, 0, 0, true, f2);
        
  • JavaScript

            // values
            i0 = ((n % 255) | 0);
            i1 = n - 10000;
            i2 = (n * 3) & 65535;
            i3 = 1 * n * n;
            f1 = ((n % 255) / 1000.0);
            f2 = ((n % 65535) / 100.0);
            
            // write integer values
            trace.writeIntAt(2, 0, current, false, i0);
            trace.writeIntAt(3, 0, 0, true, i1);
            trace.writeIntAt(4, 0, 0, true, i2);
            trace.writeIntAt(5, 0, 0, true, i3);
            
            // write float values  (5ns later)
            trace.writeFloatAt(12, 0, 5, true, f1);
            trace.writeFloatAt(13, 0, 0, true, f2);
        
toem

technical software and tooling

Company

Contact Us

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