Level 47: Create Computer
Task
Final level! Write top.v — the top-level module that instantiates the CPU and connects it to the physical ports of the Tang Nano 9K board.
The project contains several files (tabs on the left):
top.v— editable: your top-level module.cpu.v— read-only: Counter8 → ROM → Reg8 (simplified processor).counter8.v,adder8.v,full_adder.v,reg8.v— read-only: standard building blocks.
Top interface: clk (clock), top_sw[7:0] (switches), top_led[7:0] (LEDs). Press «Build Computer» — the project assembles into a ZIP archive with pins.cst for flashing to the Tang Nano 9K.
Related materials
- Control Unit — instruction decoder
- Module Hierarchy — multi-file projects
Solution
The Top module is extremely simple — just instantiate the CPU and wire the ports:
module Top(
input wire clk,
input wire [7:0] top_sw,
output wire [7:0] top_led
);
CPU cpu(clk, top_sw, top_led);
endmodule
Then press «Build Computer». The generated ZIP includes:
- All project files (
top.v,cpu.v,counter8.v,adder8.v,full_adder.v,reg8.v) pins.cst— physical constraints: port-to-pin mapping for Tang Nano 9K (clk → 45, top switches and LEDs)
The ZIP is ready to be loaded into Gowin IDE for synthesis and flashing to the real board!