mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-27 06:51:37 -04:00
changed pin naming and function of new RAM component to match real devices
This commit is contained in:
parent
dde20ad9fe
commit
12cea9a026
@ -26,9 +26,9 @@ public class RAMSinglePortSel extends Node implements Element, RAMInterface {
|
||||
|
||||
public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(RAMSinglePortSel.class,
|
||||
input("A"),
|
||||
input("sel"),
|
||||
input("C"),
|
||||
input("W/\u00ACR"))
|
||||
input("CS"),
|
||||
input("WE"),
|
||||
input("OE"))
|
||||
.addAttribute(Keys.ROTATE)
|
||||
.addAttribute(Keys.BITS)
|
||||
.addAttribute(Keys.ADDR_BITS)
|
||||
@ -41,15 +41,14 @@ public class RAMSinglePortSel extends Node implements Element, RAMInterface {
|
||||
private final String label;
|
||||
private final ObservableValue dataOut;
|
||||
private ObservableValue addrIn;
|
||||
private ObservableValue selIn;
|
||||
private ObservableValue clkIn;
|
||||
private ObservableValue wnrIn;
|
||||
private ObservableValue csIn;
|
||||
private ObservableValue weIn;
|
||||
private ObservableValue oeIn;
|
||||
private ObservableValue dataIn;
|
||||
|
||||
private boolean lastClk = false;
|
||||
private boolean sel;
|
||||
private boolean cs;
|
||||
private int addr;
|
||||
private boolean write;
|
||||
private boolean oe;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
@ -69,30 +68,28 @@ public class RAMSinglePortSel extends Node implements Element, RAMInterface {
|
||||
@Override
|
||||
public void setInputs(ObservableValues inputs) throws NodeException {
|
||||
addrIn = inputs.get(0).checkBits(addrBits, this).addObserverToValue(this);
|
||||
selIn = inputs.get(1).checkBits(1, this).addObserverToValue(this);
|
||||
clkIn = inputs.get(2).checkBits(1, this).addObserverToValue(this);
|
||||
wnrIn = inputs.get(3).checkBits(1, this).addObserverToValue(this);
|
||||
csIn = inputs.get(1).checkBits(1, this).addObserverToValue(this);
|
||||
weIn = inputs.get(2).checkBits(1, this).addObserverToValue(this);
|
||||
oeIn = inputs.get(3).checkBits(1, this).addObserverToValue(this);
|
||||
dataIn = inputs.get(4).checkBits(bits, this).addObserverToValue(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readInputs() throws NodeException {
|
||||
boolean clk = clkIn.getBool();
|
||||
sel = selIn.getBool();
|
||||
if (sel) {
|
||||
cs = csIn.getBool();
|
||||
if (cs) {
|
||||
addr = (int) addrIn.getValue();
|
||||
write = wnrIn.getBool();
|
||||
if (write && !lastClk && clk) {
|
||||
oe = oeIn.getBool();
|
||||
if (weIn.getBool()) {
|
||||
long data = dataIn.getValue();
|
||||
memory.setData(addr, data);
|
||||
}
|
||||
}
|
||||
lastClk = clk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeOutputs() throws NodeException {
|
||||
if (sel && !write) {
|
||||
if (cs && oe) {
|
||||
dataOut.set(memory.getDataWord(addr), false);
|
||||
} else {
|
||||
dataOut.setHighZ(true);
|
||||
|
@ -19,6 +19,7 @@ public class FileScanner {
|
||||
public int scan(File path) throws Exception {
|
||||
errors = new ArrayList<>();
|
||||
int count = scanIntern(path);
|
||||
System.out.println("tested "+count+" examples");
|
||||
if (errors.isEmpty())
|
||||
return count;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
<int>6</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="40" y="380"/>
|
||||
<pos x="60" y="380"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
@ -71,20 +71,20 @@
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>C</string>
|
||||
<string>WE</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="120" y="440"/>
|
||||
<pos x="60" y="440"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>W</string>
|
||||
<string>OE</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="40" y="460"/>
|
||||
<pos x="60" y="480"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>RAMSinglePortSel</elementName>
|
||||
@ -148,35 +148,35 @@
|
||||
<entry>
|
||||
<string>Testdata</string>
|
||||
<testData>
|
||||
<dataString>sel A C W Din Dout
|
||||
<dataString>CS A WE OE Din Dout
|
||||
|
||||
# write some values
|
||||
1 0 C 1 7 X
|
||||
1 10 C 1 8 X
|
||||
1 20 C 1 9 X
|
||||
1 30 C 1 10 X
|
||||
1 40 C 1 11 X
|
||||
1 50 C 1 12 X
|
||||
1 60 C 1 13 X
|
||||
1 0 C 0 7 X
|
||||
1 10 C 0 8 X
|
||||
1 20 C 0 9 X
|
||||
1 30 C 0 10 X
|
||||
1 40 C 0 11 X
|
||||
1 50 C 0 12 X
|
||||
1 60 C 0 13 X
|
||||
|
||||
# read some values
|
||||
1 0 0 0 Z 7
|
||||
1 10 0 0 Z 8
|
||||
1 20 0 0 Z 9
|
||||
1 30 0 0 Z 10
|
||||
1 40 0 0 Z 11
|
||||
1 50 0 0 Z 12
|
||||
1 60 0 0 Z 13
|
||||
1 0 0 1 Z 7
|
||||
1 10 0 1 Z 8
|
||||
1 20 0 1 Z 9
|
||||
1 30 0 1 Z 10
|
||||
1 40 0 1 Z 11
|
||||
1 50 0 1 Z 12
|
||||
1 60 0 1 Z 13
|
||||
|
||||
# read with sel=0 does not work
|
||||
# read with CS=0 does not work
|
||||
0 50 0 0 Z Z
|
||||
0 60 0 0 Z Z
|
||||
|
||||
# write with sel=0 does not work
|
||||
0 1 C 1 7 X
|
||||
0 2 C 1 7 X
|
||||
1 1 0 0 Z 0
|
||||
1 2 0 0 Z 0
|
||||
# write with CS=0 does not work
|
||||
0 1 C 0 7 X
|
||||
0 2 C 0 7 X
|
||||
1 1 0 1 Z 0
|
||||
1 2 0 1 Z 0
|
||||
</dataString>
|
||||
</testData>
|
||||
</entry>
|
||||
@ -202,10 +202,10 @@
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>sel</string>
|
||||
<string>CS</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="40" y="620"/>
|
||||
<pos x="60" y="620"/>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
@ -217,6 +217,10 @@
|
||||
<p1 x="180" y="640"/>
|
||||
<p2 x="200" y="640"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="60" y="480"/>
|
||||
<p2 x="260" y="480"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="420"/>
|
||||
<p2 x="400" y="420"/>
|
||||
@ -249,10 +253,6 @@
|
||||
<p1 x="220" y="680"/>
|
||||
<p2 x="320" y="680"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="40" y="460"/>
|
||||
<p2 x="260" y="460"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="260" y="460"/>
|
||||
<p2 x="320" y="460"/>
|
||||
@ -262,7 +262,7 @@
|
||||
<p2 x="220" y="620"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="40" y="620"/>
|
||||
<p1 x="60" y="620"/>
|
||||
<p2 x="140" y="620"/>
|
||||
</wire>
|
||||
<wire>
|
||||
@ -298,7 +298,7 @@
|
||||
<p2 x="320" y="820"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="120" y="440"/>
|
||||
<p1 x="60" y="440"/>
|
||||
<p2 x="280" y="440"/>
|
||||
</wire>
|
||||
<wire>
|
||||
@ -318,7 +318,7 @@
|
||||
<p2 x="300" y="380"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="40" y="380"/>
|
||||
<p1 x="60" y="380"/>
|
||||
<p2 x="120" y="380"/>
|
||||
</wire>
|
||||
<wire>
|
||||
@ -355,12 +355,16 @@
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="260" y="460"/>
|
||||
<p2 x="260" y="600"/>
|
||||
<p2 x="260" y="480"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="260" y="600"/>
|
||||
<p2 x="260" y="740"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="260" y="480"/>
|
||||
<p2 x="260" y="600"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="260" y="740"/>
|
||||
<p2 x="260" y="880"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user