I will upload a new book "write CPU by yourself", which is 44th today.
There have been many things over the past few days and they have not been updated for a long time.
9.3.4 modify the top-level OpenMIPS module
Because some modules have added interfaces, you need to modify the top-level module OpenMIPS to connect the new interfaces. At the same time, we can see from Figure 9-19 that the MEM module has added several interfaces for data storage, and these interfaces are connected to the OpenMIPS external, so the interfaces of the OpenMIPS module have to be modified, the newly added interfaces are shown in Table 9-6. The modified OpenMIPS processor interface is shown in Figure 9-23. You can compare them with Figure 4-6.
To modify the OpenMIPS module, connect the data storage interface in Table 9-6 to the interface corresponding to the MEM module. The main changes are as follows. For the complete Code, see the openmips. v file under the CD Code \ Chapter9_1 directory.
Module openmips (inputwire clk, input wire rst, input wire ['regbus] rom_data_ I, output wire ['regbus] rom_addr_o, // New interface, connect to the data storage RAM input wire ['regbus] ram_data_ I, output wire ['regbus] ram_addr_o, output wire ['regbus] ram_data_o, output wire ram_we_o, output wire [] ram_sel_o, output wire ram_ce_o );...... // modify the sample statement of the MEM module. // The objective is to connect the data storage interface in Table 9-6 with the corresponding interface of the MEM module mem mem0 (...... // information from data storage. mem_data_ I (ram_data_ I ),...... // information sent to the data storage. mem_addr_o (ram_addr_o ),. mem_we_o (ram_we_o ),. mem_sel_o (ram_sel_o ),. mem_data_o (ram_data_o ),. mem_ce_o (ram_ce_o ));...... endmodule
In the next step, we will modify the smallest part of the system to verify that the storage commands are correctly loaded.
Step 9 of self-writing the CPU (5) -- load the Storage Command 4 (modify the top-level module of OpenMIPS)