Skip to content

AndreasBakke/rvfpm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RISC-V Floating-point Coprocessor Model (rvfpm)

The RISC-V Floating-point Coprocessor Model (rvfpm) is a customizable model for verification, design exploration and performance modeling. It provides an easy to configure model, supporting the 32- and 64-bit RISC-V "F" and "Zfinx" extensions, a variety of pipeline structures and optimizations using the eXtension Interface for ease of integration.

Status

Compiled, tested and verified on x86_64 using GCC 12.0.0. Ibex verification done in Ibex fork.

Extension Status Comment
"F" Implemented. 100% compliance using Berkeley TestFloat Default extension.
"Zfinx" Implemented. Verified functionally using Ibex.
"D" Implemented. 100% compliance using Berkeley TestFloat. Not tested functionally. Enable by setting EXT_D in config.
"Zdinx" Implemented. Not verified funtionally. Enable by setting EXT_D and Zfinx in config.
"RV64F/D" Implemented. 100% compliance using Berkeley TestFloat. Not tested functionally. Enable by setting RV64 in config.
"Q" In progress. Branch "precisions"
"Zfh", "Zfhmin" In progress. Branch "precisions"
"Zfa" Not started.
"bfloat" Not started. Dependant on the Zfh extension

Structure

Core

Core structure of the RISC-V Floating-point Coprocessor Model The rvfpm core is structured as above. All files relevant to it, and its verification can be found in work/. Headerfiles are located in work/include, and need to be included during compilation. Core cpp files are located in work/src.

Interface

The RISC-V Floating-point Coprocessor Model implements all but the compressed interface of the eXtension Interface. Using rvfpm.sv located in work/src, relevant functions in the C++ core are called using DPI-C.

Configuration and compilation

Prerequisites:

  • Python
  • Pyyaml: pip3 install pyyaml
  • Simulator tool - depending on use-case of rvfpm.

The core is configured using Yaml configurations in work/run. If no config is specified using CONFIG="path/to/config/" the default config will be used.

Depending on the target, adapt compiler, flags and simulation tools in the Makefile in work/.

By running make setup CONFIG=<optional_path>, the C++ core is compiled into a shared library which can be loaded into a variety of simulators (verified for QuestaSim 2020) along with config.svh, in_xif.sv and rvfpm.sv .

Compliance testing

Testing for compliance to the IEEE 754-2008 standard done using Berkeley TestFloat. Binaries are located in work/bin. The C++ interface for the test-suite available in work/src, note that conversion functions are partially generated by ChatGPT.

To test the system using Berkeley Testfloat, run

make TestFloat LEVEL=1/2

Results are written to work/tests/<target>/rm-<rounding mode>/<test>.txt

A summary of tests performed, and errors encountered can be seen below. Refer to the summary in work/tests for additional details.

Extension Tests preformed Errors
F 58,260,633,824 0
D 295,640,668,058 0
RV64F 580,448 0

Functional verification

For instructions not available in Berkeley TestFloat, functional verification were done by integrating rvfpm into lowRISCs Ibex in a seperate Ibex fork.