For the name of the pin of the "CPU.hdl".

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

For the name of the pin of the "CPU.hdl".

Aoeeeee
CHIP CPU {

    IN  inM[16],         // M value input  (M = contents of RAM[A])
        instruction[16], // Instruction for execution
        reset;           // Signals whether to re-start the current
                         // program (reset==1) or continue executing
                         // the current program (reset==0).

    OUT outM[16],        // M value output
        writeM,          // Write to M?
        addressM[15],    // Address in data memory (of M)
        pc[15];          // address of next instruction

    PARTS:
    Mux16(b=instruction, sel=instruction[15],
        out[0]=c0, out[1]=c1, out[2]=c2,
        out[3]=writeM, out[4]=c4, out[5]=cmdsel,
        out[6]=c6, out[7]=c7, out[8]=c8, out[9]=c9,
        out[10]=c10, out[11]=c11, out[12]=c12,
        out=cmd); //decode command
    Mux16(a=instruction, b=alu-out, sel=cmdsel, out[15]=sn, out=Areg); //firstMux
    Not(in=sn, out=NAreg);
    Register(in=Areg, load=NAreg, out=AandM, out[0..14]=addressM); //Areg
    Mux16(a=AandM, b=inM, sel=c12, out=AorM,); //A/M
    Register(in=alu-out, load=c4, out=D); //Dreg
    ALU(x=D, y=AorM, zx=c11, nx=c10, zy=c9, ny=c8, f=c7, no=c6, zr=out0, ng=outMin, out=alu-out, out=outM);
    PC(in=AandM, load=Jump, inc=, reset=reset, out=pc);

    And(a=out0, b=outMin, out=outPlu);
  And(a=outMin, b=c2, out=Jm);
    And(a=out0, b=c1, out=J0);
    And(a=outPlu, b=c0, out=Jp);
    Or(a=Jm, b=J0, out=Jout);
    Or(a=Jout, b=Jp, out=Jump);
}

Also I am out with "Error: A pin name is expected" error also change the "A pin" name many times.
A pin = Mux16(a=AandM), PC(in=AandM)
Can you please kindly help me?(´・ω・`)
Reply | Threaded
Open this post in threaded view
|

Re: For the name of the pin of the "CPU.hdl".

ybakos
@Aoeeeee, could you please remove and refrain from posting complete HDL here on the forum? Thank you.

Which line is the error?

Don't use dashes in your pin names (alu-out).
Reply | Threaded
Open this post in threaded view
|

Re: For the name of the pin of the "CPU.hdl".

cadet1620
Administrator
In reply to this post by Aoeeeee
Aoeeeee wrote
CHIP CPU {
    ...
    Mux16(a=AandM, b=inM, sel=c12, out=AorM,); //A/M
The "," after AorM is the problem.

Also
    PC(in=AandM, load=Jump, inc=, reset=reset, out=pc);
The "inc=," has no pin name.

  And(a=outMin, b=c2, out=Jm);
This line starts with two unicode characters that may be a problem if they are in your file and not just an artifact of copying/editing your source into your post.

It turns out that the '-' in pin names is not a problem.  It is an undocumented, but acceptable, character in the second and following pin name characters.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: For the name of the pin of the "CPU.hdl".

ybakos
cadet1620 wrote
It turns out that the '-' in pin names is not a problem.  It is an undocumented, but acceptable, character in the second and following pin name characters.
I still learn new things about Hack HDL, yay!

Thanks Mark.
Reply | Threaded
Open this post in threaded view
|

Re: For the name of the pin of the "CPU.hdl".

Aoeeeee
In reply to this post by Aoeeeee
This matter point and Other points went well After Fix!
I was able to fully operate the CPU!
Thank you very much^^