Skip to content

Commit f332840

Browse files
committed
rename
1 parent 31ae8f6 commit f332840

File tree

15 files changed

+668
-653
lines changed

15 files changed

+668
-653
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.vscode
2+
.DS_Store

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
This is the classic MIPS R3000 pipeline processor implemented in Verilog. Originally, the code was planned to be minimal, handling hassles or data races as many as possible, but is not meant to `catch` all possibilities leading to bad fortune. However, under the great testing pressure of our school, many detections and bugfixes took place and the code became INCREDIBLY stable within the range of instructions it supports.
1+
# mips-pipeline-cpu.verilog
22

3-
A brief introduction to the setting of our course design will surely help you understand what this piece of code achieved, what are its limitations and how you can utilize it.
3+
## Introduction
44

5-
In the first place, the course carries out in `PROJECT X` form, where `X` ranges from 0 to 8. For details of each project, please see the directory pdf. Projects 0 to 3 primarily focused on drawing circuit diagrams using software named `Logisim`` (logical circuit simulation) which was quite out of date, as well as writing short programs in the MIPS assembly. From Project 4 on, we revolved around implementing CPU with more and more complicated techniques. Project 4 's main key is a single-period CPU which executes each instruction in one clock tick. Project 5 evolved to designing processors using pipelines to improve the throughput. Project 6 adds multiplication and division with some byte-wise addressing instructions on top of Project 5. In Project 7 we started to support exceptions and interrupts, while the last project gave us a chance to burn the softcore onto an integrated circuit.
6-
7-
The author of this repo found his place in ONLY Project 5, which means the code ONLY supports a reduced set of MIPS R3000 instructions without CP0 and other interruption facilities. From this perspective, the code seems to appear in a non-completed state. However, the main point here is to demonstrate fundamentally how the pipeline works and how to solve hazards and data races with stalls and bypasses, 2 basic techniques introduced in most undergraduate textbooks. As an effort towards good modularity, the code divided functionalities into Verilog modules, making it easier to understand.
8-
9-
You can also find many other materials in this field in my following uploading, including textbooks, example code with docs, instruction set specifications (in both English and Chinese), and most importantly, the test data, which generally comes in 3 files: a .txt hex code version for input, a .asm assembly version for debug ease and a .out for correct output to check against. What's more, an enhanced Mars is also provided which greatly reduces human power in terms of regression test and bug-fixing. It prints the effect of each executed instruction in the console. Another debugging tool is an inspect module that produces a time-space diagram of the execution process happening inside the CPU. One can look closely at the diagram to reveal some possible RAW data races to see whether bugs arose from failing to handle them well.

main.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from pathlib import Path as P
2+
3+
COMMENT_CHARS = "//"
4+
lic = P("./LICENSE").read_text().splitlines()
5+
lic = [" ".join([COMMENT_CHARS, line]) for line in lic]
6+
lic = "\n".join(lic) + "\n\n"
7+
8+
import itertools
9+
10+
for f in P(".").rglob("bypass*.v"):
11+
f.rename(f.with_name(f.name.replace('bypass', 'forward')))
12+
print(f)
13+
14+
# for f in itertools.chain(
15+
# P("./src").rglob("*.cpp"),
16+
# P("./src").rglob("*.h"),
17+
# ):
18+
# code = lic + f.read_text()
19+
# f.write_text(code)

src/bypass/bypass_grf.v

Lines changed: 0 additions & 189 deletions
This file was deleted.

0 commit comments

Comments
 (0)