issie icon indicating copy to clipboard operation
issie copied to clipboard

Better numeric SVG text display

Open tomcl opened this issue 10 months ago • 0 comments

Issie uses a lot of numeric SVG text display in the waveform simulator - some of which is time-critical. This is challenging because:

  • Numeric values can be anything from small to very large
  • They can be displayed in 4 different formats (binary, hex, unsigned decimal, signed decimal)
  • We need to know what will the width of the text be.
  • In some cases, if values do not fit width, we would like to print a compressed version of the value. This is implemented at the moment e.g. where 0b0000000001111 displays as 16'0b1111 in Verilog syntax. Perhaps we should not do this, as it is not obvious to novices and the change in format might be confusing?
  • In some cases, where values do not fit width, we could use a different radix. This is done now - it is also problematic since it should at least be done uniformly for an entire waveform. Currently we do not allow radixes to be changed per waveform. Probably we should do that instead of having automatic radix change to save space?

For the values on the SVG waveforms we need something that is fast. We will factor this as:

  • getUpperBoundNumericWidth (font: DrawHelpers.Text) (radix: NumberBase) (number: FastData)
  • getSVGWaveformNumericWidth (radix: NumberBase) (number: FastData) // implemented using above function with first argument constant
  • getSVGWaveformNumericText (radix: NumberBase) (number: FastData)

The FastData D.U. makes these functions much cleaner. It has a performance penalty but one which is ok.

tomcl avatar Mar 30 '24 16:03 tomcl