Numeric Types in Bluespec
Jacob Schwartz
In a hardware design language, such as Bluespec, a designer
typically wants to have control over the bit sizes of values in the
system. Values in such a language are not limited to the byte or word
boundaries of a computer architecture, but can easily be any discrete
size. Proper operation of functions can depend on the sizes of the
inputs. There may also be relationships between the sizes of the
various inputs and outputs that need to be respected. In this talk,
we present Bluespec's type system (designed by Lennart Augustsson)
which incorporates numeric types in a Haskell-like type system
(Hindley-Milner plus type classes) and allows numeric relationships to
be checked statically. Haskell type classes are used to express
arithmetic dependencies between numeric types. We will show how these
numeric types can be used to express discrete properties other than
bit size, and how the type system can be used to deduce value sizes
and instantiate operations not explicitly sized by the programmer.
|