当我通过 computerAdd.tst 脚本测试 computer.hdl 时,我的硬件模拟器显示错误:No such built-in chip used: RAM16K,但我已经将 RAM16K chip.hdl 复制到这样的文件夹中。有谁知道为什么吗?
Computer.hdl:
CHIP Computer {
IN reset;
PARTS:
// Put your code here:
ROM32K(address=pc, out=instruction);
CPU(inM=inM, instruction=instruction, reset=reset, outM=outM, writeM=writeM, addressM=addressM, pc=pc);
Memory(in=outM, load=writeM, address=addressM, out=inM);
}
computerAdd.tst:
load Computer.hdl,
output-file ComputerAdd.out,
compare-to ComputerAdd.cmp,
output-list time%S1.4.1 reset%B2.1.2 ARegister[0]%D1.7.1 DRegister[0]%D1.7.1 PC[]%D0.4.0 RAM16K[0]%D1.7.1 RAM16K[1]%D1.7.1 RAM16K[2]%D1.7.1;
// Load a program written in the Hack machine language.
// The program adds the two constants 2 and 3 and writes the result in RAM[0].
ROM32K load Add.hack,
output;
// First run (at the beginning PC=0)
repeat 6 {
tick, tock, output;
}
// Reset the PC
set reset 1,
set RAM16K[0] 0,
tick, tock, output;
// Second run, to check that the PC was reset correctly.
set reset 0,
repeat 6 {
tick, tock, output;
}
computerAdd.cmp:
| time |reset|ARegister|DRegister|PC[]|RAM16K[0]|RAM16K[1]|RAM16K[2]|
| 0 | 0 | 0 | 0 | 0| 0 | 0 | 0 |
| 1 | 0 | 2 | 0 | 1| 0 | 0 | 0 |
| 2 | 0 | 2 | 2 | 2| 0 | 0 | 0 |
| 3 | 0 | 3 | 2 | 3| 0 | 0 | 0 |
| 4 | 0 | 3 | 5 | 4| 0 | 0 | 0 |
| 5 | 0 | 0 | 5 | 5| 0 | 0 | 0 |
| 6 | 0 | 0 | 5 | 6| 5 | 0 | 0 |
| 7 | 1 | 0 | 5 | 0| 0 | 0 | 0 |
| 8 | 0 | 2 | 5 | 1| 0 | 0 | 0 |
| 9 | 0 | 2 | 2 | 2| 0 | 0 | 0 |
| 10 | 0 | 3 | 2 | 3| 0 | 0 | 0 |
| 11 | 0 | 3 | 5 | 4| 0 | 0 | 0 |
| 12 | 0 | 0 | 5 | 5| 0 | 0 | 0 |
| 13 | 0 | 0 | 5 | 6| 5 | 0 | 0 |