Previous Contents Next

3   Device Specification

device-spec   ::=   device ident (device-params) { (object-def;) + }
device-params   ::=   device-param (, device-param) *
device-param   ::=   ident : type-expr port (@ { integer-ranges }) ?
integer-ranges   ::=   integer-range (, integer-range) *
integer-range   ::=   integer-literal
  | integer-literal .. integer-literal
object-def   ::=   objdef
  | if (expr) objdef-body (else objdef-body) ?
objdef-body   ::=   objdef
  | { (objdef;) + }
objdef   ::=   register-definition
  | structure-definition
  | type-definition
  | variable-definition
  | unused-declaration

A device specification is introduced by the device keyword, and consists of an identifier, followed by a comma separated list of parameters, and then one or more Devil object definitions . Devil objects are register, structure, type or variable. The identifier is the name of the device being defined.

Device parameters

A device parameter named base specifies the number of bits that can be exchanged at the base address. The optional construct @ { integer-ranges } allows one to define a set of integer offsets that can be added to the base address in order to compute an other address with the same characteristics. Note that the device parameter definition is equivalent to

Conditional definitions

The expression if (expr)  def-body1 else def-body2 allows one to conditionally define a Devil object. A Devil object cannot be re-defined; the same identifier cannot be used for several differents Devil objects, even if its definition is conditional. A definition in def-body1 (respectively def-body2) can be accessed at a time t if and only if the expression expr can be evaluated to true (respectively false) in the environment present at time t. The else def-body2 part can be omitted, in which case it defaults to an empty definition.

Expressions of conditional definitions

The expression of a conditional definition is an expression where identifiers can refer to device parameters or variables. The expression is evaluated each time an access to a variable conditionally defined is performed. The identifier name of a read variable is evaluated to the previous value read. The identifier name of a write or read-write variable is evaluated to the previous value assigned to this variable. Moreover, code can be inserted in the generated interface in order to check if a variable has been previously read or written.


Previous Contents Next