General

Preprocessor

Maia programs are preprocessed by an internal preprocessor, which is compatible with cpp (the standard C preprocessor). You may use any cpp directives (#include, #define, and so on). A number of #pragma directives handle Maia-specific functionality.

These pragmas must be explicitly entered in the source code (rather than using a command-line equivalent), to ensure that a program always has defined behaviour, irrespective of how it is compiled:

  • #pragma _DefaultWordSize sets the size of objects which have a default size; it itself defaults to 32 bits.
  • #pragma _StrictChecking sets the level of 'type checking' which is carried out during compilation. Level 1 (the default) defines a level of checking which is broadly compatible with C; this can be reduced to simplify quick tests, or increased to enforce stricter checking.

Separate Compilation

Maia (like Verilog and Pascal, for example) does not have a separate compilation facility. Everything that you need for a testbench must be compiled at the same time, normally by using the #include facility. Most Maia programs are likely to be relatively short, with limited scope for reusability, and separate compilation therefore does not have the same importance that it has in most general-purpose languages.


Standard Library

There is no 'standard library'. There are a limited number of built-in functions, or statements which could be considered to be built-in functions (assert, report, rand, exit, exec, and wait). report has a close equivalence to C's printf. A foreign-language interface can be used run Verilog tasks, which can themselves run arbitrary C code, if necessary.


Statement termination

Maia uses the same rules as C for statement termination with semicolons, for any statement that appears within a function.

Semicolons are optional within the DUT section, and are also optional after drive statements in a 'test vector program' (a program which contains no functions). Semicolons are required after drive statements which are contained within a function.