projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Integrated new types, tests still work, not used yet
[Mograsim.git]
/
era.mi
/
src
/
era
/
mi
/
logic
/
wires
/
Wire.java
diff --git
a/era.mi/src/era/mi/logic/wires/Wire.java
b/era.mi/src/era/mi/logic/wires/Wire.java
index
4c24571
..
db93253
100644
(file)
--- a/
era.mi/src/era/mi/logic/wires/Wire.java
+++ b/
era.mi/src/era/mi/logic/wires/Wire.java
@@
-5,9
+5,9
@@
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Iterator;
import java.util.List;
-import era.mi.logic.Bit;
import era.mi.logic.Simulation;
import era.mi.logic.Util;
import era.mi.logic.Simulation;
import era.mi.logic.Util;
+import era.mi.logic.types.Bit;
/**
* Represents an array of wires that can store n bits of information.
/**
* Represents an array of wires that can store n bits of information.
@@
-60,7
+60,7
@@
public class Wire
Bit[] bits = input.getInputValues();
for (int i = 0; i < length; i++)
{
Bit[] bits = input.getInputValues();
for (int i = 0; i < length; i++)
{
- newValues[i] = newValues[i].
combineWith
(bits[i]);
+ newValues[i] = newValues[i].
join
(bits[i]);
}
}
}
}
@@
-200,7
+200,15
@@
public class Wire
*/
public WireEnd createEnd()
{
*/
public WireEnd createEnd()
{
- return new WireEnd();
+ return new WireEnd(false);
+ }
+
+ /**
+ * Create a {@link WireEnd} object, which is tied to this {@link Wire}. This {@link WireEnd} cannot written to.
+ */
+ public WireEnd createReadOnlyEnd()
+ {
+ return new WireEnd(true);
}
private void registerInput(WireEnd toRegister)
}
private void registerInput(WireEnd toRegister)
@@
-220,17
+228,18
@@
public class Wire
private boolean open;
private Bit[] inputValues;
private boolean open;
private Bit[] inputValues;
- private WireEnd()
+ private WireEnd(
boolean readOnly
)
{
super();
open = true;
initValues();
{
super();
open = true;
initValues();
- registerInput(this);
+ if (!readOnly)
+ registerInput(this);
}
private void initValues()
{
}
private void initValues()
{
- inputValues = Bit.
Z
.makeArray(length);
+ inputValues = Bit.
U
.makeArray(length);
}
/**
}
/**
@@
-415,11
+424,11
@@
public class Wire
@Override
public String toString()
{
@Override
public String toString()
{
- return Arrays.toString(
v
alues);
+ return Arrays.toString(
inputV
alues);
// return String.format("%s \nFeeding: %s", WireArray.this.toString(), Arrays.toString(inputValues));
}
// return String.format("%s \nFeeding: %s", WireArray.this.toString(), Arrays.toString(inputValues));
}
- public void
disconnect
()
+ public void
close
()
{
inputs.remove(this);
open = false;
{
inputs.remove(this);
open = false;