Discrete Time Simulation in SystemDotNet
Discrete Time Simulation in SystemDotNet
[email protected]
systemdotnet
2004-09-13
Norwegian University of Science and Technology (NTNU), Departement of Physical Electronics
SystemDotNet
What is discrete time simulation
[email protected]
– Event Queue: Schedules changes for signals
– Module: Logical collection of signals and
processes
[email protected]
Norwegian University of Science and Technology (NTNU), Departement of Physical Electronics
SystemDotNet
SystemDotNet Overview
Event queue and
simulator control
Modules
Output writers
Signals
[email protected]
Norwegian University of Science and Technology (NTNU), Departement of Physical Electronics
SystemDotNet
Divide and Conquer
[email protected]
• The Modules
In SystemDotNet
Run Events
20ns 20ns
[email protected]
30ns 30ns 30ns
if (!queue.ContainsKey(key))
[email protected]
queue.Add(key, new List<IRunnable>());
queue[key].Add(ite);
}
[email protected]
No
Remove events from the queue and
execute them
[email protected]
Norwegian University of Science and Technology (NTNU), Departement of Physical Electronics
SystemDotNet
The Simulator
[email protected]
Norwegian University of Science and Technology (NTNU), Departement of Physical Electronics
SystemDotNet
The Signals
[email protected]
• SignalCollection<Type>: Dynamic collection
of signals that can be used instead of
Signal<Type> array.
Norwegian University of Science and Technology (NTNU), Departement of Physical Electronics
SystemDotNet
SignalBase.SensitiveType
[email protected]
the signal content you should override Object.Equals
to determine if two objects are the same.
• Extend SignalBase
• Implement ISignal
• Override ToString()
• Implement AddListener and
[email protected]
RemoveListener
• Add Read and Write methods
[email protected]
internal override void AddListener(SignalBase c)
{
((Signal<T>)c).Wire.ValueUpdated += delegate(SignalValueHolder<T> sender) { this.Wire.Value =
sender.Value; };
}
[email protected]
//Add it to the event queue
Simulator.GetInstance().Write(te, delay);
}
[email protected]
public void Next()
{
Clk.Write(!Clk.Read(), 200);
}
}
[email protected]
simulator
• OnStop(): Called when the simulator stops
[email protected]
attribute and compares it to the signals in the
module. If they match it adds the method to
the Changed event of the signal
Norwegian University of Science and Technology (NTNU), Departement of Physical Electronics
SystemDotNet
Code run through of
SdnReferenceDesign
[email protected]
Norwegian University of Science and Technology (NTNU), Departement of Physical Electronics