feat: cpu, memory, computer hdl
This commit is contained in:
44
project-5-computer-architecture/hdl/Computer.hdl
Normal file
44
project-5-computer-architecture/hdl/Computer.hdl
Normal file
@@ -0,0 +1,44 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/5/Computer.hdl
|
||||
/**
|
||||
* The Hack computer, consisting of CPU, ROM and RAM.
|
||||
* When reset = 0, the program stored in the ROM executes.
|
||||
* When reset = 1, the program's execution restarts.
|
||||
* Thus, to start running the currently loaded program,
|
||||
* set reset to 1, and then set it to 0.
|
||||
* From this point onwards, the user is at the mercy of the software.
|
||||
* Depending on the program's code, and whether the code is correct,
|
||||
* the screen may show some output, the user may be expected to enter
|
||||
* some input using the keyboard, or the program may do some procerssing.
|
||||
*/
|
||||
CHIP Computer {
|
||||
|
||||
IN reset;
|
||||
|
||||
PARTS:
|
||||
|
||||
ROM32K(
|
||||
address=pcOut,
|
||||
out=romInstructionOut
|
||||
);
|
||||
|
||||
CPU(
|
||||
inM=memoryOut,
|
||||
instruction=romInstructionOut,
|
||||
reset=reset,
|
||||
outM=cpuOutMOut,
|
||||
writeM= cpuWriteMOut,
|
||||
addressM= cpuAddressMOut,
|
||||
pc=pcOut
|
||||
);
|
||||
|
||||
Memory(
|
||||
in= cpuOutMOut,
|
||||
load= cpuWriteMOut,
|
||||
address= cpuAddressMOut,
|
||||
out=memoryOut
|
||||
);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user