UART.java

1
// Copyright © 2004-2006 University of Helsinki, Department of Computer Science
2
// Copyright © 2012 various contributors
3
// This software is released under GNU Lesser General Public License 2.1.
4
// The license text is at http://www.gnu.org/licenses/lgpl-2.1.html
5
6
package fi.helsinki.cs.titokone.devices;
7
8
import fi.helsinki.cs.titokone.*;
9
10
import java.io.*;
11
import java.net.*;
12
13
/**
14
 * a small UART to connect to neighboring machines.
15
 * port 0 - data port,write to send/read to receive
16
 * will only send/receive the lowest 8 bits
17
 * ie. a byte at a time
18
 * port 1 - state port read to get state, write to modify
19
 * modifiable bits.
20
 * bit 0 write FIFO has data
21
 * bit 1 read FIFO has data
22
 * bit 2 Connected/RI (somebody is connecting to us)
23
 * bit 3 Clear To Send (other end is connected and FIFO has
24
 * space
25
 * bit 4 write FIFO is full
26
 * bit 5 read FIFO is full
27
 * bit 29 enable RI interrupt
28
 * bit 30 enable write FIFO empty interrupt
29
 * bit 31 enable read FIFO full interrupt
30
 * port 2 control port
31
 * write 0 to disconnect
32
 * write 1 followed by ipaddress followed by port in lowest
33
 * 16 bits to connect
34
 * write 1 followed by 0 and port in lowest 16 bits to
35
 * listen
36
 * write 1 followed by two 0 to listen to a random port
37
 * read to get the address of the other end
38
 * <p/>
39
 * speed of the UART is approximately 1 bit every 10 clock cycles
40
 */
41
public class UART
42
        implements IODevice,
