{"id":17929119,"url":"https://github.com/trinkle23897/mips32-cpu","last_synced_at":"2026-02-12T19:33:16.916Z","repository":{"id":92324566,"uuid":"164218252","full_name":"Trinkle23897/mips32-cpu","owner":"Trinkle23897","description":"奋战一学期，造台计算机（编译出的bit文件在release中，可以直接食用）","archived":false,"fork":false,"pushed_at":"2019-11-13T08:05:53.000Z","size":871,"stargazers_count":129,"open_issues_count":0,"forks_count":33,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-20T07:02:45.621Z","etag":null,"topics":["mips32cpu","verilog"],"latest_commit_sha":null,"homepage":"http://os.cs.tsinghua.edu.cn/oscourse/CCP2017","language":"Verilog","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Trinkle23897.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-01-05T13:39:26.000Z","updated_at":"2025-07-10T16:48:07.000Z","dependencies_parsed_at":"2023-05-16T21:00:22.039Z","dependency_job_id":null,"html_url":"https://github.com/Trinkle23897/mips32-cpu","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Trinkle23897/mips32-cpu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trinkle23897%2Fmips32-cpu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trinkle23897%2Fmips32-cpu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trinkle23897%2Fmips32-cpu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trinkle23897%2Fmips32-cpu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Trinkle23897","download_url":"https://codeload.github.com/Trinkle23897/mips32-cpu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trinkle23897%2Fmips32-cpu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29378819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T19:05:20.189Z","status":"ssl_error","status_checked_at":"2026-02-12T19:01:44.216Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mips32cpu","verilog"],"created_at":"2024-10-28T21:07:38.839Z","updated_at":"2026-02-12T19:33:16.897Z","avatar_url":"https://github.com/Trinkle23897.png","language":"Verilog","funding_links":[],"categories":[],"sub_categories":[],"readme":"Thinpad 模板工程\n---------------\n\n工程包含示例代码和所有引脚约束，可以直接编译。\n\n代码中包含中文注释，编码为utf-8，在Windows版Vivado下可能出现乱码问题。\n\n请统一使用utf-8编码\n\n报告位于 https://github.com/Trinkle23897/mips32-cpu/releases/download/v4.VGA/report.pdf\n\n# First Milestone (Fri. Week7)\n\nBasic CPU Implementation\n\n### Git\n\n把master给protect了，请注意不要commit一些奇奇怪怪的东西进来（比如ip文件夹），不然vivado工程在git merge完之后可能会崩……\n\n**统一四个空格缩进**，使用utf-8编码\n\n### simulation\n\n点击`Run Simulation`的`Run Behavior Simulation`，之后会生成波形图，然后可以在scope选项卡中选择，object选项卡里面会出来变量，把要看的变量拖到仿真波形图里面，点击上方有个重新开始的图标（Relaunch Simulation）就能看到仿真波形了\n\n### 测试\n\n1. 安装gnu工具链：（以ubuntu为例）\n\n   ```bash\n   sudo apt install gcc-mipsel-linux-gnu g++-mipsel-linux-gnu\n   ```\n\n2. 拉取submodule之后编译功能测例：\n\n   ```bash\n   cd cpu_testcase\n   git submodule init\n   git submodule update\n   cd ..\n   ./compile_cpu_func_test.sh\n   ```\n\n3. `main.data`编译出来之后会被塞到`thinpad_top.srcs/sources_1/new/`里面，接下来按上一节跑simulation就行了。需要参照的数据是寄存器`r0`和`s3`，分别是`$4`和`$19`的值。前者标出跑到第几组测例，后者标出一共跑通了几组测例。可以跑到`0x41`。\n\n为了跑起来，修改了`pc_reg.v`（修改了pc的初始值）和`inst_rom.v`（修改了访存的姿势）。\n\n# Second Milestone\n\n完成所有功能测例，并在板子上全部通过。频率为10M\n\n1. topmodule为thinpad_top.v和tb.sv\n2. 改了compile func test的脚本，make ver=sim是没延时的，直接make是有延时的\n3. 在外面接写好了sram的控制逻辑，在内部写好了带TLB的MMU，添加了所有异常的处理\n\n### 测试\n\n1. 编译vivado project，点击Generate bitstream，我本机五分钟之内能跑出来\n2. 本地连接192.168.8.8，远程调试连接`http://os.cs.tsinghua.edu.cn/thinpad/`\n3. 以本地为例，先传func test生成的bin，然后再把bit传上去（路径位于`thinpad_top.runs/impl_1/thinpad_top.bit`），印象中bin放置在BASERAM offset=0位置处\n4. 然后它就会自动跑，看到`0x5d`说明成功\n\n# Third Milestone\n\n运行监控程序，提频，40M\n\n### 运行方法\n\n按照监控里面的readme安装完并编译完之后上传kernel.bin，记得位置选项选择直连串口，然后才能调试\n\n```bash\n➜  term git:(75bf515) ✗ python3 term.py -t 166.111.227.237:40965\nconnecting to 166.111.227.237:40965...connected\nb'MONITOR for MIPS32 - initialized.'\n\u003e\u003e G\n\u003e\u003eaddr: 0x80002000\n\nelapsed time: 0.000s\n\u003e\u003e G\n\u003e\u003eaddr: 0x8000200c\nOK\nelapsed time: 0.000s\n\u003e\u003e G\n\u003e\u003eaddr: 0x80002030\n\nelapsed time: 10.067s\n\u003e\u003e G\n\u003e\u003eaddr: 0x80002064\n\nelapsed time: 5.033s\n\u003e\u003e G\n\u003e\u003eaddr: 0x800020ac\n\nelapsed time: 5.872s\n\u003e\u003e G\n\u003e\u003eaddr: 0x800020d8\n\nelapsed time: 12.584s\n```\n\n显示图片：\n\n```mips\n    lui t0, 8\n    lui t1, 0x8040\n    lui t2, 0xba00\n.VGA:\n    lb t3, 0(t1)\n    sb t3, 0(t2)\n    addiu t0, t0, -1\n    addiu t1, t1, 1\n    addiu t2, t2, 1\n    bnez t0, .VGA\n    nop \n```\n\n然后将图片转换成bin文件（给好了一个在bit/pic.bin），传到ExtRam里面，然后运行这段汇编代码即可看到vga中显示图像。\n\n# Fourth Milestone\n\n运行uCore\n\n跑不起来，鸽了\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrinkle23897%2Fmips32-cpu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrinkle23897%2Fmips32-cpu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrinkle23897%2Fmips32-cpu/lists"}