From 98cab31fc3659e33aef260efca55bf9f1753164c Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Mon, 11 Feb 2019 11:49:19 +0100 Subject: Add source files from Michael --- app/speedtest/1986/src/run down logic | 429 ++++++++++++++++++++++++++++++++++ 1 file changed, 429 insertions(+) create mode 100644 app/speedtest/1986/src/run down logic (limited to 'app/speedtest/1986/src/run down logic') diff --git a/app/speedtest/1986/src/run down logic b/app/speedtest/1986/src/run down logic new file mode 100644 index 0000000..49f0f0f --- /dev/null +++ b/app/speedtest/1986/src/run down logic @@ -0,0 +1,429 @@ +PACKET run down logic DEFINES for loop, + msec factor, + for corr, + while loop, + until loop, + if, + select, + proc, + proc one param int, + proc two param int : + + +(***************************************************************************) +(* *) +(* Autor: A. Steinmann Copyright (C): HRZ - Unibi *) +(* *) +(***************************************************************************) + + +INT VAR first int, + second int, + index ; + +REAL VAR for loop corr, + begin, + end, + int incr corr, + act result ; + +BOOL VAR is initialized :: FALSE, + situation :: TRUE ; + + + +PROC for loop (INT CONST frequency) : + + notice operation ("FOR LOOP") ; + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + END REP ; + end := clock (0) ; + + act result := end - begin ; + + for loop s (frequency) + +END PROC for loop ; + + + +PROC for loop s (INT CONST frequency) : + + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + END REP ; + end := clock (0) ; + + IF act result > end - begin + THEN act result := end - begin + FI ; + + for loop corr := act result * msec factor (frequency) ; + + notice result ("FOR REP",for loop corr) + +END PROC for loop s ; + + + +PROC initialize int incr corr (INT CONST frequency) : + + first int := 0 ; + second int := 1 ; + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + first int INCR second int + END REP ; + end := clock (0) ; + + act result := end - begin ; + + initialize int incr corr s (frequency) + +END PROC initialize int incr corr ; + + + +PROC initialize int incr corr s (INT CONST frequency) : + + first int := 0 ; + second int := 1 ; + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + first int INCR second int + END REP ; + end := clock (0) ; + + IF act result > end - begin + THEN act result := end - begin + FI ; + + int incr corr := act result * msec factor (frequency) - for corr ; + +END PROC initialize int incr corr s ; + + + +PROC while loop (INT CONST frequency) : + + IF NOT is initialized + THEN initialize int incr corr (frequency) + FI ; + + notice operation ("WHILE LOOP") ; + first int := 0 ; + second int := 1 ; + begin := clock (0) ; + WHILE first int < frequency + REP + first int INCR second int + END REP ; + end := clock (0) ; + + act result := end - begin ; + + while loop s (frequency) + +END PROC while loop ; + + + +PROC while loop s (INT CONST frequency) : + + first int := 0 ; + second int := 1 ; + begin := clock (0) ; + WHILE first int < frequency + REP + first int INCR second int + END REP ; + end := clock (0) ; + + IF act result > end - begin + THEN act result := end - begin + FI ; + + notice result ("WHILE REP", act result * msec factor (frequency) - int incr corr) ; + +END PROC while loop s ; + + + +PROC until loop (INT CONST frequency) : + + IF NOT is initialized + THEN initialize int incr corr (frequency) + FI ; + + notice operation ("UNTIL LOOP") ; + first int := 1 ; + second int := 1 ; + begin := clock (0) ; + REP + first int INCR second int + UNTIL first int > frequency + END REP ; + end := clock (0) ; + + act result := end - begin ; + + until loop s (frequency) + +END PROC until loop ; + + + +PROC until loop s (INT CONST frequency) : + + first int := 1 ; + second int := 1 ; + begin := clock (0) ; + REP + first int INCR second int + UNTIL first int > frequency + END REP ; + end := clock (0) ; + + IF act result > act result + THEN act result := end - begin + FI ; + + notice result("UNTIL REP", act result * msec factor (frequency) - int incr corr) + +END PROC until loop s ; + + + +PROC if (INT CONST frequency) : + + notice operation ("IF") ; + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + IF situation + THEN + FI + END REP ; + end := clock (0) ; + + act result := end - begin ; + + if s (frequency) + +END PROC if ; + + + +PROC if s (INT CONST frequency) : + + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + IF situation + THEN + FI + END REP ; + end := clock (0) ; + + IF act result > end - begin + THEN act result := end - begin + FI ; + + notice result ("IF", act result * msec factor (frequency) - for corr) ; + +END PROC if s ; + + + +PROC select (INT CONST frequency) : + + notice operation ("SELECT") ; + first int := 0 ; + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + SELECT first int OF + CASE 0 : + OTHERWISE + END SELECT + END REP ; + end := clock (0) ; + + act result := end - begin ; + + select s (frequency) + +END PROC select ; + + + +PROC select s (INT CONST frequency) : + + first int := 0 ; + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + SELECT first int OF + CASE 0 : + OTHERWISE + END SELECT + END REP ; + end := clock (0) ; + + IF act result > end - begin + THEN act result := end - begin + FI ; + + notice result ("SELECT", act result * msec factor (frequency) - for corr) ; + +END PROC select s ; + + + +PROC proc (INT CONST frequency) : + + notice operation ("PROC") ; + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + nilproc + END REP ; + end := clock (0) ; + + act result := end - begin ; + + proc s (frequency) + +END PROC proc ; + + + +PROC proc s (INT CONST frequency) : + + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + nilproc + END REP ; + end := clock (0) ; + + IF act result > end - begin + THEN act result := end - begin + FI ; + + notice result ("PROC", act result * msec factor (frequency) - for corr) ; + +END PROC proc s ; + + + +PROC proc one param int (INT CONST frequency) : + + notice operation ("PROC one param INT") ; + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + nilproc (first int) + END REP ; + end := clock (0) ; + + act result := end - begin ; + + proc one param int s (frequency) + +END PROC proc one param int ; + + + +PROC proc one param int s (INT CONST frequency) : + + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + nilproc (first int) + END REP ; + end := clock (0) ; + + IF act result > end - begin + THEN act result := end - begin + FI ; + + notice result ("PROC (INT)", act result * msec factor (frequency) - for corr) ; + +END PROC proc one param int s ; + + + +PROC proc two param int (INT CONST frequency) : + + notice operation ("PROC two param INT") ; + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + nilproc (first int, second int) + END REP ; + end := clock (0) ; + + act result := end - begin ; + + proc two param int s (frequency) + +END PROC proc two param int ; + + + +PROC proc two param int s (INT CONST frequency) : + + begin := clock (0) ; + FOR index FROM 1 UPTO frequency + REP + nilproc (first int, second int) + END REP ; + end := clock (0) ; + + IF act result > end - begin + THEN act result := end - begin + FI ; + + notice result ("PROC (INT, INT)", act result * msec factor (frequency) - for corr) ; + +END PROC proc two param int s ; + + + +PROC nilproc : +END PROC nilproc ; + + + +PROC nilproc (INT CONST number one) : +END PROC nilproc ; + + + +PROC nilproc (INT CONST number one, number two) : +END PROC nilproc ; + + + +REAL PROC for corr : + + for loop corr + +END PROC for corr ; + + + +REAL PROC msec factor (INT CONST frequency) : + + 1000.0 / real (frequency) + +END PROC msec factor ; + + +END PACKET run down logic ; -- cgit v1.2.3