|
Message
From: cvs at opencores.org<cvs@o...>
Date: Sun Jun 25 14:41:27 CEST 2006
Subject: [cvs-checkins] MODIFIED: jop ...
Date: 00/06/06 25:14:41 Modified: jop/java/target/src/test/wcet/lift LiftControl.java Log: back to OO version Revision Changes Path 1.5 jop/java/target/src/test/wcet/lift/LiftControl.java http://www.opencores.org/cvsweb.shtml/jop/java/target/src/test/wcet/lift/LiftControl.java.diff?r1=1.4&r2=1.5 (In the diff below, changes in quantity of whitespace are not shown.) Index: LiftControl.java =================================================================== RCS file: /cvsroot/martin/jop/java/target/src/test/wcet/lift/LiftControl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- LiftControl.java 23 Jun 2006 14:47:08 -0000 1.4 +++ LiftControl.java 25 Jun 2006 12:41:27 -0000 1.5 @@ -317,24 +317,25 @@ } boolean checkRun(TalIo io) { - if(cmd==CMD_UP) { - if (cnt<endCnt-OFFSET && !io.in[SENS_TOP]) return true; - } - if(cmd==CMD_DOWN){ - if (cnt>endCnt+OFFSET && !io.in[SENS_BOTTOM]) return true; - } - if(cmd==CMD_TOP){ + + if (cmd == CMD_UP) { + if (cnt < endCnt - OFFSET && !io.in[SENS_TOP]) + return true; + } else if (cmd == CMD_DOWN) { + if (cnt > endCnt + OFFSET && !io.in[SENS_BOTTOM]) + return true; + } else if (cmd == CMD_TOP) { if (loadPending && io.in[SENS_LOAD]) { // we are at load position loadLevel = level; loadPending = false; return false; } - if (!io.in[SENS_TOP]) return true; + if (!io.in[SENS_TOP]) + return true; // for shure if load sensor does not work loadPending = false; - } - if(cmd==CMD_BOTTOM){ + } else if (cmd == CMD_BOTTOM) { if (loadPending) { if (loadSensor) { if (!io.in[SENS_LOAD]) { @@ -347,82 +348,12 @@ } loadSensor = io.in[SENS_LOAD]; } - if (!io.in[SENS_BOTTOM]) return true; + if (!io.in[SENS_BOTTOM]) + return true; } - - -// switch (cmd) { -// case CMD_UP: -// if (cnt<endCnt-OFFSET && !io.in[SENS_TOP]) return true; -// break; -// case CMD_DOWN: -// if (cnt>endCnt+OFFSET && !io.in[SENS_BOTTOM]) return true; -// break; -// case CMD_TOP: -// if (loadPending && io.in[SENS_LOAD]) { -// // we are at load position -// loadLevel = level; -// loadPending = false; -// return false; -// } -// if (!io.in[SENS_TOP]) return true; -// // for shure if load sensor does not work -// loadPending = false; -// break; -// case CMD_BOTTOM: -// if (loadPending) { -// if (loadSensor) { -// if (!io.in[SENS_LOAD]) { -// loadSensor = false; -// // we are at load position -// loadPending = false; -// loadLevel = level; -// return false; -// } -// } -// loadSensor = io.in[SENS_LOAD]; -// } -// if (!io.in[SENS_BOTTOM]) return true; -// break; -// } -
return false;
}
- // was private - public for WCET tests
- public void getVals() {
- int in0 = Native.rd(Const.IO_IN);
- int in1 = dly1;
- int in2 = dly2;
- dly2 = dly1;
- dly1 = in0;
- for (int i=0; i<10; ++i) { // @WCA loop=10
- // majority voting for input values
- // delays input value change by one period
- io.in[i] = ((in0&1) + (in1&1) + (in2&1)) > 1;
- in0 >>>= 1;
- in1 >>>= 1;
- in2 >>>= 1;
- }
- io.analog[0] = Native.rd(Const.IO_ADC1);
- io.analog[1] = Native.rd(Const.IO_ADC2);
- io.analog[2] = Native.rd(Const.IO_ADC3);
- }
-
- public void setVals() {
- int val = 0;
- for (int i=3; i>=0; --i) { // @WCA loop=3
- val <<= 1;
- val |= io.out[i] ? 1 : 0;
- }
- Native.wr(val, Const.IO_OUT);
- for (int i=13; i>=0; --i) { // @WCA loop=14
- val <<= 1;
- val |= io.led[i] ? 1 : 0;
- }
- Native.wr(val, Const.IO_LED);
- }
-
void dbg(TalIo io) {
Dbg.wr("cmd=");
|
 |