43
        InterruptGenerator {
44
    protected Interruptable pic;
45
    protected int cyclesPerBit;
46 3
    protected int accumulatedCycles = 0;
47 3
    protected int accumulatedReadCycles = 0;
48 3
    protected int[] fifoIn = new int[16];
49 3
    protected int[] fifoOut = new int[16];
50 12
    protected int inLeft = 0, inRight = 0, outLeft = 0, outRight = 0;
51 1
    protected CommandState state = CommandState.Normal;
52 3
    protected int remoteAddress = 0xffffffff;
53 3
    protected int remotePort = 0xffffffff;
54
    protected Socket socket;
55
    protected ServerSocket sSock;
56
    protected InputStream in;
57
    protected OutputStream out;
58
    protected int status;
59 3
    protected int modifiable = (0x80000000 | 0x40000000 | 0x20000000);
60
61
62
    public UART(int speed) {
63 1
        cyclesPerBit = speed;
64
    }
65
66
    public int getPortCount() {
67 3
        return 3;
68
    }
69
70
    @Override
71
    public int getPort(int n) {
72 1
        if (n == 0) {
73 2
            if (inEmpty()) {
74 3
                return 0;
75
            }
76
            int ret = fifoIn[inLeft];
77 7
            inLeft = (inLeft + 1) % 16;
78 1
            updateBits();
79 1
            return ret;
80
        }
81 3
        if (n == 1) {
82 1
            return status;
83
        }
84 3
        if (n == 2) {
85 1
            return remoteAddress;
86
        }
87 5
        throw new RuntimeException("should not be possible " + n);
88
    }
89
90
    @Override
91
    public void setPort(int n, int value) {
92
        try {
93 8
            switch (state) {
94
                case Connect:
95 1
                    remoteAddress = value;
96 1
                    state = CommandState.Port;
97
                    return;
98
                case Port:
99 1
                    remotePort = value;
100 1
                    state = CommandState.Normal;
101
                    return;
102
            }
103 1
            if (n == 0) {
104 2
                if (!outFull()) {
105
                    fifoOut[outRight] = value;
106 7
                    outRight = (outRight + 1) % 16;
107 1
                    updateBits();
108
                }
109
                return;
110
            }
111 3
            if (n == 1) {
112 1
                value = modifiable & value;
113 6
                status = (((0xffffffff ^ modifiable) & status) | (value));
114
                return;
115
            }
116 3
            if (n == 2) {
117
                switch (value) {
118
                    case 0:
119 1
                        socket.close();
120 1
                        sSock = null;
121
                        return;
122
                    case 1:
123 1
                        state = CommandState.Connect;
124
                        return;
125
                }
126
            }
127
        } catch (IOException ioe) {
128 1
            ioe.printStackTrace();
129
        }
130 5
        throw new RuntimeException("should not be possible " + n);
131
    }
132
133
    public void reset() {
134 3
        accumulatedCycles = 0;
135 3
        accumulatedReadCycles = 0;
136 3
        fifoIn = new int[16];
137 3
        fifoOut = new int[16];
138 1
        sSock = null;
139 1
        socket = null;
140 1
        state = CommandState.Normal;
141 4
        remotePort = remoteAddress = 0xffffffff;
142
    }
143
144
    public void update() {
145
        try {
146 7
            if (socket == null && remoteAddress != 0xffffffff && remotePort != 0xffffffff) {
147 1
                if (remoteAddress == 0) {
148 2
                    sSock = new ServerSocket(remotePort);
149 4
                    new Thread(new Runnable() {
150
                        public void run() {
151
                            try {
152 1
                                while (sSock != null) {
153 2
                                    socket = sSock.accept();
154 2
                                    in = socket.getInputStream();
155 2
                                    out = socket.getOutputStream();
156 4
                                    remoteAddress = intify(socket.getInetAddress().getAddress());
157 2
                                    remotePort = socket.getPort();
158 3
                                    setBit(2);
159 4
                                    if (getBit(29)) {
160 1
                                        pic.flagInterrupt(UART.this);
161
                                    }
162 1
                                    while (socket != null) {
163
                                        try {
164 3
                                            Thread.sleep(200);
165
                                        } catch (InterruptedException ie) {
166
                                        }
167
                                    }
168 3
                                    unsetBit(2);
169
                                }
170
                            } catch (IOException ioe) {
171 1
                                ioe.printStackTrace();
172 3
                                unsetBit(2);
173
                            }
174
                        }
175
                    }).start();
176
                } else {
177 4
                    socket = new Socket(InetAddress.getByAddress(bytify(remoteAddress)), remotePort);
178 2
                    in = socket.getInputStream();
179 2
                    out = socket.getOutputStream();
180 3
                    setBit(2);
181
                }
182
            }
183 1
            if (socket != null) {
184 2
                if (!socket.isConnected()) {
185 1
                    socket = null;
186 1
                    in = null;
187 1
                    out = null;
188 3
                    unsetBit(2);
189 4
                    accumulatedReadCycles = accumulatedCycles = 0;
190 3
                    remoteAddress = 0xffffffff;
191 3
                    remotePort = 0xffffffff;
192
                } else {
193
                    /*  accumulate cycles and read*/
194 3
                    if (in.available() > 0) {
195 4
                        accumulatedReadCycles++;
196
                    }
197 10
                    if (!inFull() &&
198
                            in.available() > 0 &&
199
                            (accumulatedReadCycles / cyclesPerBit) >= 8) {
200 1
                        fifoIn[inRight] = in.read();
201 7
                        inRight = (inRight + 1) % 16;
202 5
                        accumulatedReadCycles -= (cyclesPerBit * 8);
203 2
                        if (inFull()) {
204 1
                            bufferFull();
205
                        }
206
                    }
207
                    /*  accumulate cycles and write*/
208 2
                    if (!outEmpty()) {
209 4
                        accumulatedCycles++;
210 5
                        if ((accumulatedCycles / cyclesPerBit) >= 8) {
211 5
                            accumulatedCycles -= (cyclesPerBit * 8);
212 1
                            out.write(fifoOut[outLeft]);
213 7
                            outLeft = (outLeft + 1) % 16;
214
                        }
215 2
                        if (outEmpty()) {
216 1
                            bufferEmpty();
217
                        }
218
                    }
219
                }
220
            }
221
        } catch (IOException ioe) {
222 1
            ioe.printStackTrace();
223
        }
224
    }
225
226
    protected void updateBits() {
227 3
        setBit(1);
228 3
        unsetBit(5);
229 3
        setBit(0);
230 3
        unsetBit(4);
231 1
        if (inLeft == inRight) {
232 3
            unsetBit(1);
233
        }
234 7
        if (((inLeft + 1) % 16) == inRight) {
235 3
            setBit(5);
236
        }
237 1
        if (outLeft == outRight) {
238 3
            unsetBit(0);
239
        }
240 7
        if (((outLeft + 1) % 16) == outRight) {
241 3
            setBit(4);
242
        }
243
    }
244
245
    protected boolean inEmpty() {
246 1
        updateBits();
247 9
        return !getBit(1);
248
    }
249
250
    protected boolean outEmpty() {
251 1
        updateBits();
252 9
        return !getBit(0);
253
    }
254
255
    protected boolean outFull() {
256 1
        updateBits();
257 4
        return getBit(4);
258
    }
259
260
    protected boolean inFull() {
261 1
        updateBits();
262 4
        return getBit(5);
263
    }
264
265
    protected void setBit(int i) {
266 5
        status |= (1 << i);
267
    }
268
269
    protected void unsetBit(int i) {
270 1
        setBit(i);
271 5
        status ^= (1 << i);
272
    }
273
274
    protected boolean getBit(int i) {
275 11
        return (status & (1 << i)) > 0;
276
    }
277
278
    protected void bufferEmpty() {
279 4
        if (getBit(30)) {
280 1
            pic.flagInterrupt(this);
281
        }
282
    }
283
284
    protected void bufferFull() {
285 4
        if (getBit(31)) {
286 1
            pic.flagInterrupt(this);
287
        }
288
    }
289
290
    public void link(Interruptable il) {
291 1
        if (pic == null) {
292 1
            pic = il;
293
        }
294
    }
295
296
    protected int intify(byte[] four) {
297 21
        return (four[3] << 24) | (four[2] << 16) | (four[1] << 8) | four[0];
298
    }
299
300
    protected byte[] bytify(int addr) {
301 2
        byte[] ret = new byte[4];
302 7
        for (int i = 0; i < 4; i++) {
303 9
            ret[0] = (byte) (0xff & (addr >> (i * 8)));
304
        }
305 1
        return ret;
306
    }
307
308
    enum CommandState {
309
        Normal,
310
        Connect, //waiting for connect address
311
        Port; //waiting for port
312
    }
313
}

