Headless mode in expert

This commit is contained in:
Barry Silverman 2010-10-14 22:48:25 -04:00
parent 10787078c8
commit 5a4c574765
3 changed files with 25 additions and 8 deletions

View File

@ -75,6 +75,7 @@ function handleOnload() {
<form>
<input type="button" value="Trace more" onclick="updateLoglevel(++loglevel)" />
<input type="button" value="Trace less" onclick="updateLoglevel(--loglevel)" />
<input type="button" value="Headless Go" onclick="goFor()" />
</form>
<br />
<div id="logstreamscroller">

View File

@ -57,7 +57,7 @@ var animateChipLayout = true;
var userCode=[];
var userResetLow;
var userResetHigh;
var userSteps;
var userSteps=1000;
var testprogram=[];
var testprogramAddress;
@ -148,7 +148,7 @@ function setupParams(){
// run a test program, and optionally check against a golden checksum
if(name=="steps" && parseInt(value)!=NaN){
userSteps=parseInt(value);
running=true;
// running=true;
} else if(name=="checksum" && parseInt(value,16)!=NaN){
goldenChecksum=(0x100000000+parseInt(value,16)).toString(16).slice(-8);
} else {

View File

@ -52,12 +52,12 @@ function loadProgram(){
}
function go(){
if(userSteps!=undefined){
if(--userSteps==0){
running=false;
userSteps=undefined;
}
}
// if(userSteps!=undefined){
// if(--userSteps==0){
// running=false;
// userSteps=undefined;
// }
// }
if(running) {
step();
setTimeout(go, 0); // schedule the next poll
@ -385,14 +385,30 @@ function chipStatus(){
selectCell(ab);
}
function goFor(){
var n = userSteps;
estimatedHz1();
while(--n){
halfStep();
cycle++;
}
estimatedHz1();
chipStatus();
}
var prevHzTimeStamp=0;
var prevHzCycleCount=0;
var prevHzEstimate1=1;
var prevHzEstimate2=1;
var HzSamplingRate=10;
function estimatedHz(){
if(cycle%HzSamplingRate!=3)
return prevHzEstimate1;
return estimatedHz1();
}
function estimatedHz1(){
var HzTimeStamp = now();
var HzEstimate = (cycle-prevHzCycleCount+.01)/(HzTimeStamp-prevHzTimeStamp+.01);
HzEstimate=HzEstimate*1000/2; // convert from phases per millisecond to Hz