Search in sources :

Example 1 with ExprVar

use of de.neemann.digital.hdl.model2.expression.ExprVar in project Digital by hneemann.

the class HDLCircuit method createNot.

private HDLNode createNot(HDLPort p, HDLNode node) throws HDLException, NodeException, PinException {
    final ElementAttributes attr = new ElementAttributes().setBits(p.getBits());
    HDLNodeAssignment n = new HDLNodeAssignment(Not.DESCRIPTION.getName(), attr, name -> p.getBits());
    HDLNet outNet = new HDLNet(null);
    listOfNets.add(outNet);
    HDLNet inNet = p.getNet();
    inNet.remove(p);
    n.addPort(new HDLPort(Not.DESCRIPTION.getInputDescription(attr).get(0).getName(), inNet, HDLPort.Direction.IN, p.getBits()));
    n.addPort(new HDLPort(Not.DESCRIPTION.getOutputDescriptions(attr).get(0).getName(), outNet, HDLPort.Direction.OUT, p.getBits()));
    p.setNet(outNet);
    node.replaceNet(inNet, outNet);
    n.setExpression(new ExprNot(new ExprVar(n.getInputs().get(0).getNet())));
    return n;
}
Also used : ExprVar(de.neemann.digital.hdl.model2.expression.ExprVar) ElementAttributes(de.neemann.digital.core.element.ElementAttributes) ExprNot(de.neemann.digital.hdl.model2.expression.ExprNot)

Example 2 with ExprVar

use of de.neemann.digital.hdl.model2.expression.ExprVar in project Digital by hneemann.

the class HDLNodeAssignment method replaceNet.

@Override
public void replaceNet(HDLNet oldNet, HDLNet newNet) {
    super.replaceNet(oldNet, newNet);
    expression.replace(oldNet, new ExprVar(newNet));
}
Also used : ExprVar(de.neemann.digital.hdl.model2.expression.ExprVar)

Aggregations

ExprVar (de.neemann.digital.hdl.model2.expression.ExprVar)2 ElementAttributes (de.neemann.digital.core.element.ElementAttributes)1 ExprNot (de.neemann.digital.hdl.model2.expression.ExprNot)1