mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-14 15:26:52 -04:00
LUTs are created only if they don't represent a basic gate.
This commit is contained in:
parent
87a9396cc0
commit
1b0fd9dc13
@ -18,7 +18,7 @@ sehen Sie sich die Datei discrete.dig an.}}</string>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Data</string>
|
||||
<data size="2048">0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,0,
|
||||
<data>0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,0,
|
||||
1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,1,
|
||||
0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,0,1,
|
||||
@ -117,16 +117,6 @@ Val genutzt um die Zelle zu initialisieren.}}</string>
|
||||
</elementAttributes>
|
||||
<pos x="420" y="380"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>C</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="580" y="300"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
@ -142,6 +132,16 @@ Val genutzt um die Zelle zu initialisieren.}}</string>
|
||||
</elementAttributes>
|
||||
<pos x="700" y="280"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Clock</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>C</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="580" y="300"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
|
@ -205,15 +205,25 @@ public class CircuitBuilder implements BuilderInterface<CircuitBuilder> {
|
||||
}
|
||||
|
||||
private Fragment createFragment(Expression expression) throws BuilderException {
|
||||
boolean lutNeeded = true;
|
||||
if (expression instanceof Variable)
|
||||
lutNeeded = false;
|
||||
else if (expression instanceof Not && ((Not) expression).getExpression() instanceof Variable)
|
||||
lutNeeded = false;
|
||||
if (useLUT) {
|
||||
if (expression instanceof Variable)
|
||||
return createBasicFragment(expression);
|
||||
|
||||
if (expression instanceof Not && ((Not) expression).getExpression() instanceof Variable)
|
||||
return createBasicFragment(expression);
|
||||
|
||||
if (expression instanceof Operation) {
|
||||
boolean allVars = true;
|
||||
for (Expression ex : ((Operation) expression).getExpressions()) {
|
||||
if (!(ex instanceof Variable || (ex instanceof Not && ((Not) ex).getExpression() instanceof Variable)))
|
||||
allVars = false;
|
||||
}
|
||||
if (allVars)
|
||||
return createBasicFragment(expression);
|
||||
}
|
||||
|
||||
if (useLUT && lutNeeded)
|
||||
return createLutFragment(expression);
|
||||
else
|
||||
} else
|
||||
return createBasicFragment(expression);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user