You are on page 1of 7

Politecnico di Torino

Laurea Magistrale in Ingegneria Elettronica

Codesign Methods and Tools

Counter Report

Group 1:
Fabio Busignani 197883 Emanuele Gianoglio 200090

Anno Accademico 2013/2014

Vese1

root

Table of Contents
Exercise_counter .................................................................................................................................... 3

report counter.docx - 2013-10-15 - 12:42 PM Pag. 1 of 7

Vese1

root

Table of Figures
Exercise_counter .................................................................................................................................... 3

report counter.docx - 2013-10-15 - 12:42 PM Pag. 2 of 7

Vese1

root

Class Diagram Exercise_counter

Counter
A counter from MINCOUNT: int to MAXCOUNT: int, included. Counter starts its count with startCounter(): void, stops with stop(): void and can be reset exploiting reset(): void. When the User wants to view the reached value, it is possible through the function read(): void. When the Counter reach MAXCOUNT: int it restart the count from MINCOUNT: int.

Attributes
Signature
+MAXCOUNT : int const = 100 +MINCOUNT : int const = 0

Type Modifier

Initial Value
100

Documentation
MAXCOUNT: int is the maximum value that cnt: int can reach. MINCOUNT: int is the initial value of cnt: int. Furthermore, when is used reset(), cnt: int assume this value. cnt: int is the internal value of the counter and it is increased by inc(cnt: int): int. It can assume values between MINCOUNT: int and MAXCOUNT: int output: int shows the value reached by the Counter when User decides to stop(): void it. It keeps its value until there will be a new stop command.

-cnt : int = MINCOUNT

Counter.MINCOUN T

+output : int

report counter.docx - 2013-10-15 - 12:42 PM Pag. 3 of 7

Vese1

root

Operations
Name: inc, Signature: inc(cnt : int) : int inc(cnt: int): int is used in order to increase by one the value of cnt: int until it reach MAXCOUNT: int

Name: startCounter, Signature: startCounter() : void startCounter(): void is used in order to start increasing cnt: int with inc(cnt: int): int

Name: reset, Signature: reset() : void reset(): void is used in order to reset the Counter. The value of cnt: int becomes MINCOUNT: int and the value of output: int changes according to cnt: int to provide at the user the feedback of the successful reset operation.

Name: stop, Signature: stop() : void stop(): void stops the counter and the value of cnt: int is stored in output: int.

Name: read, Signature: read() : void read(): void provides at the User the value output: int reached by the Counter when stop(): void is used.

report counter.docx - 2013-10-15 - 12:42 PM Pag. 4 of 7

Vese1

root

report counter.docx - 2013-10-15 - 12:42 PM Pag. 5 of 7

You might also like