D register always 0!

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

D register always 0!

shaheemppp
This post was updated on .
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:
{
Implementation removed after fix
}

D register always shows zero,please help me fix it.
Reply | Threaded
Open this post in threaded view
|

Re: D register always 0!

dolomiti7
You didn't define a D register in your code. Please read the project implementation hints on the nand2tetris homepage:

"CPU: The Central Processing Unit can be built from the ALU built in project 2, the Register and PC chips built in project 3, and logic gates built in project 1. As usual though, we’ll use their builtin versions. In particular, your HDL code should use the ARegister and DRegister chips. These builtin chips have exactly the same functionality as the Register and PC chips built in project 3."
Reply | Threaded
Open this post in threaded view
|

Re: D register always 0!

shaheemppp
Fixed.

Really got confused at first, anyway big thankkkss for help.