Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

SIGEL_Simulation::SIG_Register Class Reference

This class represents one register. More...

#include <SIG_Register.h>

List of all members.

Public Methods

 SIG_Register (int size) throw (SIG_RegisterWrongSizeException)
 Constructs a register with size bits. More...

void copyReg (SIG_Register const& otherRegister)
 Copies the value of the supplied SIG_Register into this SIG_Register. More...

void addReg (SIG_Register const& otherRegister)
 Adds the value of the supplied SIG_Register to this SIG_Register's value. More...

void subReg (SIG_Register const& otherRegister)
 Substracts the value of the supplied SIG_Register from this SIG_Register's value. More...

void loadValue (int newValue)
 Sets this SIG_Register's value to newValue. More...

void mulReg (SIG_Register const& otherRegister)
 Multiplies this SIG_Register's value with the supplied ones. More...

void divReg (SIG_Register const& otherRegister)
 Divides this SIG_Register's value by the supplied ones. More...

void minReg (SIG_Register const& otherRegister)
 Sets this SIG_Register's value to the minimum of value and otherRegister.value. More...

void maxReg (SIG_Register const& otherRegister)
 Sets this SIG_Register's value to the maximum of value and otherRegister.value. More...

void modReg (SIG_Register const& otherRegister)
 Modulo-divides this SIG_Register's value by the supplied ones. More...

int getValue () const
int getSize () const
 Returns the size of the register. More...

int getMaxValue () const
 Returns the maximal value the register is able to hold. More...

int getMinValue () const
 Returns the minimal value the register is able to hold. More...


Private Methods

void makeValid ()
 Produces the condition that . More...


Private Attributes

int value
 The value of the Register. More...

int size
 The size of this SIG_Register in bits. More...


Detailed Description

This class represents one register.

The interpreter holds an QVector of Registers. At the moment every register is an integer value that holds the condition .

Definition at line 16 of file SIG_Register.h.


Constructor & Destructor Documentation

SIGEL_Simulation::SIG_Register::SIG_Register ( int size ) throw (SIG_RegisterWrongSizeException)
 

Constructs a register with size bits.

Exceptions:
SIG_RegisterWrongSizeException   The supplid size parameter was .
SIG_RegisterWrongSizeException   The supplid size parameter was .

Postcondition:
size is set to parameter size, if .
value is set to 0.
Parameters:
size   The desired size of this SIG_Register in Bits. Has to be and .

Definition at line 4 of file SIG_Register.cpp.


Member Function Documentation

void SIGEL_Simulation::SIG_Register::addReg ( SIG_Register const & otherRegister )
 

Adds the value of the supplied SIG_Register to this SIG_Register's value.

Parameters:
otherRegister   The SIG_Register object whose value is to be added.

Postcondition:
.

Definition at line 33 of file SIG_Register.cpp.

void SIGEL_Simulation::SIG_Register::copyReg ( SIG_Register const & otherRegister )
 

Copies the value of the supplied SIG_Register into this SIG_Register.

Parameters:
otherRegister   The SIG_Register object whose value is to be copied.

Postcondition:
.

Definition at line 27 of file SIG_Register.cpp.

void SIGEL_Simulation::SIG_Register::divReg ( SIG_Register const & otherRegister )
 

Divides this SIG_Register's value by the supplied ones.

The result is rounded toward zero.

Parameters:
otherRegister   The SIG_Register to divide by.

Postcondition:
.

Definition at line 57 of file SIG_Register.cpp.

int SIGEL_Simulation::SIG_Register::getMaxValue ( ) const
 

Returns the maximal value the register is able to hold.

Returns:
The maximal value the register is able to hold.

Definition at line 109 of file SIG_Register.cpp.

int SIGEL_Simulation::SIG_Register::getMinValue ( ) const
 

Returns the minimal value the register is able to hold.

Returns:
The minimal value the register is able to hold.

Definition at line 114 of file SIG_Register.cpp.

int SIGEL_Simulation::SIG_Register::getSize ( ) const
 

Returns the size of the register.

Returns:
The size of the register.

Definition at line 104 of file SIG_Register.cpp.

int SIGEL_Simulation::SIG_Register::getValue ( ) const
 

Returns:
This SIG_Register's integer-value.

Postcondition:
.

Definition at line 99 of file SIG_Register.cpp.

void SIGEL_Simulation::SIG_Register::loadValue ( int newValue )
 

Sets this SIG_Register's value to newValue.

Parameters:
newValue   The integer-value to which this SIG_Register's value is to be set.

Postcondition:
.

Definition at line 45 of file SIG_Register.cpp.

void SIGEL_Simulation::SIG_Register::makeValid ( ) [private]
 

Produces the condition that .

In the case value is set to . In the case value is set to . This method is called by load, add, sub, mul, div and mod.

Postcondition:
.

Definition at line 14 of file SIG_Register.cpp.

Referenced by addReg(), divReg(), loadValue(), modReg(), mulReg(), and subReg().

void SIGEL_Simulation::SIG_Register::maxReg ( SIG_Register const & otherRegister )
 

Sets this SIG_Register's value to the maximum of value and otherRegister.value.

Parameters:
otherRegister   The SIG_Register to compare with.

Postcondition:
.

Definition at line 73 of file SIG_Register.cpp.

void SIGEL_Simulation::SIG_Register::minReg ( SIG_Register const & otherRegister )
 

Sets this SIG_Register's value to the minimum of value and otherRegister.value.

Parameters:
otherRegister   The SIG_Register to compare with.

Postcondition:
.

Definition at line 66 of file SIG_Register.cpp.

void SIGEL_Simulation::SIG_Register::modReg ( SIG_Register const & otherRegister )
 

Modulo-divides this SIG_Register's value by the supplied ones.

Parameters:
otherRegister   The SIG_Register to modulo-divide by.

Postcondition:
.

Definition at line 80 of file SIG_Register.cpp.

void SIGEL_Simulation::SIG_Register::mulReg ( SIG_Register const & otherRegister )
 

Multiplies this SIG_Register's value with the supplied ones.

Parameters:
otherRegister   The SIG_Register to multiply with.

Postcondition:
.

Definition at line 51 of file SIG_Register.cpp.

void SIGEL_Simulation::SIG_Register::subReg ( SIG_Register const & otherRegister )
 

Substracts the value of the supplied SIG_Register from this SIG_Register's value.

Parameters:
otherRegister   The SIG_Register object whose value is to be substracted.

Postcondition:
.

Definition at line 39 of file SIG_Register.cpp.


Member Data Documentation

int SIGEL_Simulation::SIG_Register::size [private]
 

The size of this SIG_Register in bits.

Definition at line 182 of file SIG_Register.h.

int SIGEL_Simulation::SIG_Register::value [private]
 

The value of the Register.

It is always .

Definition at line 177 of file SIG_Register.h.


The documentation for this class was generated from the following files:
Generated at Mon Sep 3 01:32:54 2001 for PG 368 - SIGEL by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000