Mutations

46

Substituted 0 with 1 : SURVIVED

Substituted 0 with 1 : SURVIVED

Removed assignment to member variable accumulatedCycles : SURVIVED

47

Substituted 0 with 1 : SURVIVED

Substituted 0 with 1 : SURVIVED

Removed assignment to member variable accumulatedReadCycles : SURVIVED

48

Substituted 16 with 17 : SURVIVED

Removed assignment to member variable fifoIn : SURVIVED

Replaced constant value of 16 with 17 : SURVIVED

49

Replaced constant value of 16 with 17 : SURVIVED

Removed assignment to member variable fifoOut : SURVIVED

Substituted 16 with 17 : SURVIVED

50

Substituted 0 with 1 : SURVIVED

Removed assignment to member variable outLeft : SURVIVED

Substituted 0 with 1 : SURVIVED

Substituted 0 with 1 : SURVIVED

Substituted 0 with 1 : SURVIVED

Removed assignment to member variable inRight : SURVIVED

Substituted 0 with 1 : SURVIVED

Removed assignment to member variable outRight : SURVIVED

Removed assignment to member variable inLeft : SURVIVED

Substituted 0 with 1 : SURVIVED

Substituted 0 with 1 : SURVIVED

Substituted 0 with 1 : SURVIVED

51

Removed assignment to member variable state : SURVIVED

52

Substituted -1 with 0 : SURVIVED

Substituted -1 with 1 : SURVIVED

Removed assignment to member variable remoteAddress : SURVIVED

53

Substituted -1 with 1 : SURVIVED

Removed assignment to member variable remotePort : SURVIVED

Substituted -1 with 0 : SURVIVED

59

Substituted -536870912 with -536870911 : SURVIVED

Replaced constant value of -536870912 with -536870911 : SURVIVED

Removed assignment to member variable modifiable : SURVIVED

63

Removed assignment to member variable cyclesPerBit : SURVIVED

67

replaced return of integer sized value with (x == 0 ? 1 : 0) : SURVIVED

Substituted 3 with 4 : SURVIVED

Substituted 3 with 4 : SURVIVED

72

negated conditional : NO_COVERAGE

73

removed call to fi/helsinki/cs/titokone/devices/UART::inEmpty : NO_COVERAGE

negated conditional : NO_COVERAGE

74

Substituted 0 with 1 : NO_COVERAGE

replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

77

Removed assignment to member variable inLeft : NO_COVERAGE

Replaced integer addition with subtraction : NO_COVERAGE

Substituted 16 with 17 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Replaced constant value of 16 with 17 : NO_COVERAGE

Replaced integer modulus with multiplication : NO_COVERAGE

78

removed call to fi/helsinki/cs/titokone/devices/UART::updateBits : NO_COVERAGE

79

replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE

81

Substituted 1 with 0 : NO_COVERAGE

negated conditional : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

82

replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE

84

Substituted 2 with 3 : NO_COVERAGE

Substituted 2 with 3 : NO_COVERAGE

negated conditional : NO_COVERAGE

85

replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE

87

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::<init> : NO_COVERAGE

removed call to java/lang/RuntimeException::<init> : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::toString : NO_COVERAGE

93

Substituted 2 with 3 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART$CommandState::ordinal : NO_COVERAGE

Substituted 2 with 3 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART$CommandState::values : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART$CommandState::ordinal : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART$CommandState::ordinal : NO_COVERAGE

95

Removed assignment to member variable remoteAddress : NO_COVERAGE

96

Removed assignment to member variable state : NO_COVERAGE

99

Removed assignment to member variable remotePort : NO_COVERAGE

100

Removed assignment to member variable state : NO_COVERAGE

103

negated conditional : NO_COVERAGE

104

removed call to fi/helsinki/cs/titokone/devices/UART::outFull : NO_COVERAGE

negated conditional : NO_COVERAGE

106

Substituted 1 with 0 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Replaced integer addition with subtraction : NO_COVERAGE

Substituted 16 with 17 : NO_COVERAGE

Replaced constant value of 16 with 17 : NO_COVERAGE

Replaced integer modulus with multiplication : NO_COVERAGE

Removed assignment to member variable outRight : NO_COVERAGE

107

removed call to fi/helsinki/cs/titokone/devices/UART::updateBits : NO_COVERAGE

111

Substituted 1 with 0 : NO_COVERAGE

negated conditional : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

112

Replaced bitwise AND with OR : NO_COVERAGE

113

Replaced bitwise OR with AND : NO_COVERAGE

Substituted -1 with 1 : NO_COVERAGE

Substituted -1 with 0 : NO_COVERAGE

Replaced bitwise AND with OR : NO_COVERAGE

Replaced XOR with AND : NO_COVERAGE

Removed assignment to member variable status : NO_COVERAGE

116

Substituted 2 with 3 : NO_COVERAGE

negated conditional : NO_COVERAGE

Substituted 2 with 3 : NO_COVERAGE

119

removed call to java/net/Socket::close : NO_COVERAGE

120

Removed assignment to member variable sSock : NO_COVERAGE

123

Removed assignment to member variable state : NO_COVERAGE

128

removed call to java/io/IOException::printStackTrace : NO_COVERAGE

130

removed call to java/lang/StringBuilder::toString : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::<init> : NO_COVERAGE

removed call to java/lang/RuntimeException::<init> : NO_COVERAGE

134

Substituted 0 with 1 : SURVIVED

Substituted 0 with 1 : SURVIVED

Removed assignment to member variable accumulatedCycles : SURVIVED

135

Substituted 0 with 1 : SURVIVED

Substituted 0 with 1 : SURVIVED

Removed assignment to member variable accumulatedReadCycles : SURVIVED

136

Removed assignment to member variable fifoIn : SURVIVED

Substituted 16 with 17 : SURVIVED

Replaced constant value of 16 with 17 : SURVIVED

137

Substituted 16 with 17 : SURVIVED

Removed assignment to member variable fifoOut : SURVIVED

Replaced constant value of 16 with 17 : SURVIVED

138

Removed assignment to member variable sSock : SURVIVED

139

Removed assignment to member variable socket : SURVIVED

140

Removed assignment to member variable state : SURVIVED

141

Removed assignment to member variable remotePort : SURVIVED

Removed assignment to member variable remoteAddress : SURVIVED

Substituted -1 with 1 : SURVIVED

Substituted -1 with 0 : SURVIVED

146

Substituted -1 with 1 : NO_COVERAGE

Substituted -1 with 1 : NO_COVERAGE

negated conditional : NO_COVERAGE

Substituted -1 with 0 : NO_COVERAGE

