Search in sources :

Example 1 with ExprVarRange

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

the class ReplaceOneToMany method replace.

private void replace(HDLNodeSplitterOneToMany n, ArrayList<HDLNodeAssignment> newNodes) throws HDLException {
    final HDLPort inPort = n.getInputs().get(0);
    HDLNet inNet = inPort.getNet();
    inPort.setNet(null);
    int i = 0;
    for (Splitter.Port p : n.getOutputSplit()) {
        final HDLPort outPort = n.getOutputs().get(i);
        if (outPort.getNet() != null) {
            ExprVarRange exp = new ExprVarRange(inNet, p.getPos() + p.getBits() - 1, p.getPos());
            HDLNodeAssignment node = new HDLNodeAssignment("splitter", null, null);
            node.setExpression(exp);
            node.addPort(new HDLPort("in", inNet, HDLPort.Direction.IN, inPort.getBits()));
            node.addPort(outPort);
            newNodes.add(node);
        }
        i++;
    }
}
Also used : ExprVarRange(de.neemann.digital.hdl.model2.expression.ExprVarRange) Splitter(de.neemann.digital.core.wiring.Splitter)

Aggregations

Splitter (de.neemann.digital.core.wiring.Splitter)1 ExprVarRange (de.neemann.digital.hdl.model2.expression.ExprVarRange)1