ALU.hdl not running

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

ALU.hdl not running

nemo
This post was updated on .
Hello, I'm having problems to test my ALU.hdl file. It doesn't open at all in the Hardware Simulator, and I've tried different implementations that I found on the Internet just to see if it was my code's fault, but none of them have worked. The Hardware Simulator has worked for all of the previous chips successfully, so I don't know what is wrong.

Here's the code that I wrote:

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:
    Mux16 (a=x, b[0..15]=false, sel=zx, out=zxOUT); //Zero the x

    Not16 (in=zxOUT, out=notZX);                    //Negate x
    Mux16 (a=zxOUT, b=notZX, sel=nx, out=nxOUT);

    Mux16 (a=y, b[0..15]=false, sel=zy, out=zyOUT); //Zero the y

    Not16 (in=zyOUT, out=notZY);                    //Negate y
    Mux16 (a=zyOUT, b=notZY, sel=ny, out=nyOUT);

    Add16 (a=nxOUT, b=nyOUT, out=xPLUSy);           //X + Y
    And16 (a=nxOUT, b=nyOUT, out=xANDy);            //X & Y
    Mux16 (a=xANDy, b=xPLUSy, sel=f, out=fOUT);

    Not16 (in=fOUT, out=notF);                      //Negate output
    Mux16 (a=fOUT, b=notF, sel=no, out=out);

    Nand (a=out[15], b=true, out=ng);               //ng

    Or8Way (in=out[0..7], out=orLEFT);              //zr
    Or8Way (in=out[8..15], out=orRIGHT);
    Or (in=orLEFT, b=orRIGHT, out=orOUT);
    Not (in=orOUT, out=zr);

}
Reply | Threaded
Open this post in threaded view
|

Re: ALU.hdl not running

rleininger
I get the error message:

In HDL file G:\\***\ALU.hdl, Line 13, Keyword expected

There is a syntax error in the OUT section of your file.

Once this is corrected you will find other errors in the connections within the logic of your file.
Reply | Threaded
Open this post in threaded view
|

Re: ALU.hdl not running

nemo
Thank you for your response. I found the error, it was one semicolon that I put by accident in the OUT declaration :(. Now I can work on fixing my code