While building ALU, error is occurred.(sub bus of an internal node may not be used)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

While building ALU, error is occurred.(sub bus of an internal node may not be used)

hyeonwoo
This post was updated on .
I made the error sentence be Bold.
And if you have enough time, please check other sentences and give me some advice


CHIP ALU {
    IN  
        x[16], y[16],  // 16-bit inputs        
        zx, // zero the x input?
        nx, // negate the x input?
        zy, // zero the y input?
        ny, // negate the y input?
        f,  // compute out = x + y (if 1) or x & y (if 0)
        no; // negate the out output?

    OUT
        out[16], // 16-bit output
        zr, // 1 if (out == 0), 0 otherwise
        ng; // 1 if (out < 0),  0 otherwise

    PARTS:

//zr
    Or8Way(in=out1[0..7], out=Oo1); //out1[0..7] sub bus of an internal node may not be used
    Or8Way(in=out1[8..15], out=Oo2);
    Nor(a=Oo1, b=Oo2, out=zr);




}
Reply | Threaded
Open this post in threaded view
|

Re: While building ALU, error is occurred.(sub bus of an internal node may not be used)

cadet1620
Administrator
hyeonwoo wrote
    Mux16(a=Cal3, b=NCal3, sel=no, out=out1);
//zr
    Or8Way(in=out1[0..7], out=Oo1); //out1[0..7] sub bus of an internal node may not be used
Using the [] syntax on internal buses is not allowed. You must create internal buses the width that you need them to be. In this case out1 needs to be created to be 8 bits wide:
    Mux16(..., out[0..7]=out1, ...);
    Or8Way(in=out1, ...);
Read Appendix A.5.3 Buses, and study the example to see how you can make all the internal buses you need. It also shows how you can eliminate the need for these parts:
    And16(a=x, b=Nx, out=NAx); //0
    And16(a=y, b=Ny, out=NAy);
    And(a=out1[15], b=out1[15], out=ng);  
    And16(a=out1, b=out1, out=out);
Please edit your post to remove the HDL except for the lines relevant to the error.

--Mark