index previous next 

 

file name: impl_sw.cpp
classification: pure simulation
contents: function implementations
use: contains the implementations for pure simulation for all functions that have different implementations in pure and hardware-based simulation
 

global items used by the functions:

 
local items used by the functions:

ACNodeList listOfFrequencies_: contains the clock frequencies set by function SetClockFrequency().

ACNodeList listOfPositions_: contains the position data set by function SetPosition().
 

local (static) functions:

void GetDefaultPosition (SMsgPosition& data): returns the default position data, where the data is added in front of the message buffer, and has the structure {INT32 area; ti_acx time;};
 

function implementations:

double GetClockFrequency (SINT32 nodeID, int area): Returns the frequency of a clock. The function is called by the Controller whenever a new CSA is created. If no frequency is stored, a default frequency (25 MHz) is returned.
note: in hardware-based simulation, you can ignore the nodeID.
note: If there is no frequency stored, the function should provide a default value. If there is no feasible default, use Assert() to guarantee that only valid frequencies are returned.
The function is declared in general.hpp.

INT8 GetClockIntLevel(): Returns the interrupt level of the UTCSU and LANCE interrupts. The levels should be equal (if they are not, correct behaviour of the simulation cannot be guaranteed).
The function is declared in interupt.hpp.

int GetClockIntvec (SINT32 nodeID, int area): Returns the clock interrupt vector for the area on the given node. The vector is computed from the nodeID and area. If area is greater or equal to NumberOfAreas or to 16, an assert fails.
note: when porting to hardware, return the appropriate interrupt vector and ignore the nodeID.
The function is declared in interupt.hpp.

double GetGlobalTime(): Returns the global time (in seconds).
The function is declared in general.hpp.

int GetGpsIntvec (SINT32 nodeID, int area, INT8 gpu): Returns the GPS-receiver interrupt vector for the area and nodeID. The GPS vector is obtained by adding 0x40000000 to the vector returned by GetClockIntvec(), parameter gpu is ignored.
note: when porting to hardware, return the appropriate vector for the area and gpu and ignore the nodeID.
The function is declared in interupt.hpp.

void GetPosition (SMsgPosition *data, SINT32 nodeID, SINT32 networkID):
Puts the length and position of all data that is automatically added to a message by the network into the appropriate fields of data. If there is no data stored by SetPosition(), the local function GetDefaultPosition() is used to obtain the default position data and this data is returned.
note: in hardware-based simulation, the nodeID is useless, because at compile-time it is not known. Instead, you could ignore the nodeID and compile a dedicated version for every target node (ie, implement the function for every target node).
note: If there is no data stored, the function should provide a default value. If there is no feasible default, use Assert() to guarantee that only valid data is returned.
The function is declared in general.hpp.

double GetSnapshotTime(): Returns the value of GetGlobalTime(). The function is called to timestamp Snapshot events.
note: in hardware-based simulation, the function should return the time of the last snapshot, taken from the master clock.
The function is declared in general.hpp.

void GetTransmitTimestamp (const CAddr& address, int area, const CClock *clock, STimestamp& time): Sets time.ms and time.ts to zero.
The function is declared in general.hpp.

void MakeSystemSnapshot(): Triggers a system snapshot on all clocks. The function goes through the listOfClocks, obtains the CClock pointers from the clock interface objects (cast to CSoftwareClock, since the function only exists in pure simulation), and calls HwSnapshot() for each clock. Of course, this assumes that all UTCSUs are hardwired together, regardless of their subnets.
note: in hardware-based simulation, the output register of an M-Module is hard-wired to the HWSNAP inputs of all UTCSUs. Just set and then clear the bit that triggers the snapshot.
The function is declared in general.hpp.

void SetClockFrequency (SINT32 nodeID, int area, double frequency):
Stores the frequency of a clock in the listOfFrequencies. The frequencies of all clocks should be set after the program is started (when calling the other initialization functions).
note: in hardware-based simulation, you can ignore the nodeID.
The function is declared in general.hpp.

void SetPosition (const SMsgPosition& data, SINT32 nodeID, SINT32 networkID): Stores the length and position of all data that is automatically added to a message by the network. The contents of data are put into the listOfPositions. The data should be set after the program is started (when calling the other initialization functions).
Note: the simulation assumes that all items have sizes between zero and four byte. In addition, the accuracy may only have a size of zero, two or four bytes. And if the size of the macrostamp is greater than zero, the timestamp must have a size of four bytes.
The function is declared in general.hpp.


last modified: Fri Feb 5 18:56:21 1999