ModMultiSim help v3.04 - 5. ModMultiSim Language

Download manual: HTML

5. ModMultiSim Language

The ModMultiSim language is used to create a statement for a register, or environment property, and this is used by ModMultiSim to calculate the value of a register or an environment property.

When running the slave simulation (the Run Slave Simulation button on the toolbar is highlighted), the values of registers and environment properties are calculated periodically. The 'period' is the value of Run Interval, which can be changed (see section Edit Run Interval for how to enter a new time for the Run Interval).

A statement may be entered when first adding a register or property via the SettingsEdit Settings... dialog (Add Register and Add Property). Once the register or environment property is added, it can be edited from the panels described in the sections Edit Register Statement and Edit Property Statement. (The latter two panels can also be accessed by clicking the checkbox of the Statement column of the register, or property, in ModMultiSim's main window.)

Initially, you might prefer to look at some examples of the language use in a simulation by going to the section of that name Programming Simulations.

The ModMultiSim language for entering a statement is a small subset of a normal programming language. A summary of the syntax is provided in Syntax Summary. The first section, Lexical Structure, describes the symbols used and how they are combined to form fundamental units. In the Phrase Structure section, larger components of the language are described.

In the description of the language, the notation is as follows:

  • italic represents the syntactic groups that describe the language

  • A colon following a syntactic group indicates the definition (in terms of other groups or terminal symbols) to follow.

  • A | symbol or a newline indicates an alternative syntactic definition.

  • A ? symbol indicates an optional entity.

  • A * symbol after a syntactic group within braces {...}* indicates zero or more of the group.

  • Bold type indicates a terminal symbol (i.e. the symbol used in a program not the description of it). (The bold may not show clearly for all characters in the fonts installed on your system.)

In the following illustration of the notation, the unary_sign is optional; the term_expr is obligatory, and there may be zero or more {binary_sign term_expr} expressions. The { and } here indicate the group to which the '*' applies.

numeric_expr :
        unary_sign? term_expr {binary_sign term_expr}* 
      

In this illustration of the notation, the identifier, constant, CycleTime, TimeNow, and left_parenth numeric_expr right_parenth are all alternative definitions of a primary_expr. Note the bold type of the terminal symbols CycleTime and TimeNow.

primary_expr:
        identifier 
        constant 
        CycleTime
        TimeNow
        left_parenth bitwise_expr right_parenth
      

The following shows the use of the | symbol (rather than a new line) to separate the alternative terminal symbols * / % :

multiplier : * |  / | %