我有這個CPU.hdl代碼。CPU.hdl - 需要說明才能理解代碼
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 into M?
addressM[15], // Address in data memory (of M)
pc[15]; // address of next instruction
PARTS:
Not(in=instruction[15], out=isAcmd);
Not(in=isAcmd, out=isCcmd);
// Create the ALU chip.
// First input to ALU is always D; 2nd is A or M based on inst[12]
Mux16(a=outA, b=inM, out=outAM, sel=instruction[12]);
ALU(x=outD, y=outAM, zx=instruction[11], nx=instruction[10], zy=instruction[9], ny=instruction[8], f=instruction[7], no=instruction[6], out=outM, out=outALU, out=inD, zr=zr, ng=ng);
//also need logic as to whether to write to M ... it's part of the instruction
And(a=isCcmd, b=instruction[3], out=writeM);
.
.
.
}
我想了解CPU.hdl。我不明白部件後的兩條線。他們完成了什麼?
這是哪一種語言?它不是VHDL或Verilog,這是兩種常用的HDL。 – Philippe
@Philippe,這是nand2tetris的hdl。我在學校學習的語言。 – theOtherOne