mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-17 08:55:05 -04:00
fixed bug concerning speed testing
This commit is contained in:
parent
377674f7c4
commit
7d22c4c273
@ -31,7 +31,7 @@ This are the main features of Digital:
|
|||||||
- You can test your design by creating test cases and execute them.
|
- You can test your design by creating test cases and execute them.
|
||||||
- Many examples: From a transmission gate D-flipflop to a complete (simple) MIPS-like processor.
|
- Many examples: From a transmission gate D-flipflop to a complete (simple) MIPS-like processor.
|
||||||
- Fast-run mode to perform a simulation without updating the HMI.
|
- Fast-run mode to perform a simulation without updating the HMI.
|
||||||
A simple processor can be clocked at 3MHz.
|
A simple processor can be clocked at 100kHz.
|
||||||
- Displaying a LST file when executing assembler programs within such a processor.
|
- Displaying a LST file when executing assembler programs within such a processor.
|
||||||
- Simple remote TCP interface to allow e.g. an assembler IDE to control the simulator.
|
- Simple remote TCP interface to allow e.g. an assembler IDE to control the simulator.
|
||||||
- SVG export of circuits, including a LaTeX-compatible SVG version (see [ctan](https://www.ctan.org/tex-archive/info/svg-inkscape))
|
- SVG export of circuits, including a LaTeX-compatible SVG version (see [ctan](https://www.ctan.org/tex-archive/info/svg-inkscape))
|
||||||
@ -105,7 +105,7 @@ Logisim works somewhat different, which sometimes leads to surprises like unexpe
|
|||||||
|
|
||||||
If a complete processors is simulated, it is possible to calculate the simulation without an update of the
|
If a complete processors is simulated, it is possible to calculate the simulation without an update of the
|
||||||
graphical representation.
|
graphical representation.
|
||||||
A simple processor (see example) can so simulated with a roughly 3MHz clock (Intel® Core ™ i5-3230M CPU @ 2.60GHz)
|
A simple processor (see example) can so simulated with a roughly 100kHz clock (Intel® Core ™ i5-3230M CPU @ 2.60GHz)
|
||||||
which is suitable also for more complex exercises.
|
which is suitable also for more complex exercises.
|
||||||
There is a break gate having a single input. If this input changes from low to high this quick run is stopped.
|
There is a break gate having a single input. If this input changes from low to high this quick run is stopped.
|
||||||
In this way, an assembler instruction BRK can be implemented, which then can be used to insert break points
|
In this way, an assembler instruction BRK can be implemented, which then can be used to insert break points
|
||||||
|
@ -26,7 +26,7 @@ Folgende Features zeichnen Digital aus:
|
|||||||
- Analyse und Synthese von kombinatorischen Schaltungen und Schaltwerken.
|
- Analyse und Synthese von kombinatorischen Schaltungen und Schaltwerken.
|
||||||
- Viele Beispiele: Vom Transmision-Gate D-FF bis zum kompletten MIPS-ähnlichem Prozessor.
|
- Viele Beispiele: Vom Transmision-Gate D-FF bis zum kompletten MIPS-ähnlichem Prozessor.
|
||||||
- Fast-Run-Mode um eine Simulation ohne Aktualisierung des HMI durchzuführen.
|
- Fast-Run-Mode um eine Simulation ohne Aktualisierung des HMI durchzuführen.
|
||||||
Ein einfacher Prozessor kann mit 3MHz getaktet werden.
|
Ein einfacher Prozessor kann mit 100kHz getaktet werden.
|
||||||
- Anzeige von LST-Files bei der Ausführung von Assembler-Programmen.
|
- Anzeige von LST-Files bei der Ausführung von Assembler-Programmen.
|
||||||
- Einfache Remote TCP-Schnittstelle um z.B. mit einer Assembler-IDE den Simulator zu steuern.
|
- Einfache Remote TCP-Schnittstelle um z.B. mit einer Assembler-IDE den Simulator zu steuern.
|
||||||
- SVG-Export von Schaltungen, incl. einer LaTeX-tauglichen SVG-Variante (siehe [ctan](ftp://ftp.fau.de/ctan/info/svg-inkscape/InkscapePDFLaTeX.pdf))
|
- SVG-Export von Schaltungen, incl. einer LaTeX-tauglichen SVG-Variante (siehe [ctan](ftp://ftp.fau.de/ctan/info/svg-inkscape/InkscapePDFLaTeX.pdf))
|
||||||
@ -97,7 +97,7 @@ Logisim arbeitet hier etwas anders, was gelegentlich zu Überraschungen führt,
|
|||||||
### Performance ###
|
### Performance ###
|
||||||
|
|
||||||
Werden komplette Prozessoren simuliert, ist es möglich die Simulation zu berechnen ohne die grafische Anzeige zu aktualisieren.
|
Werden komplette Prozessoren simuliert, ist es möglich die Simulation zu berechnen ohne die grafische Anzeige zu aktualisieren.
|
||||||
Ein einfacher Prozessor (siehe Beispiel) lässt sich so mit etwa 3MHz takten (Intel® Core™ i5-3230M CPU @ 2.60GHz) was auch für
|
Ein einfacher Prozessor (siehe Beispiel) lässt sich so mit etwa 100kHz takten (Intel® Core™ i5-3230M CPU @ 2.60GHz) was auch für
|
||||||
komplexere Übungen ausreichend ist.
|
komplexere Übungen ausreichend ist.
|
||||||
Es gibt ein Break-Gatter welches einen einzelnen Eingang hat. Wechselt dieser Eingang von low auf high wird dieser
|
Es gibt ein Break-Gatter welches einen einzelnen Eingang hat. Wechselt dieser Eingang von low auf high wird dieser
|
||||||
schnelle Lauf beendet. Auf diese Weise lässt sich eine Assembler-Anweisung BRK implementieren, womit sich dann Break-Points
|
schnelle Lauf beendet. Auf diese Weise lässt sich eine Assembler-Anweisung BRK implementieren, womit sich dann Break-Points
|
||||||
|
@ -49,6 +49,7 @@ public class SpeedTest {
|
|||||||
for (int i = 0; i < LOOPCOUNTER; i++) {
|
for (int i = 0; i < LOOPCOUNTER; i++) {
|
||||||
state = 1 - state;
|
state = 1 - state;
|
||||||
clockValue.setValue(state);
|
clockValue.setValue(state);
|
||||||
|
model.doStep();
|
||||||
}
|
}
|
||||||
loops++;
|
loops++;
|
||||||
aktTime = System.currentTimeMillis();
|
aktTime = System.currentTimeMillis();
|
||||||
|
@ -110,16 +110,23 @@ public class RealTimeClock implements ModelStateObserver {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
System.out.println("thread start");
|
System.out.println("thread start");
|
||||||
|
long time= System.currentTimeMillis();
|
||||||
|
long counter=0;
|
||||||
try {
|
try {
|
||||||
while (!interrupted()) {
|
while (!interrupted()) {
|
||||||
modelSync.accessNEx(() -> {
|
modelSync.accessNEx(() -> {
|
||||||
output.setValue(1 - output.getValue());
|
output.setValue(1 - output.getValue());
|
||||||
model.doStep();
|
model.doStep();
|
||||||
});
|
});
|
||||||
|
counter++;
|
||||||
}
|
}
|
||||||
} catch (NodeException e1) {
|
} catch (NodeException e1) {
|
||||||
stopper.showErrorAndStopModel(Lang.get("msg_clockError"), e1);
|
stopper.showErrorAndStopModel(Lang.get("msg_clockError"), e1);
|
||||||
}
|
}
|
||||||
|
time=System.currentTimeMillis()-time;
|
||||||
|
|
||||||
|
System.out.println(counter/time/2+"kHz");
|
||||||
|
|
||||||
System.out.println("thread end");
|
System.out.println("thread end");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -20,6 +20,7 @@ public class GuiModelObserver implements Observer, ModelStateObserver {
|
|||||||
private final CircuitComponent component;
|
private final CircuitComponent component;
|
||||||
private final ModelEvent type;
|
private final ModelEvent type;
|
||||||
private boolean changed = false;
|
private boolean changed = false;
|
||||||
|
private volatile boolean paintPending;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance.
|
* Creates a new instance.
|
||||||
@ -40,9 +41,13 @@ public class GuiModelObserver implements Observer, ModelStateObserver {
|
|||||||
@Override
|
@Override
|
||||||
public void handleEvent(ModelEvent event) {
|
public void handleEvent(ModelEvent event) {
|
||||||
if (changed && event == type) {
|
if (changed && event == type) {
|
||||||
|
if (!paintPending) {
|
||||||
|
paintPending = true;
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
component.paintImmediately(0, 0, component.getWidth(), component.getHeight());
|
component.paintImmediately(0, 0, component.getWidth(), component.getHeight());
|
||||||
|
paintPending = false;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
changed = false;
|
changed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,11 +255,12 @@ public class CircuitComponent extends JComponent {
|
|||||||
this.modelSync = modelSync;
|
this.modelSync = modelSync;
|
||||||
if (runMode)
|
if (runMode)
|
||||||
mouseRun.activate();
|
mouseRun.activate();
|
||||||
else
|
else {
|
||||||
mouseNormal.activate();
|
mouseNormal.activate();
|
||||||
requestFocusInWindow();
|
|
||||||
circuit.clearState();
|
circuit.clearState();
|
||||||
}
|
}
|
||||||
|
requestFocusInWindow();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the high lighted elements
|
* @return the high lighted elements
|
||||||
|
Loading…
x
Reference in New Issue
Block a user