ARM Technical Support Knowledge Articles

How do I run the "fpu" validation test in my RTL simulation?

Applies to: Cortex-M4


Companies who license the Cortex-M4 processor with Floating Point Unit, ARM part number AT521, for inclusion in their chip designs receive a deliverable bundle which includes the functional description of the processor written in Verilog HDL, and an Integration Kit containing an example MCU design and a number of validation test cases to run. One of the validation tests is the program "fpu.c".

Once the deliverable bundle is extracted, and the user's shell environment has been suitably configured to access the ARM Compiler "armcc" and a suitable RTL simulator such as NC Verilog, VCS or Modelsim, the validation tests can be run directly by use of the RunIK script, as described in the Cortex-M4 Integration and Implementation Manual (IIM).

Running the "fpu" test with the default configuration results in the message:

  # Core does not support FPU, hence skipping test


The Integration Kit example MCU design must be configured to include the Floating Point Unit (FPU) and to compile the test program to make use of FPU instructions.

The default settings in the deliverable bundle assume that the instruction tracing hardware block "CM4ETM" will be present. This requires that the user either (a) extracts the separate TM925 deliverable bundle and merges it into the AT521 installation to provide the missing CM4ETM block, or (b) changes the example MCU configuration to remove the CM4ETM instantiation. The configuration can be changed by editing the ./integration_kit/logical/cm4ikmcu/verilog/cm4ik_sys.v file to set the parameter TRACE_LVL to a value less than 2, for example, to a value of 1. Any change of parameter values like this should be accompanied be an edit to the file ./integration_kit/validation/tests/IKConfig.h to change the corresponding "expected" value to match - in this case EXPECTED_TRACE_LVL = 1.

The "fpu" test can now be run, by going to the ./integration_kit/validation/. directory and running:

  RunIK -make -build fpu

but this results in the message shown above, indicating that the FPU is not present.

This result is derived from the EXPECTED_FPU setting in the IKConfig.h file, because the default configuration in cm4ik_sys.v and IKConfig.h is without the FPU present. To include the FPU, cm4ik_sys.v must be edited to set parameter FPU_PRESENT = 1 and IKConfig.h must be edited to set EXPECTED_FPU  1.

Now that the FPU hardware has been included in the example design, the test can be re-run. However, this time it fails with a message:

  # FPSCR contents: 0x0   (Expected 0x1c00000)    -       FAIL

This error is caused by the test program having been compiled without use of the FPU extension instruction set. To allow the compiler and linker to make use of FPU instructions, the file ./integration_kit/validation/tests/Makefile must be edited to set:

  COMPILE_FPU    = 1 .

Any code objects previously created with the wrong compiler settings can be removed by going to the ./integration_kit/validation/tests/. directory and running:

  make clean

Re-running the RunIK command in the validation directory now results in correct execution of the test using FPU instructions, giving the successful completion message:

  # FPSCR contents: 0x1c00000     -       PASS
  # ** TEST PASSED OK ** (Time:              280820)

The floating point opcodes such as VMUL.F32 can be observed in the execution history log file:


where "<simulator>" is "MTI" for Mentor Modlesim/Questasim, "NC" for Cadence NC Verilog or "VCS" for Synopsys VCS.

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential