25.07.2014 Views

VDM-10 Language Manual

VDM-10 Language Manual

VDM-10 Language Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 14. Top-level Specification (<strong>VDM</strong>++ and <strong>VDM</strong>-RT)<br />

The system “class” is limited in the way that it can only contain:<br />

Instance variables: The only instances that can be declared in the system “class” is of the<br />

special classes CPU and BUS as well as static instances of the different system components<br />

that one wish to allocate to different CPU’s.<br />

Constructor: The actual deployment of instances to CPU’s and setting of priorities for the<br />

different operations is set inside the constructor which is the only operation that can be<br />

placed in the system “class”. The only kind of statements that can be used inside this<br />

constructor is a block statement with a sequence of invocations of the special deploy<br />

and setPriority operations.<br />

In addition there are limitations with respect to the use of static declarations for instances<br />

that are deployed to different CPU’s. Basically the user should ensure that only one instance<br />

is deployed to a CPU if the class the instance comes from contains any static operations<br />

or functions. In case a static instance variable is used it is accessed directly (without any<br />

communication over the busses, so this in essence not proper from a distribution standpoint.<br />

Thus, all instance variables of instances to be deployed should only be accessed through the<br />

use of operations.<br />

Example: The system class could for example be defined as:<br />

✞<br />

system Simple<br />

instance variables<br />

static public a : A := new A();<br />

static public b : B := new B();<br />

-- define the first CPU with fixed priority scheduling<br />

-- and 22E6 MIPS<br />

CPU1 : CPU := new CPU (, 22E6);<br />

static public c : C := new C();<br />

-- define the second CPU with fixed priority scheduling<br />

-- and 11E6 MIPS<br />

CPU2 : CPU := new CPU (, 11E6);<br />

-- create a communication bus that links the three<br />

-- CPU’s together<br />

BUS1 : BUS := new BUS (, 72E3, {CPU1, CPU2})<br />

operations<br />

public Simple: () ==> Simple<br />

Simple () ==<br />

( -- deploy a on CPU1<br />

127

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!