Автор Тема: Тест FPU  (Прочитано 4852 раз)

Оффлайн goshka

  • Завсегдатай
  • *
  • Сообщений: 114
    • Email
Тест FPU
« : 16.12.2011 10:54:28 »
Подск пож, нужен тест правильности вычислений с плавающей точкой для математического сопроцессора.

Не производительности со- процессора.

А корректности вычислений, погрешность вычислений.

Существует ли такой?

Спасибо.

Оффлайн Const

  • Глобальный модератор
  • *****
  • Сообщений: 2 653
  • Даже у плохого модератора есть свои плюсы…
Re: Тест FPU
« Ответ #1 : 16.12.2011 11:53:14 »
Тест производительности обычно оценивают по linpack.
Корректность вычислений всегда зависит от алгоритма и никогда от процессора (за исключением бракованных процов, но они быстро обнаруживаются и снимаются с производства).
Погрешность вычислений определяется алгоритмом и представлением числа с плавающей запятой. Первое не относится к процессору, а второе в настоящее время тоже, ибо есть стандарт ISO на двоичное представление чисел с плавающей запятой с разрядностью 32, 64 и 128.
То есть по сути это тоже не зависит от процессора.

Оффлайн goshka

  • Завсегдатай
  • *
  • Сообщений: 114
    • Email
Re: Тест FPU
« Ответ #2 : 16.12.2011 13:56:44 »
Есть проблема: при вычислениях у заказчика- со-процессор иногда падает в fpu_unimplemented_operation_exception.

Вероятно, что опции сборки компилятора, не вполне соответсвуют имеющейся аппаратуре со-процессора.

Поятому хотелось бы прогнать тест, чтобы настроить опции сборки компиятора gcc.

Цитировать
Any attempt to execute an instruction with an operation code or format code that has been reserved
for future definition sets the Unimplemented bit in the Cause field in the FPU Control/Status
register and traps. The operand and destination registers remain undisturbed and the instruction is
emulated in software. Any of the IEEE Standard 754 exceptions can arise from the emulated
operation, and these exceptions in turn are simulated.
The Unimplemented Instruction exception can also be signaled when unusual operands or result
conditions are detected that the implemented hardware cannot handle properly. These include:
Denormalized operand, except for Compare instruction and when the FS bit is set.
• Denormalized result or Underflow, when either Underflow or Inexact Enable bits are set or the
FS bit is not set.
• Reserved opcodes
• Unimplemented formats
• Operations which are invalid for their format (for instance, CVT.S.S)
Note: Denormalized and NaN operands are only trapped if the instruction is a convert or
computational operation. Moves do not trap if their operands are either denormalized
or NaNs.
additional causes of the unimplemented exception include:
• If the multiply portion of the MADD, MSUB, NMADD, or NMSUB instruction would produce
an overflow, underflow or denormal output, regardless of the value of FCR31.FS.
• The CVT.L.FMT instruction with an output that would be greater than 252-1 or less than -252
• Attempting to execute a floating-point instruction if the  instruction set has
not been enabled
The use of this exception for such conditions is optional; most of these conditions are newly
developed and are not expected to be widely used in early implementations. Loopholes are
provided in the architecture so that these conditions can be implemented with assistance provided
by software, maintaining full compatibility with the IEEE Standard 754. It is up to the user to
supply this software. Most compilers simply leave the three floating point exceptions disabled and
have it default to whatever value is generated in the hardware.

« Последнее редактирование: 16.12.2011 13:59:42 от goshka »

Оффлайн Const

  • Глобальный модератор
  • *****
  • Сообщений: 2 653
  • Даже у плохого модератора есть свои плюсы…
Re: Тест FPU
« Ответ #3 : 17.12.2011 15:43:02 »
1. FPU уже давно часть CPU.
2. Вы это сообщение перевели?
Ищите, где вы накосячили в коде и пытаетесь для плавающей запятой выполнять непредусмотренную для этого дела операцию (какую, кстати?).

На всякий случай: какой язык используется?

Оффлайн goshka

  • Завсегдатай
  • *
  • Сообщений: 114
    • Email
Re: Тест FPU
« Ответ #4 : 21.12.2011 09:07:37 »
Язык C, C++

Ошибка нашлась.. Запись в регистр настройки аппаратуры со-процессора решила проблему.

Но тест FPU все-равно нужен. Чтобы убедиться, что других проблем несоответсвия опций сборки gcc и настроек аппаратуры со-процессора нет.