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> <form>
<input type="button" value="Trace more" onclick="updateLoglevel(++loglevel)" /> <input type="button" value="Trace more" onclick="updateLoglevel(++loglevel)" />
<input type="button" value="Trace less" onclick="updateLoglevel(--loglevel)" /> <input type="button" value="Trace less" onclick="updateLoglevel(--loglevel)" />
<input type="button" value="Headless Go" onclick="goFor()" />
</form> </form>
<br /> <br />
<div id="logstreamscroller"> <div id="logstreamscroller">

View File

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

View File

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