diff --git a/docs/config.rst b/docs/config.rst index 4ace9c1e..3b6abb5b 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -71,7 +71,7 @@ Field ``param`` field-subtype [ ``=`` value ] ``read`` field-subtype ``write`` field-subtype -``time`` [ ``>`` min_value ] +``time`` ``bit_out`` ``pos_out`` [ scale [ offset [ units ]]] ``ext_out`` ( ``timestamp`` | ``samples`` | ``bits`` group ) @@ -96,14 +96,10 @@ Field actions on a block. The `field-subtype` must be specified, and the `action` subtype is useful for ``write`` fields which take no data. -``time`` [ ``>`` min_value ] +``time`` Time fields behave like ``param`` fields, but need special treatment because the underlying value is 64-bits and so two registers need to be written. - If desired a minimum valid value can be specified as `min_value`. This will - prevent the writing of values less than this value and can be read as the - ``.MIN`` attribute. - ``bit_out`` This identifies an output bit. diff --git a/docs/fields.rst b/docs/fields.rst index b328ab91..87519e9b 100644 --- a/docs/fields.rst +++ b/docs/fields.rst @@ -127,10 +127,6 @@ Field type Description This attribute can be read or written to report or set the delay in FPGA ticks. - ``MIN`` - This reports the minimum valid value for this field in the currently - selected units. - The ``UNITS`` attribute determines how numbers read or written to the field are interpreted. For example:: @@ -466,7 +462,6 @@ scalar RAW Underlying integer value R W lut RAW Computed Lookup Table 32-bit value R time UNITS Units and scaling selection for time R W C \ RAW Raw time in FPGA clock cycles R W -\ MIN Minimum valid setting (for type only) R bit_out CAPTURE_WORD Capturable word containing this bit R \ OFFSET Offset of this bit in captured word R bit_mux DELAY Bit input delay in FPGA ticks R W C diff --git a/python/sim_config/registers b/python/sim_config/registers index 4bc131db..5f8d57b0 100644 --- a/python/sim_config/registers +++ b/python/sim_config/registers @@ -39,8 +39,8 @@ DIV 9 COUNT 4 PULSE 10 - DELAY 3 2 >3 - WIDTH 5 4 >3 + DELAY 3 2 + WIDTH 5 4 INP 0 11 ENABLE 1 12 OUT 30 31 32 33 diff --git a/server/time.c b/server/time.c index 1d36d3e2..397060e2 100644 --- a/server/time.c +++ b/server/time.c @@ -53,10 +53,6 @@ struct time_class_state { unsigned int count; // Number of instances of this block pthread_mutex_t mutex; // Interlock for block access - /* If min_value is set then the range of values [1..min_value] will be - * forbidden. This is used to assist the hardware. */ - uint64_t min_value; // Minimum valid value less 1 - struct time_field { unsigned int time_scale; // Scaling factor selection (enum ix) uint64_t value; // Current value @@ -104,11 +100,7 @@ static error__t time_parse_register( return check_parse_register(field, line, &state->low_register) ?: parse_whitespace(line) ?: - check_parse_register(field, line, &state->high_register) ?: - IF(**line != '\0', - parse_whitespace(line) ?: - parse_char(line, '>') ?: - parse_uint64(line, &state->min_value)); + check_parse_register(field, line, &state->high_register); } @@ -142,23 +134,20 @@ static error__t write_time_value( void *class_data, unsigned int number, uint64_t value) { struct time_class_state *state = class_data; - error__t error = - TEST_OK_(value == 0 || value > state->min_value, "Value too small"); - if (!error) - WITH_MUTEX(state->mutex) - { - hw_write_register( - state->block_base, number, state->low_register, - (uint32_t) value); - hw_write_register( - state->block_base, number, state->high_register, - (uint32_t) (value >> 32)); - - struct time_field *field = &state->values[number]; - field->value = value; - field->update_index = get_change_index(); - } - return error; + WITH_MUTEX(state->mutex) + { + hw_write_register( + state->block_base, number, state->low_register, + (uint32_t) value); + hw_write_register( + state->block_base, number, state->high_register, + (uint32_t) (value >> 32)); + + struct time_field *field = &state->values[number]; + field->value = value; + field->update_index = get_change_index(); + } + return ERROR_OK; } @@ -283,19 +272,6 @@ static error__t time_class_units_put( } -static error__t time_min_format( - void *owner, void *class_data, unsigned int number, - char result[], size_t length) -{ - struct time_class_state *state = class_data; - struct time_field *field = &state->values[number]; - return format_double( - result, length, - (double) (state->min_value + 1) / - time_conversion[field->time_scale] / hw_read_nominal_clock()); -} - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Time. */ @@ -407,9 +383,6 @@ const struct class_methods time_class_methods = { .put = time_class_units_put, .get_enumeration = time_units_get_enumeration, }, - { "MIN", "Minimum programmable time", - .format = time_min_format, - }, ), };