Substituted -1 with 0 : NO_COVERAGE

negated conditional : NO_COVERAGE

negated conditional : NO_COVERAGE

147

negated conditional : NO_COVERAGE

148

Removed assignment to member variable sSock : NO_COVERAGE

removed call to java/net/ServerSocket::<init> : NO_COVERAGE

149

removed call to java/lang/Thread::<init> : NO_COVERAGE

Removed assignment to member variable this$0 : NO_COVERAGE

removed call to java/lang/Thread::start : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART$1::<init> : NO_COVERAGE

152

negated conditional : NO_COVERAGE

153

Removed assignment to member variable socket : NO_COVERAGE

removed call to java/net/ServerSocket::accept : NO_COVERAGE

154

Removed assignment to member variable in : NO_COVERAGE

removed call to java/net/Socket::getInputStream : NO_COVERAGE

155

Removed assignment to member variable out : NO_COVERAGE

removed call to java/net/Socket::getOutputStream : NO_COVERAGE

156

Removed assignment to member variable remoteAddress : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::intify : NO_COVERAGE

removed call to java/net/InetAddress::getAddress : NO_COVERAGE

removed call to java/net/Socket::getInetAddress : NO_COVERAGE

157

removed call to java/net/Socket::getPort : NO_COVERAGE

Removed assignment to member variable remotePort : NO_COVERAGE

158

Substituted 2 with 3 : NO_COVERAGE

Substituted 2 with 3 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::setBit : NO_COVERAGE

159

Replaced constant value of 29 with 30 : NO_COVERAGE

negated conditional : NO_COVERAGE

Substituted 29 with 30 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::getBit : NO_COVERAGE

160

removed call to fi/helsinki/cs/titokone/Interruptable::flagInterrupt : NO_COVERAGE

162

negated conditional : NO_COVERAGE

164

Replaced constant value of 200 with 201 : NO_COVERAGE

removed call to java/lang/Thread::sleep : NO_COVERAGE

Substituted 200 with 201 : NO_COVERAGE

168

Substituted 2 with 3 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::unsetBit : NO_COVERAGE

Substituted 2 with 3 : NO_COVERAGE

171

removed call to java/io/IOException::printStackTrace : NO_COVERAGE

172

Substituted 2 with 3 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::unsetBit : NO_COVERAGE

Substituted 2 with 3 : NO_COVERAGE

177

removed call to java/net/Socket::<init> : NO_COVERAGE

removed call to java/net/InetAddress::getByAddress : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::bytify : NO_COVERAGE

Removed assignment to member variable socket : NO_COVERAGE

178

Removed assignment to member variable in : NO_COVERAGE

removed call to java/net/Socket::getInputStream : NO_COVERAGE

179

Removed assignment to member variable out : NO_COVERAGE

removed call to java/net/Socket::getOutputStream : NO_COVERAGE

180

removed call to fi/helsinki/cs/titokone/devices/UART::setBit : NO_COVERAGE

Substituted 2 with 3 : NO_COVERAGE

Substituted 2 with 3 : NO_COVERAGE

183

negated conditional : NO_COVERAGE

184

removed call to java/net/Socket::isConnected : NO_COVERAGE

negated conditional : NO_COVERAGE

185

Removed assignment to member variable socket : NO_COVERAGE

186

Removed assignment to member variable in : NO_COVERAGE

187

Removed assignment to member variable out : NO_COVERAGE

188

Substituted 2 with 3 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::unsetBit : NO_COVERAGE

Substituted 2 with 3 : NO_COVERAGE

189

Substituted 0 with 1 : NO_COVERAGE

Removed assignment to member variable accumulatedReadCycles : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

Removed assignment to member variable accumulatedCycles : NO_COVERAGE

190

Substituted -1 with 1 : NO_COVERAGE

Substituted -1 with 0 : NO_COVERAGE

Removed assignment to member variable remoteAddress : NO_COVERAGE

191

Substituted -1 with 0 : NO_COVERAGE

Removed assignment to member variable remotePort : NO_COVERAGE

Substituted -1 with 1 : NO_COVERAGE

194

negated conditional : NO_COVERAGE

removed call to java/io/InputStream::available : NO_COVERAGE

changed conditional boundary : NO_COVERAGE

195

Substituted 1 with 0 : NO_COVERAGE

