Coconut is a Multi-threaded simulation of the pipeline of a MIPS Microprocessor (integer instructions only) replete with Memory Subsystem, Caches and their performance analysis, I/O device modules and an assembler.
See accompanying project-report.pdf for additional information.
Copyright 2005-2015 Varghese Mathew (Matt)
Coconut is distributed under the GNU General Public License. See License below.
The author expresses his heartfelt gratitude to Prof. Dr. Priya Chandran of the National Institute of Technology, Calicut, under whose guidance, this project first took shape.
Coconut is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Coconut is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Coconut. If not, see http://www.gnu.org/licenses/
Use of this distribution is subject to the GNU General Public License
You need to have 'c++', 'flex', 'bison' and 'POSIX' libraries installed on your computer to use this distribution.
The distribution has been tested and verified under the following platforms
- Redhat / linux 9 x86
- Ubuntu / Linux 15.10 x64
- Ubuntu MATE / Linux 15.10 armhf on Raspberry Pi 2
- Ubuntu MATE 24.04 amd64
- Ubuntu MATE 24.04 aarch64 on Raspberry Pi 400 & Raspberry Pi 5
To use the distribution, move into the 'test' directory and run 'make'. If your terminal doesn't support colors, remove the flag '-D__WITH_COLOR' from each of the files 'mips/Makefile', 'asm/Makefile', 'io/Makefile'
Once the compilation completes without errors, run (Note - the file MUST be named a.out for Coconut to bootload it.)
./asm a.out {.mips file}
to assemble a mips program for use by the simulated processor.
Then on one virtual terminal (xterm) run
./dumbterminal
and on another run
./coconut
'./coconut' asks you to first pick the caches. Then it brings you to the a prompt
mips >
where you need to issue commands. The following commands are supported
- 'n' execute one clock cycle of the processor.
- 'c {number}' execute {number} number of clock cycles.
- 'p' print values of registers. (small 'p')
- 'P' print values of registers for registers whose value is not zero. (capital 'P')
- 'q' quit.
- 'm {address}' display the value stored at memory addres {address}.
- 'd {address}' display the value stored at 1-level data cache address {address}.
- 'i {address}' display the value stored at 1-level instruction cache address {address}.
- 's' display stastics for the caches.
- 'b {breakpoint no.} {break address}' set one of the 0-15 breakpoints. To unset a breakpoint, set its address as -1.
- 'B' view all breakpoints.
When closing the simulator, make sure to first quit out of Coconut by entering 'q' at the 'mips >' prompt, before you close 'dumbterminal' (using Ctrl+C). Otherwise, you may have to wait a bit before the sockets that the terminal binds to are released, before the 'dumbterminal' can bind to them again.
To cleanup the compile, run 'make distclean' from the 'test/' folder, and remove any 'a.out' file.
Note: An example of virtual terminal mentioned above is an 'xterm' window. Howevr, you can use any terminal.
Contains the source for a simple assembler for the simulated processor.
Contains the source for the processor simulation, memory subsystem and caches - the main source code of Coconut.
Contains the source for three simple i/o devices
- A simple keyboard.
- A simple screen ( a character terminal ).
- A dumbterminal consisting of a simple screen and a simple keyboard.
Contains the header files that are made use of in all of the above three sources
This is where the programs are run from. Also it contains a few .mips files which are sample assembly programs which run on the processor and illustrate its working.
This directory contains sample outputs procured from test runs of the processor. This directory is NOT required for the application and may safely be deleted in part or in full.