ADL erro : Sub bus of an internal node may not be use

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

ADL erro : Sub bus of an internal node may not be use

lesyduong
I don't understand the error in line 71 . Please help me fix it
ADL code : 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:
   // Put you code here:
// zero the x input
Mux16(a=x,b=false,sel=zx,out=x1);

//negate the x input
Not16(in=x1,out=xwire);
Mux16(a=x1,b=xwire,sel=nx,out=x2);

// zero the y input
Mux16(a=y,b=false,sel=zy,out=y1);

// negate the y input
Not16(in=y1,out=ywire);
Mux16(a=y1,b=ywire,sel=ny,out=y2);

// compute out =x+y (if1) or x & y (if0) - out5
Add16(a=x2,b=y2,out=add);
And16(a=x2,b=y2,out=and);
Mux16(a=and,b=add,sel=f,out=out1);

// negate the out output
Not16(in=out1,out=out2);
Mux16(a=out1,b=out2,sel=no,out=out);


// zr
Or8Way(in=out[0..7],out=or1);
Or8Way(in=out[8..15],out=or2);
Or(a=or1,b=or2,out=selzr);
Mux(a=true,b=false,sel=selzr,out=zr);



//ng
And(a=out[15],b=true,out=and1);
Mux(a=false,b=true,sel=and1,out=ng);
}

and Or8Way code

CHIP Or8Way {
    IN in[8];
    OUT out;

    PARTS:
    // Put your code here:
Or(a=in[0],b=in[1],out=out0);
Or(a=out0,b=in[2],out=out1);
Or(a=out1,b=in[3],out=out2);
Or(a=out2,b=in[4],out=out3);
Or(a=out3,b=in[5],out=out4);
Or(a=out4,b=in[6],out=out5);
Or(a=out5,b=in[7],out=out);



}
Reply | Threaded
Open this post in threaded view
|

Re: ADL erro : Sub bus of an internal node may not be use

cadet1620
Administrator
You cannot use the [] sub bus syntax on internal signals, not can you connect chip output pins to part inputs.

What you can do is connect more than one internal signal to a part output, as in
    Somepart(in=in, out=out, out=anotherOut);

See appendix A.5.3 and study the example to learn how to create the internal 8-bit buses you need to connect to the Or8Ways.

--Mark