Replaced integer addition with subtraction : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Removed assignment to member variable accumulatedReadCycles : NO_COVERAGE

197

Substituted 8 with 9 : NO_COVERAGE

changed conditional boundary : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::inFull : NO_COVERAGE

Replaced integer division with multiplication : NO_COVERAGE

negated conditional : NO_COVERAGE

removed call to java/io/InputStream::available : NO_COVERAGE

negated conditional : NO_COVERAGE

negated conditional : NO_COVERAGE

Replaced constant value of 8 with 9 : NO_COVERAGE

changed conditional boundary : NO_COVERAGE

200

removed call to java/io/InputStream::read : NO_COVERAGE

201

Replaced integer addition with subtraction : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Removed assignment to member variable inRight : NO_COVERAGE

Substituted 16 with 17 : NO_COVERAGE

Replaced integer modulus with multiplication : NO_COVERAGE

Replaced constant value of 16 with 17 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

202

Replaced integer multiplication with division : NO_COVERAGE

Replaced constant value of 8 with 9 : NO_COVERAGE

Removed assignment to member variable accumulatedReadCycles : NO_COVERAGE

Substituted 8 with 9 : NO_COVERAGE

Replaced integer subtraction with addition : NO_COVERAGE

203

negated conditional : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::inFull : NO_COVERAGE

204

removed call to fi/helsinki/cs/titokone/devices/UART::bufferFull : NO_COVERAGE

208

negated conditional : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::outEmpty : NO_COVERAGE

209

Substituted 1 with 0 : NO_COVERAGE

Replaced integer addition with subtraction : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Removed assignment to member variable accumulatedCycles : NO_COVERAGE

210

changed conditional boundary : NO_COVERAGE

negated conditional : NO_COVERAGE

Substituted 8 with 9 : NO_COVERAGE

Replaced constant value of 8 with 9 : NO_COVERAGE

Replaced integer division with multiplication : NO_COVERAGE

211

Removed assignment to member variable accumulatedCycles : NO_COVERAGE

Replaced integer multiplication with division : NO_COVERAGE

Replaced integer subtraction with addition : NO_COVERAGE

Replaced constant value of 8 with 9 : NO_COVERAGE

Substituted 8 with 9 : NO_COVERAGE

212

removed call to java/io/OutputStream::write : NO_COVERAGE

213

Substituted 16 with 17 : NO_COVERAGE

Replaced constant value of 16 with 17 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Replaced integer modulus with multiplication : NO_COVERAGE

Removed assignment to member variable outLeft : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Replaced integer addition with subtraction : NO_COVERAGE

215

removed call to fi/helsinki/cs/titokone/devices/UART::outEmpty : NO_COVERAGE

negated conditional : NO_COVERAGE

216

removed call to fi/helsinki/cs/titokone/devices/UART::bufferEmpty : NO_COVERAGE

222

removed call to java/io/IOException::printStackTrace : NO_COVERAGE

227

Substituted 1 with 0 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::setBit : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

228

Substituted 5 with -1 : NO_COVERAGE

Substituted 5 with 6 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::unsetBit : NO_COVERAGE

229

Substituted 0 with 1 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::setBit : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

230

Substituted 4 with 5 : NO_COVERAGE

Substituted 4 with 5 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::unsetBit : NO_COVERAGE

231

negated conditional : NO_COVERAGE

232

removed call to fi/helsinki/cs/titokone/devices/UART::unsetBit : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

234

Replaced integer addition with subtraction : NO_COVERAGE

Replaced constant value of 16 with 17 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Replaced integer modulus with multiplication : NO_COVERAGE

negated conditional : NO_COVERAGE

Substituted 16 with 17 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

235

Substituted 5 with -1 : NO_COVERAGE

Substituted 5 with 6 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::setBit : NO_COVERAGE

237

negated conditional : NO_COVERAGE

238

Substituted 0 with 1 : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::unsetBit : NO_COVERAGE

240

Replaced integer modulus with multiplication : NO_COVERAGE

negated conditional : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Substituted 16 with 17 : NO_COVERAGE

Replaced integer addition with subtraction : NO_COVERAGE

Replaced constant value of 16 with 17 : NO_COVERAGE

241

removed call to fi/helsinki/cs/titokone/devices/UART::setBit : NO_COVERAGE

Substituted 4 with 5 : NO_COVERAGE

