').appendTo(overlay);
this.split = Split( [topdiv[0], this.wavediv[0]], {
@@ -580,6 +580,9 @@ var VerilogPlatform = function(mainElement, options) {
//trace_ports = current_output.ports;
trace_signals = current_output.ports.concat(current_output.signals); // combine ports + signals
trace_signals = trace_signals.filter((v) => { return !v.name.startsWith("__V"); }); // remove __Vclklast etc
+ for (var v of trace_signals) {
+ v.label = v.name.replace(/__DOT__/g, "."); // make nicer name
+ }
trace_index = 0;
// power on module
this.poweron();
diff --git a/src/ui.ts b/src/ui.ts
index 4b1ca752..bd713201 100644
--- a/src/ui.ts
+++ b/src/ui.ts
@@ -15,7 +15,7 @@ import { getFilenameForPath, getFilenamePrefix, highlightDifferences, invertMap,
import { StateRecorderImpl } from "./recorder";
// external libs (TODO)
-declare var ga, Tour, GIF, saveAs, JSZip;
+declare var ga, Tour, GIF, saveAs, JSZip, Mousetrap;
// in index.html
declare var exports;
@@ -223,7 +223,8 @@ function getSkeletonFile(fileid:string, callback) {
}
function _createNewFile(e) {
- var filename = prompt("Create New File", "newfile" + platform.getDefaultExtension());
+ // TODO: support spaces
+ var filename = prompt("Create New File (no spaces)", "newfile" + platform.getDefaultExtension());
if (filename && filename.length) {
if (filename.indexOf(".") < 0) {
filename += platform.getDefaultExtension();
@@ -599,6 +600,13 @@ function resume() {
userPaused = false;
}
+function togglePause() {
+ if (platform.isRunning())
+ pause();
+ else
+ resume();
+}
+
function singleStep() {
setupBreakpoint("step");
platform.step();
@@ -816,29 +824,41 @@ function _toggleRecording() {
}
function setupDebugControls(){
+
$("#dbg_reset").click(resetAndDebug);
$("#dbg_pause").click(pause);
$("#dbg_go").click(resume);
+ Mousetrap.bindGlobal('ctrl+alt+p', togglePause);
+ Mousetrap.bindGlobal('ctrl+alt+r', resetAndDebug);
- if (platform.step)
+ if (platform.step) {
$("#dbg_step").click(singleStep).show();
- else
+ Mousetrap.bindGlobal('ctrl+alt+s', singleStep);
+ } else
$("#dbg_step").hide();
- if (platform.runToVsync)
+
+ if (platform.runToVsync) {
$("#dbg_tovsync").click(singleFrameStep).show();
- else
+ Mousetrap.bindGlobal('ctrl+alt+v', singleFrameStep);
+ } else
$("#dbg_tovsync").hide();
- if ((platform.runEval || platform.runToPC) && platform_id != 'verilog')
+
+ if ((platform.runEval || platform.runToPC) && platform_id != 'verilog') {
$("#dbg_toline").click(runToCursor).show();
- else
+ Mousetrap.bindGlobal('ctrl+alt+l', runToCursor);
+ } else
$("#dbg_toline").hide();
- if (platform.runUntilReturn)
+
+ if (platform.runUntilReturn) {
$("#dbg_stepout").click(runUntilReturn).show();
- else
+ Mousetrap.bindGlobal('ctrl+alt+o', runUntilReturn);
+ } else
$("#dbg_stepout").hide();
- if (platform.stepBack)
+
+ if (platform.stepBack) {
$("#dbg_stepback").click(runStepBackwards).show();
- else
+ Mousetrap.bindGlobal('ctrl+alt+b', runStepBackwards);
+ } else
$("#dbg_stepback").hide();
if (platform.newCodeAnalyzer) {
diff --git a/src/views.ts b/src/views.ts
index 839a3208..3050bdb2 100644
--- a/src/views.ts
+++ b/src/views.ts
@@ -279,8 +279,8 @@ export class SourceEditor implements ProjectView {
getActiveLine() {
var state = lastDebugState;
if (state && state.c && this.sourcefile) {
- var PC = state.c.PC;
- var line = this.sourcefile.findLineForOffset(PC, 15);
+ var EPC = state.c.EPC || state.c.PC;
+ var line = this.sourcefile.findLineForOffset(EPC, 15);
return line;
} else
return -1;
@@ -529,7 +529,7 @@ export class ListingView extends DisassemblerView implements ProjectView {
this.refreshListing();
if (!this.assemblyfile) return; // TODO?
var state = lastDebugState || platform.saveState();
- var pc = state.c ? state.c.PC : 0;
+ var pc = state.c ? (state.c.PC || state.c.EPC) : 0;
var asmtext = this.assemblyfile.text;
var disasmview = this.getDisasmView();
if (platform_id == 'base_z80') { // TODO
diff --git a/src/vlist.js b/src/vlist.js
index 086c948f..3eac01b8 100644
--- a/src/vlist.js
+++ b/src/vlist.js
@@ -136,6 +136,7 @@ VirtualList.prototype._renderChunk = function(node, from) {
VirtualList.createContainer = function(w, h) {
var c = document.createElement('div');
+ c.classList.add('vlist');
c.style.width = w;
c.style.height = h;
c.style.overflow = 'auto';
diff --git a/src/waveform.ts b/src/waveform.ts
index 4138eb7b..383fa7bd 100644
--- a/src/waveform.ts
+++ b/src/waveform.ts
@@ -3,7 +3,7 @@ declare var VirtualList;
declare var Mousetrap;
export interface WaveformMeta {
- name : string;
+ label : string;
len : number;
}
@@ -44,7 +44,7 @@ export class WaveformView {
destroy() {
// remove old thing
if (this.wavelist) {
- $(this.parent).empty();
+ $(this.wavelist.container).remove();
}
}
@@ -61,7 +61,7 @@ export class WaveformView {
itemHeight: rowHeight,
totalRows: this.meta.length,
generatorFn: (row : number) => {
- var s = this.meta[row].name;
+ var s = this.meta[row].label;
var linediv = document.createElement("div");
var canvas = document.createElement("canvas");
canvas.width = width - 4;
@@ -79,7 +79,7 @@ export class WaveformView {
$(this.parent).append(wlc);
var down = false;
var selfn = (e) => {
- this.setSelTime(e.offsetX / this.zoom + this.t0);
+ this.setSelTime(e.offsetX / this.zoom + this.t0 - 0.5);
};
$(wlc).mousedown( (e) => {
down = true;
@@ -93,6 +93,9 @@ export class WaveformView {
down = false;
//if (e['pointerId']) e.target.releasePointerCapture(e['pointerId']);
});
+ Mousetrap(wlc).bind('=', (e,combo) => {
+ this.setZoom(this.zoom * 2);
+ });
Mousetrap(wlc).bind('+', (e,combo) => {
this.setZoom(this.zoom * 2);
});
@@ -111,22 +114,13 @@ export class WaveformView {
Mousetrap(wlc).bind('ctrl+right', (e,combo) => {
this.setSelTime(this.tsel + this.clocksPerPage/4);
});
+ Mousetrap(wlc).bind('ctrl+shift+left', (e,combo) => {
+ this.setSelTime(0);
+ this.setOrgTime(0);
+ });
$(window).resize(() => {
this.recreate();
}); // TODO: remove?
- // assign buttons
- $("#scope_go_start").click(() => {
- this.setOrgTime(0);
- });
- $("#scope_go_end").click(() => {
- // TODO
- });
- $("#scope_go_fwd").click(() => {
- this.setOrgTime(this.t0 + this.clocksPerPage/4);
- });
- $("#scope_go_back").click(() => {
- this.setOrgTime(this.t0 - this.clocksPerPage/4);
- });
}
roundT(t : number) {
@@ -147,9 +141,9 @@ export class WaveformView {
setSelTime(t : number) {
t = this.roundT(t);
- if (t > this.t0 + this.clocksPerPage)
+ if (t >= this.t0 + this.clocksPerPage - 1)
this.t0 += this.clocksPerPage / 4;
- if (t < this.t0)
+ if (t <= this.t0 + 2)
this.t0 -= this.clocksPerPage / 4;
this.tsel = t;
this.setOrgTime(this.t0);
@@ -173,7 +167,7 @@ export class WaveformView {
var canvas = this.lines[row];
var meta = this.meta[row];
if (!canvas || !meta) return;
- var isclk = (meta.name == 'clk');
+ var isclk = (meta.label == 'clk');
var w = canvas.width;
var h = canvas.height;
var ctx = canvas.getContext("2d");
@@ -234,9 +228,7 @@ export class WaveformView {
// draw labels
ctx.fillStyle = "white";
ctx.textAlign = "left";
- var name = meta.name;
- name = name.replace(/__DOT__/g, "."); // make nicer name
- ctx.fillText(name, 5, fh);
+ ctx.fillText(meta.label, 5, fh);
}
}
diff --git a/testwave.html b/testwave.html
index 9c49a968..29e2ad5d 100644
--- a/testwave.html
+++ b/testwave.html
@@ -22,70 +22,6 @@ body {
-