FpgaModule
- public abstract class StateStoreFpga<FpgaModule>
extends java.lang.Object
public static class Store extends StateStoreFpga < Reset > { final Q q; // reference to state of a PROCESS instance public Store(int time, Reset src) { super(time, src); // stores also the src as destination used for restore this.q = src.q; } (at)Override public int restore() { super.dst.q = this.q; // Restore exact in the used module as src return super.time; } }In this example the
q
is the reference which contains the current state of the module.
If the module has more as one PROCESS classes, then all of it should be stored.
Note: Only the reference is saved. The data are in the heap.
Because of the writing style of PROCESS classes anytime a new instance will be created,
hence the referenced instance for storing will not be changed.
This writing style is essential also for this store operation.
public static class Store extends StateStoreFpgaIt means on creation of the Store of the whole FPGA or also the whole simulation environment a{ final ModuleX.Store moduleX1; final Reset.Store reset; public Store(int time, MyWholeFpgaAndSimEnv thiz) { super(time, thiz.ref); //stores the reference to the Ref for restoring. this.reset = new Reset.Store(time, thiz.ref.clr); this.moduleX1 = new ModuleX.Store(thiz.ref.moduleX1); } (at)Override public int restore() { this.moduleX1.restore(); this.reset.restore(); return super.time; } }
Store
class is created which contains the reference to all Store classes of all modules,
whereas this Store classes are also created.
On restore()
the Store of the module knows the src module to restore,
so that no extra reference is necessary.
// Prepare the simulation .... // and execute some steps to get a defined state. ..... MyWholeFpgaAndSimEnv.Store storeAfterXyState = new MyWholeFpgaAndSimEnv.Store(this.time, this.fpgaAndSimEnv); // ==> store after 16 sync bits // ... execute some simulation starting from this state .... this.time = storeAfterXyState.restore(); // ... execute other simulations starting from this state .... this.time = storeAfterXyState.restore(); // ... execute third other simulations starting from this state ....For all this simulation variants you have the same start condition. The advantage is: A maybe complex simulation to get the state is not necessary. It may be also possible to save a state gotten from a real hardware situation, and start then some simulations. But this presumes, that you have a hardware tooling which saves the hardware state, and then a software which converts to the necessary Java data. This is generally possible. For example the state of all FlipFlop can be read with boundary scan or a built in specific logic. The conversion is depending of the given read possibility and data store format.
Modifier and Type | Field and Description |
---|---|
protected FpgaModule |
dst |
static java.lang.String |
sVersion
Version, history and license.
|
protected int |
time
The current time stamp for the storing the state.
|
Modifier | Constructor and Description |
---|---|
protected |
StateStoreFpga(int time,
FpgaModule src)
The super constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract int |
restore()
The implementing operation should restore the appropriate states of the module.
|
public static final java.lang.String sVersion
protected int time
Fpga.checkTime(int, int, int)
checks
depends on the current time stamp (restored) in comparison to the time stamp of the stored signals.protected FpgaModule dst
protected StateStoreFpga(int time, FpgaModule src)
public abstract int restore()
dst
- the modulereturn super.time
.
See remarks on time