Learning BSV‎ > ‎

Data Types


Bluespec provides a strong, static type-checking environment. Every  variable and every expression has a type.  Variables must be assigned values which have compatible types.   Type checking, which occurs before program elaboration or execution, ensures that object types are compatible and that needed conversion functions are valid for the context.

Data types in BSV are case sensitive.  The first character of a type is almost always uppercase (the only exceptions are the types int and bit for compatibility with Verilog).  The first character of a variable name is lowercase.  A common source of errors in Bluespec is to use an uppercase name where BSV expects a lowercase and vice versa.

Common Types

One way to classify types in Bluespec are whether they are in the Bits class. Bits defines the class of types that can be converted to bit vectors
and back.  Only types in the Bits class are synthesizable and can be stored in  a state element, such as a Register or a FIFO. 

Type Parameters

Some types require one or more parameters to be fully specified.  The parameters may be known or unknown (polymorphic).

Hints and Tips for Using Types