How I Built a Fully Functioning MIPS Single-Cycle Processor from Scratch?
As the end of week 7 of my studies at UCL is approaching, I thought this was the right time to give you an insight on one of the projects I have been working on lately as a part of my first-year UCL Computer Science Course. Let us jump into it.
The task was to build a functioning CPU based on the MIPS architecture, given only basic logic gates (AND, OR, NOT, XOR), in a 5-week time-frame. The circuit simulations were made using Quartus Prime software and Intel Field-Programmable Gate Array (FPGA) was used to configure to our hardware circuit.
We had weekly lectures about the CPU structure and laboratory sessions to work on the project. We were building each component of the CPU from ground up, for example, to just build the Adder of the Arithmetic Logic Unit (ALU), we had to first build a half adder, then make a 1-bit adder, scale it up to a 32-bit adder, and change the ripple adder to a carry-lookahead adder for faster computing process.
Step by step we built our own Program Counter, ALU, Control Unit, and other bigger and smaller circuits. After hours spent debugging and completing individual components, the real challenge was putting it all together in one Central Processing Unit. This required the understanding of the Single-Cycle Datapath of a Processor, but luckily, there is enough information about MIPS architecture to read and figure this out. Once we completed the entire circuit for the CPU, we wrote the MIPS assembly code to display a sequence of square numbers to verify and validate the processor.
Overall, the Project was very educative and enjoyable. I was able to understand the subtleties of a Computer Processor and to expand my knowledge of Computer Architecture. I am glad I could recreate and investigate the Fetch-Decode-Execute cycle from hands-on experience and learn from it.
The reason why this project stands out from my previous ones is that it is mainly “Computer Science” oriented. I enjoy creating software, studying algorithms and data structures, but one thing you do not see that often is the project that puts previously abstract computational theory into practice. I am constantly curious about what is happening under the hood, and the theoretical part of Computer Science answers my questions and allows me to look at things at a deeper level of abstraction. There is so much more for me to learn, it is only week 7 of my studies, and I am looking forward to working on projects like this, building on my knowledge and feeding my curiosity.