## SBAM - SPM Bit Accurate Modelling

### Background

### SBAM Overview

Many applications in engineering involve implementing an algorithm on special purpose hardware (e.g. DSP, FPGA, ASIC). Development of the algorithm usually occurs on a computer using IEEE 754 floating point arithmetic, however often the target hardware doesn't support the same arithmetic precision (DSPs may use fixed point arithmetic, FPGA/ASIC designs may use custom number systems). The SBAM library provides a simple method for bit-accurate simulation of the arithmetic performance of the target device which allows the engineer to more effectively evaluate various design decisions.

- C++ class library
- HDL level interface for bit accurate modelling
- High level interface for easy numerical modelling
- Provides multiple number systems
- Floating point
- Fixed point
- Logarithmic number system
- Extensible with user defined classes

- Common interface for all numeric types allows easy switching
- Compatibility libraries provide easy integration into existing simulations

### Library Architecture

The objective of SBAM is to provide an easy to use system for bit accurate modelling. To this end the foundation of the library is a set of classes mirroring the functionality available in standard VHDL. Building on this base enables the numeric classes to be bit accurate while still providing a familiar interface (via operator overloading). The one exception is the Double class, which is a wrapper around the standard double type. It is intended only to aid converting existing code to use SBAM, and not for use in bit accurate simulation. The compatibility libraries are optional, however they can greatly ease the process of converting an existing high-level simulation into a bit accurate model. Interfaces are provided for IT++ and MATLAB, along with convenience functions to simplify working with standard C++. The IT++ and MATLAB interfaces provide elementary linear algebra such as matrix/vector operations, however more advanced functionality (such as qr() etc.) is not currently provided.

### Recommended Workflow

The large gap between high-level simulation and hardware implementation usually prohibits direct implementation from the high-level simulation. The purpose of a bit accurate model is to bridge this gap, providing an intermediate step enabling verification of both the high-level simulation and hardware implementation. However there are often features of the high-level simulation environment that are unavailable in bit accurate models. This complicates the process of creating bit accurate models.

SBAM simplifies the process of moving from high-level simulation to bit accurate model by providing a clear workflow and supporting tools. This enables rapid and accurate prototyping of hardware designs.

The library is designed around the workflow shown above, however there is nothing strictly enforcing it. The first step is converting a simulation to use the Double class. Since the Double class is based around the double primitive type there should be no difference in precision, however it will show up any incompatible library calls that need to be changed. After a simulation works using the Double class it is relatively straightforward to convert to any desired numeric type as they share a common set of primitive operations. The parameters of the numeric type can then be adjusted to examine the impact on the performance of the algorithm. Once a particular number format is settled upon "test vectors" can be generated for use in testing an HDL implementation.