Giter VIP home page Giter VIP logo

mips32-cpu's Introduction

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

跑不起来,鸽了

mips32-cpu's People

Contributors

naginikaido avatar trinkle23897 avatar z4yx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mips32-cpu's Issues

thinpad_top.srcs/sources_1/new/cpu/id.v:403, maybe a typo?

                `EXE_BNE: begin //                       here ↓
                    wreg_o <= `WriteDisable; aluop_o <= `EXE_BLEZ_OP; alusel_o <= `EXE_RES_JUMP_BRANCH;
                    reg1_read_o <= 1'b1; reg2_read_o <= 1'b1; instvalid <= `InstValid;
                    next_inst_in_delayslot_o <= `InDelaySlot;
                    if (reg1_o != reg2_o) begin
                        branch_target_address_o <= pc_plus_4 + imm_sll2_signedext;
                        branch_flag_o <= `Branch;
                    end
                end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.