28.02.2014 Views

Real-Time Programming Languages - Operating Systems

Real-Time Programming Languages - Operating Systems

Real-Time Programming Languages - Operating Systems

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Counting<br />

Specification COUNT:<br />

Count the number of occurrences of the input I seen so far, and<br />

broadcast it as the value of a COUNT signal at each new I.<br />

Gerard<br />

Berry<br />

module COUNT:<br />

01<br />

02<br />

03<br />

04<br />

05<br />

06<br />

input I;<br />

output COUNT := 0 : integer;<br />

every I do<br />

emit COUNT(pre(?COUNT) + 1)<br />

end every<br />

end module<br />

Beware:<br />

“emit COUNT(?COUNT+1)” is tempting but incorrect.<br />

WS 2013/14 <strong>Real</strong>-<strong>Time</strong> <strong>Systems</strong>, <strong>Real</strong>-<strong>Time</strong> Prog. <strong>Languages</strong> / Hermann Härtig 14

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

Saved successfully!

Ooh no, something went wrong!