From 35ee55d31526f85d602e29238d27ca977bfcf2a7 Mon Sep 17 00:00:00 2001 From: Rene Hopf Date: Sat, 12 Sep 2026 18:42:17 +0200 Subject: [PATCH] change time pins to float --- docs/src/config/core-components.adoc | 8 ++-- docs/src/hal/basic-hal.adoc | 4 +- docs/src/hal/rtcomps.adoc | 8 ++-- docs/src/hal/tools.adoc | 2 +- docs/src/hal/tutorial.adoc | 26 +++++----- docs/src/man/man9/classicladder.9.adoc | 8 ++-- docs/src/man/man9/encoder.9.adoc | 4 +- docs/src/man/man9/motion.9.adoc | 16 +++---- .../gtk_mesa_tests/gtk_mesa_tests.glade | 21 ++++---- .../gtk_mesa_tests/gtk_mesa_tests.py | 13 ++--- scripts/hal-histogram | 4 +- src/hal/hal_lib.c | 31 ++++++------ src/hal/hal_priv.h | 8 ++-- src/hal/utils/halcmd_commands.cc | 9 ++-- src/hal/utils/halrmt.cc | 15 +++--- .../personalities_mod/4count_2pers.expected | 48 +++++++++---------- .../personalities_mod/4names_2pers.expected | 48 +++++++++---------- tests/halmodule.3/expected | 18 +++---- tests/threads.1/checkresult | 8 ++-- 19 files changed, 156 insertions(+), 143 deletions(-) diff --git a/docs/src/config/core-components.adoc b/docs/src/config/core-components.adoc index 9ea4b39098b..1794e289658 100644 --- a/docs/src/config/core-components.adoc +++ b/docs/src/config/core-components.adoc @@ -158,10 +158,10 @@ These pins, parameters, and functions are created by the realtime 'motmod' modul Many of these parameters serve as debugging aids, and are subject to change or removal at any time. -* 'motion-command-handler.time' - (s32, RO) -* 'motion-command-handler.tmax' - (s32, RW) -* 'motion-controller.time' - (s32, RO) -* 'motion-controller.tmax' - (s32, RW) +* 'motion-command-handler.time' - (float, RO) runtime in seconds +* 'motion-command-handler.tmax' - (float, RW) max runtime in seconds +* 'motion-controller.time' - (float, RO) runtime in seconds +* 'motion-controller.tmax' - (float, RW) max runtime in seconds * 'motion.debug-bit-0' - (bit, RO) This is used for debugging purposes. * 'motion.debug-bit-1' - (bit, RO) This is used for debugging purposes. * 'motion.debug-float-0' - (float, RO) This is used for debugging purposes. diff --git a/docs/src/hal/basic-hal.adoc b/docs/src/hal/basic-hal.adoc index 5cf2078d30b..d715f874842 100644 --- a/docs/src/hal/basic-hal.adoc +++ b/docs/src/hal/basic-hal.adoc @@ -377,8 +377,8 @@ One pin and two parameters are automatically added to each HAL component when it These allow you to scope the execution time of a component. [horizontal] -`.time`(((HAL time))):: Pin time shows in ns how long it took to execute the function. -`.tmax`(((HAL tmax))):: Parameter tmax is the maximum time in ns it took to execute the function. +`.time`(((HAL time))):: Pin time is a float showing in seconds how long it took to execute the function. +`.tmax`(((HAL tmax))):: Parameter tmax is a float holding the maximum time in seconds it took to execute the function. `.tmax-increased`(((HAL tmax-increased))):: This parameter is set to true for one cycle if tmax increased. `tmax` is a read/write parameter so the user can set it to 0 to get rid of the first time initialization on the function's execution time. diff --git a/docs/src/hal/rtcomps.adoc b/docs/src/hal/rtcomps.adoc index 66abd93f639..03f9af3dc74 100644 --- a/docs/src/hal/rtcomps.adoc +++ b/docs/src/hal/rtcomps.adoc @@ -357,10 +357,10 @@ halcmd: unloadrt encoder === Parameters -* `encoder.__.capture-position.time` (s32, RO) -* `encoder.__.capture-position.tmax` (s32, RW) -* `encoder.__.update-counters.time` (s32, RO) -* `encoder.__.update-counter.tmax` (s32, RW) +* `encoder.__.capture-position.time` (float, RO) runtime in seconds +* `encoder.__.capture-position.tmax` (float, RW) max runtime in seconds +* `encoder.__.update-counters.time` (float, RO) runtime in seconds +* `encoder.__.update-counter.tmax` (float, RW) max runtime in seconds === Functions diff --git a/docs/src/hal/tools.adoc b/docs/src/hal/tools.adoc index 933893fb71e..8f661658386 100644 --- a/docs/src/hal/tools.adoc +++ b/docs/src/hal/tools.adoc @@ -229,7 +229,7 @@ or |=== |Option |Value |Description |--minvalue |minvalue |minimum bin, default: 0 -|--binsize |binsize |binsize, default: 100 +|--binsize |binsize |binsize, default: 1e-07 (suits the default pin, a runtime in seconds) |--nbins |nbins |number of bins, default: 50 | | | |--logscale |0/1 |y axis log scale, default: 1 diff --git a/docs/src/hal/tutorial.adoc b/docs/src/hal/tutorial.adoc index 87dcfa00d74..666e3f8183a 100644 --- a/docs/src/hal/tutorial.adoc +++ b/docs/src/hal/tutorial.adoc @@ -183,8 +183,8 @@ halcmd: show param Parameters: Owner Type Dir Value Name - 3 s32 RO 0 siggen.0.update.time - 3 s32 RW 0 siggen.0.update.tmax + 3 float RO 0 siggen.0.update.time + 3 float RW 0 siggen.0.update.tmax ---- The 'show param' command shows all the parameters in the HAL. @@ -328,8 +328,8 @@ halcmd: show param Parameters: Owner Type Dir Value Name - 3 s32 RO 1754 siggen.0.update.time - 3 s32 RW 16997 siggen.0.update.tmax + 3 float RO 1.754e-06 siggen.0.update.time + 3 float RW 1.6997e-05 siggen.0.update.tmax halcmd: show pin @@ -369,7 +369,7 @@ loadrt siggen # signals # nets # parameter values -setp siggen.0.update.tmax 14687 +setp siggen.0.update.tmax 1.4687e-05 # realtime thread/function links addf siggen.0.update test-thread ---- @@ -495,8 +495,8 @@ halcmd: show param Parameters: Owner Type Dir Value Name - 4 s32 RO 0 siggen.0.update.time - 4 s32 RW 0 siggen.0.update.tmax + 4 float RO 0 siggen.0.update.time + 4 float RW 0 siggen.0.update.tmax 3 u32 RW 0x00000001 stepgen.0.dirhold 3 u32 RW 0x00000001 stepgen.0.dirsetup 3 float RO 0 stepgen.0.frequency @@ -515,12 +515,12 @@ Owner Type Dir Value Name 3 s32 RO 0 stepgen.1.rawcounts 3 u32 RW 0x00000001 stepgen.1.steplen 3 u32 RW 0x00000001 stepgen.1.stepspace - 3 s32 RO 0 stepgen.capture-position.time - 3 s32 RW 0 stepgen.capture-position.tmax - 3 s32 RO 0 stepgen.make-pulses.time - 3 s32 RW 0 stepgen.make-pulses.tmax - 3 s32 RO 0 stepgen.update-freq.time - 3 s32 RW 0 stepgen.update-freq.tmax + 3 float RO 0 stepgen.capture-position.time + 3 float RW 0 stepgen.capture-position.tmax + 3 float RO 0 stepgen.make-pulses.time + 3 float RW 0 stepgen.make-pulses.tmax + 3 float RO 0 stepgen.update-freq.time + 3 float RW 0 stepgen.update-freq.tmax ---- === Connecting pins with signals diff --git a/docs/src/man/man9/classicladder.9.adoc b/docs/src/man/man9/classicladder.9.adoc index 71b2924f554..ca67073d128 100644 --- a/docs/src/man/man9/classicladder.9.adoc +++ b/docs/src/man/man9/classicladder.9.adoc @@ -51,10 +51,10 @@ the outputs. == PARAMETERS -*classicladder.0.refresh.time* RO s32:: - Tells you how long the last refresh took. -*classicladder.0.refresh.tmax* RW s32:: - Tells you how long the longest refresh took. +*classicladder.0.refresh.time* RO float:: + Tells you how long the last refresh took, in seconds. +*classicladder.0.refresh.tmax* RW float:: + Tells you how long the longest refresh took, in seconds. *classicladder.0.ladder-state* RO s32:: Tells you if the program is running or not diff --git a/docs/src/man/man9/encoder.9.adoc b/docs/src/man/man9/encoder.9.adoc index daf0b0ea380..f5e26512dc0 100644 --- a/docs/src/man/man9/encoder.9.adoc +++ b/docs/src/man/man9/encoder.9.adoc @@ -138,8 +138,8 @@ The *encoder*.__N__. format is shown in the following descriptions. of the phase-A input, ignoring the value on phase-B. This is useful for counting the output of a single channel (non-quadrature) sensor. When false (the default), it counts in quadrature mode. -**encoder**.__N__.**capture-position.tmax** s32 rw:: - Maximum time in ns it took to execute this function. +**encoder**.__N__.**capture-position.tmax** float rw:: + Maximum time in seconds it took to execute this function. == PARAMETERS diff --git a/docs/src/man/man9/motion.9.adoc b/docs/src/man/man9/motion.9.adoc index 43859fcef14..51e8e240a5e 100644 --- a/docs/src/man/man9/motion.9.adoc +++ b/docs/src/man/man9/motion.9.adoc @@ -105,10 +105,10 @@ digital pins and two analog pins. == MOTION PINS -*motion-command-handler.time* OUT S32:: - Time (in ns) for the motion module motion-command-handler -*motion-controller.time* OUT S32:: - Time (in ns) for the motion module motion-controller +*motion-command-handler.time* OUT FLOAT:: + Time (in seconds) for the motion module motion-command-handler +*motion-controller.time* OUT FLOAT:: + Time (in seconds) for the motion module motion-controller *motion.adaptive-feed* IN FLOAT:: When adaptive feed is enabled with M52 P1, the commanded velocity is multiplied by this value. This effect is multiplicative with the @@ -543,13 +543,13 @@ the M19 command fails with an error message. Many of the parameters serve as debugging aids, and are subject to change or removal at any time. -*motion-command-handler.tmax* RW S32:: - Show information about the execution time of these HAL functions in ns. +*motion-command-handler.tmax* RW FLOAT:: + Show information about the execution time of these HAL functions in seconds. *motion-command-handler.tmax-increased* RO S32:: -*motion-controller.tmax* RW S32:: - Show information about the execution time of these HAL functions in ns. +*motion-controller.tmax* RW FLOAT:: + Show information about the execution time of these HAL functions in seconds. *motion-controller.tmax-increased* RO BIT:: + diff --git a/lib/python/gladevcp/builtin-panels/gtk_mesa_tests/gtk_mesa_tests.glade b/lib/python/gladevcp/builtin-panels/gtk_mesa_tests/gtk_mesa_tests.glade index 112b5325690..55eec990505 100644 --- a/lib/python/gladevcp/builtin-panels/gtk_mesa_tests/gtk_mesa_tests.glade +++ b/lib/python/gladevcp/builtin-panels/gtk_mesa_tests/gtk_mesa_tests.glade @@ -3,9 +3,9 @@ - 1000000000000 - 1 - 10 + 1000 + 0.000001 + 0.00001 1000000000000 @@ -18,14 +18,14 @@ 10 - 1000000000000 - 1 - 10 + 1000 + 0.000001 + 0.00001 - 1000000000000 - 1 - 10 + 1000 + 0.000001 + 0.00001 False @@ -85,6 +85,7 @@ 10 1 adj_servo_thread_tmax + 9 1 @@ -452,6 +453,7 @@ try increasing the thread period. 10 1 adj_read_tmax + 9 1 @@ -468,6 +470,7 @@ try increasing the thread period. 10 1 adj_write_tmax + 9 1 diff --git a/lib/python/gladevcp/builtin-panels/gtk_mesa_tests/gtk_mesa_tests.py b/lib/python/gladevcp/builtin-panels/gtk_mesa_tests/gtk_mesa_tests.py index ea21b2f7837..95942eab144 100644 --- a/lib/python/gladevcp/builtin-panels/gtk_mesa_tests/gtk_mesa_tests.py +++ b/lib/python/gladevcp/builtin-panels/gtk_mesa_tests/gtk_mesa_tests.py @@ -194,7 +194,7 @@ def on_btn_servo_thread_tmax_released(self, gtkbutton): line = line.strip() if line.endswith("servo-thread.tmax"): parts = line.split() - value = int(parts[3]) # 4. column is Value + value = float(parts[3]) # 4. column is Value, in seconds break spin_thread_tmax = self.builder.get_object("sbtn_servo_thread_tmax") @@ -253,8 +253,8 @@ def on_btn_calc_servo_released(self, gtkbutton): buffer.insert(buffer.get_end_iter(), "Servo Thread period must be greater than 0") return - # Calculation - result = t_max / period * 100 + # Calculation; t_max is in seconds, period in ns + result = t_max / (period * 1e-9) * 100 label_result.set_text(f'{result:.0f}%') @@ -279,7 +279,7 @@ def on_btn_read_tmax_released(self, gtkbutton): line = line.strip() if "read.tmax" in line: parts = line.split() - value = int(parts[3]) # 4. column is Value + value = float(parts[3]) # 4. column is Value, in seconds break spin_thread_period = self.builder.get_object("sbtn_read_tmax") @@ -306,7 +306,7 @@ def on_btn_write_tmax_released(self, gtkbutton): line = line.strip() if "write.tmax" in line: parts = line.split() - value = int(parts[3]) # 4. column is Value + value = float(parts[3]) # 4. column is Value, in seconds break spin_thread_period = self.builder.get_object("sbtn_write_tmax") @@ -376,7 +376,8 @@ def on_btn_nic_calculate_released(self, gtkbutton): # Calculation rw_tmax = read_tmax + write_tmax - result = rw_tmax / period * 100 + # rw_tmax is in seconds, period in ns + result = rw_tmax / (period * 1e-9) * 100 label_result.set_text(f'{result:.0f}%') def on_btn_packet_error_released(self, gtkbutton): diff --git a/scripts/hal-histogram b/scripts/hal-histogram index e4c210cef7d..ee16dbe7bc7 100755 --- a/scripts/hal-histogram +++ b/scripts/hal-histogram @@ -100,7 +100,9 @@ proc set_defaults {} { set ::HH(y,logscale) 1 set ::HH(nbins) 50 set ::HH(minvalue) 0 - set ::HH(binsize) 100 + # the default pin is a function runtime pin, which is a float in seconds, + # so the default binsize is 100ns expressed in seconds + set ::HH(binsize) 1e-07 set ::HH(maxvalue) 0 set ::HH(pinname) motion-command-handler.time diff --git a/src/hal/hal_lib.c b/src/hal/hal_lib.c index ce5cbc68713..90eec4a4ce5 100644 --- a/src/hal/hal_lib.c +++ b/src/hal/hal_lib.c @@ -2499,8 +2499,8 @@ int hal_export_funct(const char *name, void (*funct) (void *, long), /* at this point we have a new function and can yield the mutex */ halpr_mutex_release(); - /* create a pin with the function's runtime in it */ - if (hal_pin_new_si32(comp_id, HAL_OUT, &(new->runtime), 0, "%s.time", name) < 0) { + /* create a pin with the function's runtime (in seconds) in it */ + if (hal_pin_new_real(comp_id, HAL_OUT, &(new->runtime), 0.0, "%s.time", name) < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "HAL: ERROR: fail to create pin '%s.time'\n", name); return -EINVAL; } @@ -2508,8 +2508,8 @@ int hal_export_funct(const char *name, void (*funct) (void *, long), /* note that failure to successfully create the following params does not cause the "export_funct()" call to fail - they are for debugging and testing use only */ - /* create a parameter with the function's maximum runtime in it */ - if(hal_param_new_si32(comp_id, HAL_RW, &(new->maxtime), 0, "%s.tmax", name) < 0) { + /* create a parameter with the function's maximum runtime (in seconds) in it */ + if(hal_param_new_real(comp_id, HAL_RW, &(new->maxtime), 0.0, "%s.tmax", name) < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "HAL: ERROR: fail to create param '%s.tmax'\n", name); return -EINVAL; } @@ -2684,13 +2684,13 @@ int hal_create_thread(const char *name, unsigned long period_nsec, int uses_fp) return new->comp_id; } - if ((retval = hal_param_new_si32(new->comp_id, HAL_RW, &(new->maxtime), 0, "%s.tmax", new->name)) < 0) { + if ((retval = hal_param_new_real(new->comp_id, HAL_RW, &(new->maxtime), 0.0, "%s.tmax", new->name)) < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "HAL: ERROR: fail to create param '%s.tmax'\n", new->name); return retval; } - if ((retval = hal_pin_new_si32(new->comp_id, HAL_OUT, &(new->runtime), 0, "%s.time", new->name)) < 0) { + if ((retval = hal_pin_new_real(new->comp_id, HAL_OUT, &(new->runtime), 0.0, "%s.time", new->name)) < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "HAL: ERROR: fail to create pin '%s.time'\n", new->name); return retval; @@ -3673,10 +3673,12 @@ static void thread_task(void *arg) end_time = rtapi_get_time(); /* point to function structure */ funct = SHMPTR(funct_entry->funct_ptr); - /* update execution time data */ - rtapi_s32 runtime = hal_set_si32(funct->runtime, end_time - start_time); - if ( runtime > hal_get_si32(funct->maxtime)) { - hal_set_si32(funct->maxtime, runtime); + /* update execution time data; rtapi_get_time() counts ns, + the .time pin and .tmax param report seconds */ + rtapi_real runtime = hal_set_real(funct->runtime, + (rtapi_real)(end_time - start_time) * 1e-9); + if ( runtime > hal_get_real(funct->maxtime)) { + hal_set_real(funct->maxtime, runtime); hal_set_bool(funct->maxtime_increased, 1); } else { hal_set_bool(funct->maxtime_increased, 0); @@ -3686,10 +3688,11 @@ static void thread_task(void *arg) /* prepare to measure time for next funct */ start_time = end_time; } - /* update thread execution time */ - rtapi_s32 runtime = hal_set_si32(thread->runtime, end_time - thread_start_time); - if ( runtime > hal_get_si32(thread->maxtime)) { - hal_set_si32(thread->maxtime, runtime); + /* update thread execution time, in seconds */ + rtapi_real runtime = hal_set_real(thread->runtime, + (rtapi_real)(end_time - thread_start_time) * 1e-9); + if ( runtime > hal_get_real(thread->maxtime)) { + hal_set_real(thread->maxtime, runtime); } hal_set_sint(thread->threadbeat, ++thread->beatcnt); } diff --git a/src/hal/hal_priv.h b/src/hal/hal_priv.h index 3e16f554614..69713d0b607 100644 --- a/src/hal/hal_priv.h +++ b/src/hal/hal_priv.h @@ -405,8 +405,8 @@ struct hal_funct_t { // IMPORTANT: The pins and params are valid as seen from the context that // created them. For uspace that is rtapi_app and in the kernel it is the // kernel's module context. - hal_sint_t runtime; /* (pin) duration of last run, in CPU cycles */ - hal_sint_t maxtime; /* (param) duration of longest run, in CPU cycles */ + hal_real_t runtime; /* (pin) duration of last run, in seconds */ + hal_real_t maxtime; /* (param) duration of longest run, in seconds */ hal_bool_t maxtime_increased; /* (param) on last call, maxtime increased */ char name[HAL_NAME_LEN + 1]; /* function name */ }; @@ -429,8 +429,8 @@ struct hal_thread_t { // IMPORTANT: The pins and params are valid as seen from the context that // created them. For uspace that is rtapi_app and in the kernel it is the // kernel's module context. - hal_sint_t runtime; /* (pin) duration of last run, in ns */ - hal_sint_t maxtime; /* (param) duration of longest run, in ns */ + hal_real_t runtime; /* (pin) duration of last run, in seconds */ + hal_real_t maxtime; /* (param) duration of longest run, in seconds */ hal_sint_t threadbeat; /* (pin) visible monotonic loop beat counter */ rtapi_sint beatcnt; /* Thread monotonic increasing loop beat counter (so we don't need to read/write volatile) */ hal_list_t funct_list; /* list of functions to run */ diff --git a/src/hal/utils/halcmd_commands.cc b/src/hal/utils/halcmd_commands.cc index 569293f2f4e..81c009f0ca8 100644 --- a/src/hal/utils/halcmd_commands.cc +++ b/src/hal/utils/halcmd_commands.cc @@ -1761,12 +1761,13 @@ static int print_thread_info_cb(hal_query_t *q, void *arg) int rvm = hal_getref_p(&qm); if(!rvt && !rvm) { // note that the scriptmode format string has no \n - halcmd_output((!scriptmode ? "%11ld %-3s %20s ( %8ld, %8ld )\n" : "%ld %s %s %8ld %ld"), + // time/tmax are in seconds + halcmd_output((!scriptmode ? "%11ld %-3s %20s ( %12.9f, %12.9f )\n" : "%ld %s %s %.9f %.9f"), q->thread.period, "YES", // Always uses FP q->name, - (long)hal_get_si32(qt.pp.ref.s), - (long)hal_get_si32(qm.pp.ref.s)); + hal_get_real(qt.pp.ref.r), + hal_get_real(qm.pp.ref.r)); } else { rtapi_print_msg(RTAPI_MSG_ERR, "unexpected: cannot find time/tmax pin for %s thread\n", q->name); } @@ -1793,7 +1794,7 @@ static void print_thread_info(const char **patterns) { if(!scriptmode) { halcmd_output("Realtime Threads:\n"); - halcmd_output(" Period FP Name ( Time, Max-Time )\n"); + halcmd_output(" Period FP Name ( Time [s], Max-Time [s] )\n"); } hal_query_t q = {}; q.qtype = HAL_QTYPE_THREAD_FUNCT; // Callback on both threads and functions attached diff --git a/src/hal/utils/halrmt.cc b/src/hal/utils/halrmt.cc index 821d4db2329..986033e0826 100644 --- a/src/hal/utils/halrmt.cc +++ b/src/hal/utils/halrmt.cc @@ -1240,16 +1240,16 @@ static int getFunctInfo(connectionRecType &ctx, const std::string &pattern) return hal_list_funct(&q, getFunctInfo_cb, &ctx); } -static rtapi_sint getpin_sint(connectionRecType &ctx, const std::string &name) +static rtapi_real getpin_real(connectionRecType &ctx, const std::string &name) { hal_query_t q = {}; q.name = name.c_str(); int rv = hal_get_p(&q, NULL, NULL); if(0 != rv) { errornl(ctx, fmt::format("Cannot find thread's pin '{}', error={}", name, rv)); - return 0; + return 0.0; } - return q.pp.value.s; + return q.pp.value.r; } static int getThreadInfo_cb(hal_query_t *q, void *arg) { @@ -1258,9 +1258,10 @@ static int getThreadInfo_cb(hal_query_t *q, void *arg) if(HAL_QTYPE_THREAD == q->qtype) { // The thread reference if(pattern->empty() || !fnmatch(pattern->c_str(), q->name, FNM_NOESCAPE|FNM_CASEFOLD)) { - rtapi_sint tp = getpin_sint(*ctx, fmt::format("{}.time", q->name)); - rtapi_sint tm = getpin_sint(*ctx, fmt::format("{}.tmax", q->name)); - replynl(*ctx, fmt::format("THREAD {:12s} {:11d} {} {}", q->name, q->thread.period, tp, tm)); + // time/tmax are in seconds + rtapi_real tp = getpin_real(*ctx, fmt::format("{}.time", q->name)); + rtapi_real tm = getpin_real(*ctx, fmt::format("{}.tmax", q->name)); + replynl(*ctx, fmt::format("THREAD {:12s} {:11d} {:.9f} {:.9f}", q->name, q->thread.period, tp, tm)); } } else { // The thread's function reference @@ -1275,7 +1276,7 @@ static int getThreadInfo(connectionRecType &ctx, const std::string &pattern) q.qtype = HAL_QTYPE_THREAD_FUNCT; q.callerdata.cpval = reinterpret_cast(&pattern); if(ctx.header) { - replynl(ctx, "THREAD Name Period time tmax"); + replynl(ctx, "THREAD Name Period time[s] tmax[s]"); } return hal_list_thread(&q, getThreadInfo_cb, &ctx); } diff --git a/tests/halcompile/personalities_mod/4count_2pers.expected b/tests/halcompile/personalities_mod/4count_2pers.expected index 01f5bc56498..7c9bc0df3a6 100644 --- a/tests/halcompile/personalities_mod/4count_2pers.expected +++ b/tests/halcompile/personalities_mod/4count_2pers.expected @@ -1,73 +1,73 @@ bitslice_test u32 IN 0 bitslice-test.0.in bitslice_test bit OUT FALSE bitslice-test.0.out-00 bitslice_test bit OUT FALSE bitslice-test.0.out-01 -bitslice_test s32 OUT 0 bitslice-test.0.time +bitslice_test float OUT 0 bitslice-test.0.time bitslice_test u32 IN 0 bitslice-test.1.in bitslice_test bit OUT FALSE bitslice-test.1.out-00 bitslice_test bit OUT FALSE bitslice-test.1.out-01 bitslice_test bit OUT FALSE bitslice-test.1.out-02 -bitslice_test s32 OUT 0 bitslice-test.1.time +bitslice_test float OUT 0 bitslice-test.1.time bitslice_test u32 IN 0 bitslice-test.2.in bitslice_test bit OUT FALSE bitslice-test.2.out-00 bitslice_test bit OUT FALSE bitslice-test.2.out-01 -bitslice_test s32 OUT 0 bitslice-test.2.time +bitslice_test float OUT 0 bitslice-test.2.time bitslice_test u32 IN 0 bitslice-test.3.in bitslice_test bit OUT FALSE bitslice-test.3.out-00 bitslice_test bit OUT FALSE bitslice-test.3.out-01 bitslice_test bit OUT FALSE bitslice-test.3.out-02 -bitslice_test s32 OUT 0 bitslice-test.3.time +bitslice_test float OUT 0 bitslice-test.3.time lincurve_test float IN 0 lincurve-test.0.in lincurve_test float OUT 0 lincurve-test.0.out lincurve_test float I/O 0 lincurve-test.0.out-io -lincurve_test s32 OUT 0 lincurve-test.0.time +lincurve_test float OUT 0 lincurve-test.0.time lincurve_test float IN 0 lincurve-test.1.in lincurve_test float OUT 0 lincurve-test.1.out lincurve_test float I/O 0 lincurve-test.1.out-io -lincurve_test s32 OUT 0 lincurve-test.1.time +lincurve_test float OUT 0 lincurve-test.1.time lincurve_test float IN 0 lincurve-test.2.in lincurve_test float OUT 0 lincurve-test.2.out lincurve_test float I/O 0 lincurve-test.2.out-io -lincurve_test s32 OUT 0 lincurve-test.2.time +lincurve_test float OUT 0 lincurve-test.2.time lincurve_test float IN 0 lincurve-test.3.in lincurve_test float OUT 0 lincurve-test.3.out lincurve_test float I/O 0 lincurve-test.3.out-io -lincurve_test s32 OUT 0 lincurve-test.3.time +lincurve_test float OUT 0 lincurve-test.3.time logic_test bit OUT FALSE logic-test.0.and logic_test bit IN FALSE logic-test.0.in-00 logic_test bit IN FALSE logic-test.0.in-01 -logic_test s32 OUT 0 logic-test.0.time +logic_test float OUT 0 logic-test.0.time logic_test bit IN FALSE logic-test.1.in-00 logic_test bit IN FALSE logic-test.1.in-01 logic_test bit IN FALSE logic-test.1.in-02 logic_test bit IN FALSE logic-test.1.in-03 logic_test bit OUT FALSE logic-test.1.or -logic_test s32 OUT 0 logic-test.1.time +logic_test float OUT 0 logic-test.1.time logic_test bit OUT FALSE logic-test.2.and logic_test bit IN FALSE logic-test.2.in-00 logic_test bit IN FALSE logic-test.2.in-01 -logic_test s32 OUT 0 logic-test.2.time +logic_test float OUT 0 logic-test.2.time logic_test bit IN FALSE logic-test.3.in-00 logic_test bit IN FALSE logic-test.3.in-01 logic_test bit IN FALSE logic-test.3.in-02 logic_test bit IN FALSE logic-test.3.in-03 logic_test bit OUT FALSE logic-test.3.or -logic_test s32 OUT 0 logic-test.3.time +logic_test float OUT 0 logic-test.3.time -bitslice_test s32 RW 0 bitslice-test.0.tmax +bitslice_test float RW 0 bitslice-test.0.tmax bitslice_test bit RO FALSE bitslice-test.0.tmax-increased -bitslice_test s32 RW 0 bitslice-test.1.tmax +bitslice_test float RW 0 bitslice-test.1.tmax bitslice_test bit RO FALSE bitslice-test.1.tmax-increased -bitslice_test s32 RW 0 bitslice-test.2.tmax +bitslice_test float RW 0 bitslice-test.2.tmax bitslice_test bit RO FALSE bitslice-test.2.tmax-increased -bitslice_test s32 RW 0 bitslice-test.3.tmax +bitslice_test float RW 0 bitslice-test.3.tmax bitslice_test bit RO FALSE bitslice-test.3.tmax-increased -lincurve_test s32 RW 0 lincurve-test.0.tmax +lincurve_test float RW 0 lincurve-test.0.tmax lincurve_test bit RO FALSE lincurve-test.0.tmax-increased lincurve_test float RW 0 lincurve-test.0.x-val-00 lincurve_test float RW 0 lincurve-test.0.x-val-01 lincurve_test float RW 0 lincurve-test.0.y-val-00 lincurve_test float RW 0 lincurve-test.0.y-val-01 -lincurve_test s32 RW 0 lincurve-test.1.tmax +lincurve_test float RW 0 lincurve-test.1.tmax lincurve_test bit RO FALSE lincurve-test.1.tmax-increased lincurve_test float RW 0 lincurve-test.1.x-val-00 lincurve_test float RW 0 lincurve-test.1.x-val-01 @@ -75,13 +75,13 @@ lincurve_test float RW 0 lincurve-test.1.x-val-02 lincurve_test float RW 0 lincurve-test.1.y-val-00 lincurve_test float RW 0 lincurve-test.1.y-val-01 lincurve_test float RW 0 lincurve-test.1.y-val-02 -lincurve_test s32 RW 0 lincurve-test.2.tmax +lincurve_test float RW 0 lincurve-test.2.tmax lincurve_test bit RO FALSE lincurve-test.2.tmax-increased lincurve_test float RW 0 lincurve-test.2.x-val-00 lincurve_test float RW 0 lincurve-test.2.x-val-01 lincurve_test float RW 0 lincurve-test.2.y-val-00 lincurve_test float RW 0 lincurve-test.2.y-val-01 -lincurve_test s32 RW 0 lincurve-test.3.tmax +lincurve_test float RW 0 lincurve-test.3.tmax lincurve_test bit RO FALSE lincurve-test.3.tmax-increased lincurve_test float RW 0 lincurve-test.3.x-val-00 lincurve_test float RW 0 lincurve-test.3.x-val-01 @@ -89,12 +89,12 @@ lincurve_test float RW 0 lincurve-test.3.x-val-02 lincurve_test float RW 0 lincurve-test.3.y-val-00 lincurve_test float RW 0 lincurve-test.3.y-val-01 lincurve_test float RW 0 lincurve-test.3.y-val-02 -logic_test s32 RW 0 logic-test.0.tmax +logic_test float RW 0 logic-test.0.tmax logic_test bit RO FALSE logic-test.0.tmax-increased -logic_test s32 RW 0 logic-test.1.tmax +logic_test float RW 0 logic-test.1.tmax logic_test bit RO FALSE logic-test.1.tmax-increased -logic_test s32 RW 0 logic-test.2.tmax +logic_test float RW 0 logic-test.2.tmax logic_test bit RO FALSE logic-test.2.tmax-increased -logic_test s32 RW 0 logic-test.3.tmax +logic_test float RW 0 logic-test.3.tmax logic_test bit RO FALSE logic-test.3.tmax-increased diff --git a/tests/halcompile/personalities_mod/4names_2pers.expected b/tests/halcompile/personalities_mod/4names_2pers.expected index 214ddaa56fc..b1b14004f36 100644 --- a/tests/halcompile/personalities_mod/4names_2pers.expected +++ b/tests/halcompile/personalities_mod/4names_2pers.expected @@ -1,73 +1,73 @@ bitslice_test u32 IN 0 bs1.in bitslice_test bit OUT FALSE bs1.out-00 bitslice_test bit OUT FALSE bs1.out-01 -bitslice_test s32 OUT 0 bs1.time +bitslice_test float OUT 0 bs1.time bitslice_test u32 IN 0 bs2.in bitslice_test bit OUT FALSE bs2.out-00 bitslice_test bit OUT FALSE bs2.out-01 bitslice_test bit OUT FALSE bs2.out-02 -bitslice_test s32 OUT 0 bs2.time +bitslice_test float OUT 0 bs2.time bitslice_test u32 IN 0 bs3.in bitslice_test bit OUT FALSE bs3.out-00 bitslice_test bit OUT FALSE bs3.out-01 -bitslice_test s32 OUT 0 bs3.time +bitslice_test float OUT 0 bs3.time bitslice_test u32 IN 0 bs4.in bitslice_test bit OUT FALSE bs4.out-00 bitslice_test bit OUT FALSE bs4.out-01 bitslice_test bit OUT FALSE bs4.out-02 -bitslice_test s32 OUT 0 bs4.time +bitslice_test float OUT 0 bs4.time lincurve_test float IN 0 lc1.in lincurve_test float OUT 0 lc1.out lincurve_test float I/O 0 lc1.out-io -lincurve_test s32 OUT 0 lc1.time +lincurve_test float OUT 0 lc1.time lincurve_test float IN 0 lc2.in lincurve_test float OUT 0 lc2.out lincurve_test float I/O 0 lc2.out-io -lincurve_test s32 OUT 0 lc2.time +lincurve_test float OUT 0 lc2.time lincurve_test float IN 0 lc3.in lincurve_test float OUT 0 lc3.out lincurve_test float I/O 0 lc3.out-io -lincurve_test s32 OUT 0 lc3.time +lincurve_test float OUT 0 lc3.time lincurve_test float IN 0 lc4.in lincurve_test float OUT 0 lc4.out lincurve_test float I/O 0 lc4.out-io -lincurve_test s32 OUT 0 lc4.time +lincurve_test float OUT 0 lc4.time logic_test bit OUT FALSE lg1.and logic_test bit IN FALSE lg1.in-00 logic_test bit IN FALSE lg1.in-01 -logic_test s32 OUT 0 lg1.time +logic_test float OUT 0 lg1.time logic_test bit IN FALSE lg2.in-00 logic_test bit IN FALSE lg2.in-01 logic_test bit IN FALSE lg2.in-02 logic_test bit IN FALSE lg2.in-03 logic_test bit OUT FALSE lg2.or -logic_test s32 OUT 0 lg2.time +logic_test float OUT 0 lg2.time logic_test bit OUT FALSE lg3.and logic_test bit IN FALSE lg3.in-00 logic_test bit IN FALSE lg3.in-01 -logic_test s32 OUT 0 lg3.time +logic_test float OUT 0 lg3.time logic_test bit IN FALSE lg4.in-00 logic_test bit IN FALSE lg4.in-01 logic_test bit IN FALSE lg4.in-02 logic_test bit IN FALSE lg4.in-03 logic_test bit OUT FALSE lg4.or -logic_test s32 OUT 0 lg4.time +logic_test float OUT 0 lg4.time -bitslice_test s32 RW 0 bs1.tmax +bitslice_test float RW 0 bs1.tmax bitslice_test bit RO FALSE bs1.tmax-increased -bitslice_test s32 RW 0 bs2.tmax +bitslice_test float RW 0 bs2.tmax bitslice_test bit RO FALSE bs2.tmax-increased -bitslice_test s32 RW 0 bs3.tmax +bitslice_test float RW 0 bs3.tmax bitslice_test bit RO FALSE bs3.tmax-increased -bitslice_test s32 RW 0 bs4.tmax +bitslice_test float RW 0 bs4.tmax bitslice_test bit RO FALSE bs4.tmax-increased -lincurve_test s32 RW 0 lc1.tmax +lincurve_test float RW 0 lc1.tmax lincurve_test bit RO FALSE lc1.tmax-increased lincurve_test float RW 0 lc1.x-val-00 lincurve_test float RW 0 lc1.x-val-01 lincurve_test float RW 0 lc1.y-val-00 lincurve_test float RW 0 lc1.y-val-01 -lincurve_test s32 RW 0 lc2.tmax +lincurve_test float RW 0 lc2.tmax lincurve_test bit RO FALSE lc2.tmax-increased lincurve_test float RW 0 lc2.x-val-00 lincurve_test float RW 0 lc2.x-val-01 @@ -75,13 +75,13 @@ lincurve_test float RW 0 lc2.x-val-02 lincurve_test float RW 0 lc2.y-val-00 lincurve_test float RW 0 lc2.y-val-01 lincurve_test float RW 0 lc2.y-val-02 -lincurve_test s32 RW 0 lc3.tmax +lincurve_test float RW 0 lc3.tmax lincurve_test bit RO FALSE lc3.tmax-increased lincurve_test float RW 0 lc3.x-val-00 lincurve_test float RW 0 lc3.x-val-01 lincurve_test float RW 0 lc3.y-val-00 lincurve_test float RW 0 lc3.y-val-01 -lincurve_test s32 RW 0 lc4.tmax +lincurve_test float RW 0 lc4.tmax lincurve_test bit RO FALSE lc4.tmax-increased lincurve_test float RW 0 lc4.x-val-00 lincurve_test float RW 0 lc4.x-val-01 @@ -89,12 +89,12 @@ lincurve_test float RW 0 lc4.x-val-02 lincurve_test float RW 0 lc4.y-val-00 lincurve_test float RW 0 lc4.y-val-01 lincurve_test float RW 0 lc4.y-val-02 -logic_test s32 RW 0 lg1.tmax +logic_test float RW 0 lg1.tmax logic_test bit RO FALSE lg1.tmax-increased -logic_test s32 RW 0 lg2.tmax +logic_test float RW 0 lg2.tmax logic_test bit RO FALSE lg2.tmax-increased -logic_test s32 RW 0 lg3.tmax +logic_test float RW 0 lg3.tmax logic_test bit RO FALSE lg3.tmax-increased -logic_test s32 RW 0 lg4.tmax +logic_test float RW 0 lg4.tmax logic_test bit RO FALSE lg4.tmax-increased diff --git a/tests/halmodule.3/expected b/tests/halmodule.3/expected index 140572ef7d0..80f7cbb00db 100644 --- a/tests/halmodule.3/expected +++ b/tests/halmodule.3/expected @@ -2,24 +2,24 @@ and2.0.in0 {'haltype': 'pin', 'name': 'and2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-a', 'comp': 'and2', 'comp_id': 'ID'} and2.0.in1 {'haltype': 'pin', 'name': 'and2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-b', 'comp': 'and2', 'comp_id': 'ID'} and2.0.out {'haltype': 'pin', 'name': 'and2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'and2', 'comp_id': 'ID'} -and2.0.time {'haltype': 'pin', 'name': 'and2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'and2', 'comp_id': 'ID'} +and2.0.time {'haltype': 'pin', 'name': 'and2.0.time', 'type': , 'dir': , 'value': 0.0, 'alias': None, 'signal': None, 'comp': 'and2', 'comp_id': 'ID'} or2.0.in0 {'haltype': 'pin', 'name': 'or2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-a', 'comp': 'or2', 'comp_id': 'ID'} or2.0.in1 {'haltype': 'pin', 'name': 'or2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-b', 'comp': 'or2', 'comp_id': 'ID'} or2.0.out {'haltype': 'pin', 'name': 'or2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-b', 'comp': 'or2', 'comp_id': 'ID'} -or2.0.time {'haltype': 'pin', 'name': 'or2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'or2', 'comp_id': 'ID'} +or2.0.time {'haltype': 'pin', 'name': 'or2.0.time', 'type': , 'dir': , 'value': 0.0, 'alias': None, 'signal': None, 'comp': 'or2', 'comp_id': 'ID'} testthread.threadbeat {'haltype': 'pin', 'name': 'testthread.threadbeat', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': '__testthread', 'comp_id': 'ID'} -testthread.time {'haltype': 'pin', 'name': 'testthread.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': '__testthread', 'comp_id': 'ID'} +testthread.time {'haltype': 'pin', 'name': 'testthread.time', 'type': , 'dir': , 'value': 0.0, 'alias': None, 'signal': None, 'comp': '__testthread', 'comp_id': 'ID'} xor2.0.in0 {'haltype': 'pin', 'name': 'xor2.0.in0', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-a', 'comp': 'xor2', 'comp_id': 'ID'} xor2.0.in1 {'haltype': 'pin', 'name': 'xor2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-xor-b', 'comp': 'xor2', 'comp_id': 'ID'} xor2.0.out {'haltype': 'pin', 'name': 'xor2.0.out', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-output', 'comp': 'xor2', 'comp_id': 'ID'} -xor2.0.time {'haltype': 'pin', 'name': 'xor2.0.time', 'type': , 'dir': , 'value': 0, 'alias': None, 'signal': None, 'comp': 'xor2', 'comp_id': 'ID'} +xor2.0.time {'haltype': 'pin', 'name': 'xor2.0.time', 'type': , 'dir': , 'value': 0.0, 'alias': None, 'signal': None, 'comp': 'xor2', 'comp_id': 'ID'} # Params -and2.0.tmax {'haltype': 'parameter', 'name': 'and2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'and2', 'comp_id': 'ID'} +and2.0.tmax {'haltype': 'parameter', 'name': 'and2.0.tmax', 'type': , 'dir': , 'value': 0.0, 'alias': None, 'comp': 'and2', 'comp_id': 'ID'} and2.0.tmax-increased {'haltype': 'parameter', 'name': 'and2.0.tmax-increased', 'type': , 'dir': , 'value': False, 'alias': None, 'comp': 'and2', 'comp_id': 'ID'} -or2.0.tmax {'haltype': 'parameter', 'name': 'or2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'or2', 'comp_id': 'ID'} +or2.0.tmax {'haltype': 'parameter', 'name': 'or2.0.tmax', 'type': , 'dir': , 'value': 0.0, 'alias': None, 'comp': 'or2', 'comp_id': 'ID'} or2.0.tmax-increased {'haltype': 'parameter', 'name': 'or2.0.tmax-increased', 'type': , 'dir': , 'value': False, 'alias': None, 'comp': 'or2', 'comp_id': 'ID'} -testthread.tmax {'haltype': 'parameter', 'name': 'testthread.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': '__testthread', 'comp_id': 'ID'} -xor2.0.tmax {'haltype': 'parameter', 'name': 'xor2.0.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': 'xor2', 'comp_id': 'ID'} +testthread.tmax {'haltype': 'parameter', 'name': 'testthread.tmax', 'type': , 'dir': , 'value': 0.0, 'alias': None, 'comp': '__testthread', 'comp_id': 'ID'} +xor2.0.tmax {'haltype': 'parameter', 'name': 'xor2.0.tmax', 'type': , 'dir': , 'value': 0.0, 'alias': None, 'comp': 'xor2', 'comp_id': 'ID'} xor2.0.tmax-increased {'haltype': 'parameter', 'name': 'xor2.0.tmax-increased', 'type': , 'dir': , 'value': False, 'alias': None, 'comp': 'xor2', 'comp_id': 'ID'} # Signals net-input-a {'haltype': 'signal', 'name': 'net-input-a', 'type': , 'value': False, 'writers': 0, 'readers': 2, 'bidirs': 0, 'driver': None} @@ -53,7 +53,7 @@ thread('does-not-exist') fails correctly signalpins('does-not-exist') fails correctly # Simple named queries Pin: {'haltype': 'pin', 'name': 'or2.0.in1', 'type': , 'dir': , 'value': False, 'alias': None, 'signal': 'net-input-b', 'comp': 'or2', 'comp_id': 'ID'} -Param: {'haltype': 'parameter', 'name': 'testthread.tmax', 'type': , 'dir': , 'value': 0, 'alias': None, 'comp': '__testthread', 'comp_id': 'ID'} +Param: {'haltype': 'parameter', 'name': 'testthread.tmax', 'type': , 'dir': , 'value': 0.0, 'alias': None, 'comp': '__testthread', 'comp_id': 'ID'} Signal: {'haltype': 'signal', 'name': 'net-output', 'type': , 'value': False, 'writers': 1, 'readers': 0, 'bidirs': 0, 'driver': 'xor2.0.out'} Component: {'haltype': 'component', 'name': 'and2', 'type': , 'id': 'ID', 'pid': 0, 'ready': True, 'insmod': 'count=1'} Function: {'haltype': 'function', 'name': 'xor2.0', 'comp': 'xor2', 'comp_id': 'ID', 'users': 1, 'reentrant': False} diff --git a/tests/threads.1/checkresult b/tests/threads.1/checkresult index 2f2f8215114..72205c46ee7 100755 --- a/tests/threads.1/checkresult +++ b/tests/threads.1/checkresult @@ -1,4 +1,6 @@ #!/bin/sh -e -# Check that the tmax for a hal function is nonzero -CYCLES=$(cat "$1") -test ! -z "$CYCLES" -a "$CYCLES" -gt 0 +# Check that the tmax for a hal function is nonzero. +# tmax is a float in seconds, so it cannot be compared with test(1). +TMAX=$(cat "$1") +test ! -z "$TMAX" +awk -v tmax="$TMAX" 'BEGIN { exit !(tmax > 0) }'