• Stars
    star
    122
  • Rank 292,031 (Top 6 %)
  • Language Verilog
  • Created almost 6 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

奋战一学期,造台计算机(编译出的bit文件在release中,可以直接食用)

Thinpad 模板工程

工程包含示例代码和所有引脚约束,可以直接编译。

代码中包含中文注释,编码为utf-8,在Windows版Vivado下可能出现乱码问题。

请统一使用utf-8编码

报告位于 https://github.com/Trinkle23897/mips32-cpu/releases/download/v4.VGA/report.pdf

First Milestone (Fri. Week7)

Basic CPU Implementation

Git

把master给protect了,请注意不要commit一些奇奇怪怪的东西进来(比如ip文件夹),不然vivado工程在git merge完之后可能会崩……

统一四个空格缩进,使用utf-8编码

simulation

点击Run SimulationRun Behavior Simulation,之后会生成波形图,然后可以在scope选项卡中选择,object选项卡里面会出来变量,把要看的变量拖到仿真波形图里面,点击上方有个重新开始的图标(Relaunch Simulation)就能看到仿真波形了

测试

  1. 安装gnu工具链:(以ubuntu为例)

    sudo apt install gcc-mipsel-linux-gnu g++-mipsel-linux-gnu
  2. 拉取submodule之后编译功能测例:

    cd cpu_testcase
    git submodule init
    git submodule update
    cd ..
    ./compile_cpu_func_test.sh
  3. main.data编译出来之后会被塞到thinpad_top.srcs/sources_1/new/里面,接下来按上一节跑simulation就行了。需要参照的数据是寄存器r0s3,分别是$4$19的值。前者标出跑到第几组测例,后者标出一共跑通了几组测例。可以跑到0x41

为了跑起来,修改了pc_reg.v(修改了pc的初始值)和inst_rom.v(修改了访存的姿势)。

Second Milestone

完成所有功能测例,并在板子上全部通过。频率为10M

  1. topmodule为thinpad_top.v和tb.sv
  2. 改了compile func test的脚本,make ver=sim是没延时的,直接make是有延时的
  3. 在外面接写好了sram的控制逻辑,在内部写好了带TLB的MMU,添加了所有异常的处理

测试

  1. 编译vivado project,点击Generate bitstream,我本机五分钟之内能跑出来
  2. 本地连接192.168.8.8,远程调试连接http://os.cs.tsinghua.edu.cn/thinpad/
  3. 以本地为例,先传func test生成的bin,然后再把bit传上去(路径位于thinpad_top.runs/impl_1/thinpad_top.bit),印象中bin放置在BASERAM offset=0位置处
  4. 然后它就会自动跑,看到0x5d说明成功

Third Milestone

运行监控程序,提频,40M

运行方法

按照监控里面的readme安装完并编译完之后上传kernel.bin,记得位置选项选择直连串口,然后才能调试

➜  term git:(75bf515) ✗ python3 term.py -t 166.111.227.237:40965
connecting to 166.111.227.237:40965...connected
b'MONITOR for MIPS32 - initialized.'
>> G
>>addr: 0x80002000

elapsed time: 0.000s
>> G
>>addr: 0x8000200c
OK
elapsed time: 0.000s
>> G
>>addr: 0x80002030

elapsed time: 10.067s
>> G
>>addr: 0x80002064

elapsed time: 5.033s
>> G
>>addr: 0x800020ac

elapsed time: 5.872s
>> G
>>addr: 0x800020d8

elapsed time: 12.584s

显示图片:

    lui t0, 8
    lui t1, 0x8040
    lui t2, 0xba00
.VGA:
    lb t3, 0(t1)
    sb t3, 0(t2)
    addiu t0, t0, -1
    addiu t1, t1, 1
    addiu t2, t2, 1
    bnez t0, .VGA
    nop 

然后将图片转换成bin文件(给好了一个在bit/pic.bin),传到ExtRam里面,然后运行这段汇编代码即可看到vga中显示图像。

Fourth Milestone

运行uCore

跑不起来,鸽了

More Repositories

1

Undergraduate

Collection of undergraduate course homework and projects
C++
1,022
star
2

THU-CST-Cracker

清华大学计算机系课程攻略 Guidance for courses in Department of Computer Science and Technology, Tsinghua University
993
star
3

tuixue.online-visa

https://tuixue.online/visa/ A Real-time Display of U.S. Visa Appointment Status Website 预约美帝签证各个签证处最早时间的爬虫
Python
807
star
4

oi_slides

我的 OI 课件
472
star
5

learn2018-autodown

清华大学新版网络学堂课程自动下载脚本 / A python script to clone all files from learn.tsinghua.edu.cn
Python
270
star
6

Fast-Poisson-Image-Editing

A fast poisson image editing implementation that can utilize multi-core CPU or GPU to handle a high-resolution image input.
Python
250
star
7

Computational-Graphics-THU-2018

Computational Graphics - THU Spring 2018
C
175
star
8

router

造路由器 (清华大学 网络原理课程 2018-2019秋)
C++
67
star
9

CV

My Curriculum Vitae
TeX
51
star
10

os2019

操作系统 2019 ucore labs
C
48
star
11

Artificial-Neural-Network-THU-2018

4 small homeworks
Python
38
star
12

ml

Machine Learning repo
Jupyter Notebook
36
star
13

online-application-course-upload

Python
32
star
14

decaf-complier

编译原理 2018秋 6次PA
Java
30
star
15

CS294-112

CS 294-112 @ UCB Deep RL
Python
21
star
16

simple-news-android-app

Java课程大作业
Java
17
star
17

sudoku-qt5

A Qt5 Sudoku game
C++
14
star
18

GRErecite

GRE 再要你命3K 背单词小程序
Python
14
star
19

LAP-server

A simple Linux+Apache2+PHP server
PHP
9
star
20

DIP2018

Digital image processing (THU Spring 2017-2018)
C
6
star
21

Trinkle23897

4
star
22

VizDoom2018-Track1

Supplemental materials for "Playing FPS Games with Environment-Aware Hierarchical Reinforcement Learning", accepted by IJCAI'19
4
star
23

list_of_people

DIGITAL Command Language
3
star
24

csp

Trival solutions for trivial problems of CCF CSP.
C++
3
star
25

draughts-qt5

C++
1
star
26

mjc-mwe

C
1
star