Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #30276

Re: Fixed Point Calculations

From Anssi Saari <as@sci.fi>
Newsgroups comp.arch.embedded
Subject Re: Fixed Point Calculations
Date 2021-01-20 09:50 +0200
Organization An impatient and LOUD arachnid
Message-ID <sm0sg6wxd13.fsf@lakka.kapsi.fi> (permalink)
References (6 earlier) <c992ae8e-f603-47ef-9534-1092c2b72327n@googlegroups.com> <ru3epe$fmq$1@dont-email.me> <58324aac-a738-4b0f-9369-6392f272ed21n@googlegroups.com> <sm0ft2yypz8.fsf@lakka.kapsi.fi> <0b390a64-26e6-4b9e-96b5-5e116e7a7d31n@googlegroups.com>

Show all headers | View raw


Rick C <gnuarm.deletethisbit@gmail.com> writes:

> What sort of hardware was produced for integer operations?  When you
> say integer, do you mean literally integer data type as in VHDL, or do
> you mean integer interpretation of a array of binary signals like
> signed/unsigned or the equivalent in Verilog?

The input and output data types were std_logic_vector so unsigned
division of bits interpreted as integers. Unfortunately I don't have
access to the code any more. This was part of converting some sensor
manufacturer's awful reference C code into VHDL to convert raw sensor
values to real ones. The C code used 32-bit signed and unsigned integers
and while it was long, it was straightforward to do in VHDL.

> If I don't use floating point, I would need to use fixed point.  I've
> not worked with the fixed point library in VHDL and didn't want to
> climb the learning curve.  So I'm expecting to plan it all manually.

I didn't experience much in the way of learning curve with the sfixed
types even though I hadn't used them before. A few minutes browsing
through Ashenden. But then that was only for a PID controller which is
after all a pretty simple thing and I didn't have to be overly concerned
about accuracy.

> Float to fixed is pretty straightforward.  It's just a shifter to
> align the mantissa according to the value in the exponent and forming
> the 2's complement according to the sign bit.  That is one clock cycle
> using the DSP multiplier.  Think of it as a denormalize operation in
> prep for an add in floating point.  The int to float is similar with
> the setting of the exponent.  That's essentially a normalize operation
> and uses the same hardware.

Now that would mean a learning curve for me although I remember I did a
floating point multiplier as student over 20 years ago. Pity I don't
think I have the VHDL code from back then any more.

> Since I require similar operations on multiple data it makes sense to
> have an ALU that can be controlled to process data sequentially rather
> than dedicating logic to various data flows.  Was your application
> similar or did you have high data rates that needed dedicated hardware
> for a given data path?

It was similar, there were three sensors which all shared the single
divider and other calculations. I was pretty relaxed about the use of HW
multipliers since I had plenty. Just not so many I could've had 3x the
number used.

Data rate was slow, I only read the sensors at something like 2 Hz. No
rush to get from the raw data to final data either but that took maybe
20-30 50ns cycles per sensor.

Back to comp.arch.embedded | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Fixed Point Calculations Rick C <gnuarm.deletethisbit@gmail.com> - 2021-01-01 02:18 -0800
  Re: Fixed Point Calculations upsidedown@downunder.com - 2021-01-01 13:33 +0200
    Re: Fixed Point Calculations Rick C <gnuarm.deletethisbit@gmail.com> - 2021-01-03 01:45 -0800
      Re: Fixed Point Calculations Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2021-01-03 12:18 +0200
        Re: Fixed Point Calculations Rick C <gnuarm.deletethisbit@gmail.com> - 2021-01-03 05:33 -0800
      Re: Fixed Point Calculations upsidedown@downunder.com - 2021-01-03 14:48 +0200
      Re: Fixed Point Calculations David Brown <david.brown@hesbynett.no> - 2021-01-03 15:38 +0100
        Re: Fixed Point Calculations Rick C <gnuarm.deletethisbit@gmail.com> - 2021-01-03 18:55 -0800
          Re: Fixed Point Calculations David Brown <david.brown@hesbynett.no> - 2021-01-04 09:26 +0100
            Re: Fixed Point Calculations Rick C <gnuarm.deletethisbit@gmail.com> - 2021-01-17 22:11 -0800
              Re: Fixed Point Calculations David Brown <david.brown@hesbynett.no> - 2021-01-18 08:53 +0100
                Re: Fixed Point Calculations Rick C <gnuarm.deletethisbit@gmail.com> - 2021-01-18 00:42 -0800
                Re: Fixed Point Calculations Anssi Saari <as@sci.fi> - 2021-01-18 22:00 +0200
                Re: Fixed Point Calculations Rick C <gnuarm.deletethisbit@gmail.com> - 2021-01-18 13:46 -0800
                Re: Fixed Point Calculations upsidedown@downunder.com - 2021-01-19 10:44 +0200
                Re: Fixed Point Calculations Rick C <gnuarm.deletethisbit@gmail.com> - 2021-01-19 01:14 -0800
                Re: Fixed Point Calculations Anssi Saari <as@sci.fi> - 2021-01-20 09:50 +0200

csiph-web