Substituted 4 with 5 : NO_COVERAGE

246

removed call to fi/helsinki/cs/titokone/devices/UART::updateBits : NO_COVERAGE

247

Substituted 1 with 0 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::getBit : NO_COVERAGE

negated conditional : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

251

removed call to fi/helsinki/cs/titokone/devices/UART::updateBits : NO_COVERAGE

252

Substituted 1 with 0 : NO_COVERAGE

negated conditional : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::getBit : NO_COVERAGE

256

removed call to fi/helsinki/cs/titokone/devices/UART::updateBits : NO_COVERAGE

257

Substituted 4 with 5 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::getBit : NO_COVERAGE

replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE

Substituted 4 with 5 : NO_COVERAGE

261

removed call to fi/helsinki/cs/titokone/devices/UART::updateBits : NO_COVERAGE

262

replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::getBit : NO_COVERAGE

Substituted 5 with -1 : NO_COVERAGE

Substituted 5 with 6 : NO_COVERAGE

266

Substituted 1 with 0 : NO_COVERAGE

Replaced Shift Left with Shift Right : NO_COVERAGE

Replaced bitwise OR with AND : NO_COVERAGE

Removed assignment to member variable status : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

270

removed call to fi/helsinki/cs/titokone/devices/UART::setBit : NO_COVERAGE

271

Substituted 1 with 0 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Replaced XOR with AND : NO_COVERAGE

Removed assignment to member variable status : NO_COVERAGE

Replaced Shift Left with Shift Right : NO_COVERAGE

275

replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

Replaced Shift Left with Shift Right : NO_COVERAGE

changed conditional boundary : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Replaced bitwise AND with OR : NO_COVERAGE

negated conditional : NO_COVERAGE

279

Replaced constant value of 30 with 31 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/devices/UART::getBit : NO_COVERAGE

Substituted 30 with 31 : NO_COVERAGE

negated conditional : NO_COVERAGE

280

removed call to fi/helsinki/cs/titokone/Interruptable::flagInterrupt : NO_COVERAGE

285

removed call to fi/helsinki/cs/titokone/devices/UART::getBit : NO_COVERAGE

Substituted 31 with 32 : NO_COVERAGE

Replaced constant value of 31 with 32 : NO_COVERAGE

negated conditional : NO_COVERAGE

286

removed call to fi/helsinki/cs/titokone/Interruptable::flagInterrupt : NO_COVERAGE

291

negated conditional : SURVIVED

292

Removed assignment to member variable pic : SURVIVED

297

Replaced constant value of 24 with 25 : NO_COVERAGE

Replaced constant value of 16 with 17 : NO_COVERAGE

Substituted 24 with 25 : NO_COVERAGE

Substituted 2 with 3 : NO_COVERAGE

Substituted 8 with 9 : NO_COVERAGE

Substituted 3 with 4 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Replaced Shift Left with Shift Right : NO_COVERAGE

Replaced Shift Left with Shift Right : NO_COVERAGE

Substituted 2 with 3 : NO_COVERAGE

Substituted 16 with 17 : NO_COVERAGE

Substituted 3 with 4 : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

Substituted 1 with 0 : NO_COVERAGE

Replaced Shift Left with Shift Right : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

Replaced bitwise OR with AND : NO_COVERAGE

Replaced bitwise OR with AND : NO_COVERAGE

Replaced bitwise OR with AND : NO_COVERAGE

replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE

Replaced constant value of 8 with 9 : NO_COVERAGE

301

Substituted 4 with 5 : NO_COVERAGE

Substituted 4 with 5 : NO_COVERAGE

302

Substituted 4 with 5 : NO_COVERAGE

negated conditional : NO_COVERAGE

Changed increment from 1 to -1 : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

Substituted 4 with 5 : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

changed conditional boundary : NO_COVERAGE

303

Substituted 255 with 256 : NO_COVERAGE

Substituted 8 with 9 : NO_COVERAGE

Replaced integer multiplication with division : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

Replaced bitwise AND with OR : NO_COVERAGE

Replaced constant value of 255 with 256 : NO_COVERAGE

Replaced Shift Right with Shift Left : NO_COVERAGE

Replaced constant value of 8 with 9 : NO_COVERAGE

305

mutated return of Object value for fi/helsinki/cs/titokone/devices/UART::bytify to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.27