Skip to content

Commit a737eda

Browse files
committed
update readme
1 parent ca30eb3 commit a737eda

File tree

13 files changed

+68
-2
lines changed

13 files changed

+68
-2
lines changed

README.md

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,72 @@
44

55
## Introduction
66

7-
This project implements a simple five-stage pipeline MIPS CPU in Verilog. It has basic hazard-handling mechanisms like forwarding and stalling.
7+
This project implements a simple five-stage pipeline MIPS CPU in Verilog. It has basic hazard-handling mechanisms like forwarding and stalling. It can handle basic integer arithmetic operations such as addition, subtraction, multiplication, and division. It can also handle conditional, unconditional, and register-based branches or jumpings. It supports the use of subprocedures.
88

9-
- `test_data` contains testing data
9+
- `test_data` contains testing data of various instructions.
10+
- `docs` contains textbooks and instruction sets of two subsets of MIPS.
11+
- `src` contains the Verilog source code of the CPU implementation.
12+
- `tools` contains a Mars simulator with debugging facility.
13+
14+
15+
## Run
16+
17+
1. Open an ASM file (found from the `test_data`) in the Mars simulator and dump the code in hex format to a text file named `func.txt`.
18+
2. Open the `src` folder in a Xilinx project. Compile the Verilog source code.
19+
3. Ensure the file `func.txt` can be accessed by the Verilog code and run the simulation in Xilinx.
20+
4. Optionally use the `src/utils/inspect.v` to show the time-series diagram of instruction flowing through the pipeline.
21+
22+
## Code Structure
23+
24+
```
25+
src/
26+
├── comp # Major functional components.
27+
│ ├── alu.v # ALU.
28+
│ ├── cmp.v # Comparator required by beq and bne.
29+
│ ├── ctrl.v # Istruction controller.
30+
│ ├── dm.v # Data memory.
31+
│ ├── ext.v # Signed/Zero extensions of integers.
32+
│ ├── fmux.v # Multiplexers at the input of functional units.
33+
│ ├── grf.v # General register files.
34+
│ ├── mips.v # The cpu that pulls everything together.
35+
│ ├── mux.v # Another set of muliplexers.
36+
│ ├── IF.v # Instruction memory and fetching.
37+
│ └── npc.v # Next PC generator.
38+
├── forward # Forwarding modules.
39+
│ ├── forward_btype.v # Forward B-type instructions.
40+
│ ├── forward_grf.v # Forward from GRF.
41+
│ ├── forward_ji.v # Forward Jump-immediate (JI).
42+
│ ├── forward_jr.v # Forward Jump-register (JR).
43+
│ ├── forward_rs_alu.v # Forward RS-type from ALU.
44+
│ ├── forward_rt_alu.v # Forward RT-type from ALU.
45+
│ └── forward_rt_mem.v # Forward RT-type from DM.
46+
├── stage # Pipeline registers of different stages.
47+
│ ├── EXE.v # ID/EX reg.
48+
│ ├── ID.v # IF/ID reg.
49+
│ ├── MEM.v # EX/MEM reg.
50+
│ └── WB.v # MEM/WB reg.
51+
├── stall # Stalling modules.
52+
│ ├── hctrl.v # Hazard stalling controller.
53+
│ └── hstall.v # Stalling controllers for all stages.
54+
└── utils # Debugging utilities and entrypoint file.
55+
├── inspect.v # Debugging utilithy.
56+
└── main.v # Simulation entrypoint.
57+
```
58+
59+
## Acknowledgment
60+
61+
This code was inspired by the textbook *Digital Design and Computer Architecture*. Thanks to the authors for their great book.
62+
63+
## Citation
64+
65+
If you find our code useful in your research, please consider citing us as follows:
66+
```bibtex
67+
@misc{cong_mips-pipeline-cpuverilog_2017,
68+
title = {mips-pipeline-cpu.verilog: a simple five-stage pipeline {MIPS} {CPU} that handles integer operations as well as conditional and unconditional jumps.},
69+
shorttitle = {mips-pipeline-cpu.verilog},
70+
url = {https://github.com/cgsdfc/mips-pipeline-cpu.verilog},
71+
abstract = {This project implements a simple five-stage pipeline MIPS CPU in Verilog. It has basic hazard-handling mechanisms like forwarding and stalling. It can handle basic integer arithmetic operations such as addition, subtraction, multiplication, and division. It can also handle conditional, unconditional, and register-based branches or jumpings. It supports the use of subprocedures.},
72+
author = {Cong, Feng},
73+
year = {2017},
74+
}
75+
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)