Giter VIP home page Giter VIP logo

mips-disassembler.py's Introduction

Mips-Disassembler.py

一、这是啥?

大二暑假当时写了个 54 条 mips 指令的单周期 CPU,当时写的头昏眼花。

但头昏眼花并不是因为 vivado 2016 极其糟糕的 UI 设计,也不是因为我本人阅读波形图能力存在缺陷,更不是因为暑假心思没有放在课程设计上。

而是因为学校 mips246 网站上只提供了 54 条指令的测试机器码(用于初始化 IP Corecoe 文件),却没有给出其对应的 mips 汇编代码。由此,我一度培养出了人脑 mips 反汇编的能力。

但是很可惜,这个对我来说 完全没有必要培养出来的能力ddl 后的第一个大懒觉残忍地抹杀了。

二、其实我知道

机器码到汇编码的转换,在 GitHub 中就有许多仓库,并且世界上有太多太多的反汇编工具。

但是能不能产生做作业时需要的用来 debug 的指令却是另外一件事。

三、但仅仅是这样

还是有一些东西我自我感觉很难处理,比如标号……

所以就先这样吧,其他有时间再说。

四、一开始居然忘了

1. 使用方法

python main.py -d file_path_to_disassembly -o output_file_path

要注意这里的输入文件不是简单的 *.coe 文件,需要把正常 *.coe 文件前两行去掉!

2. 使用例

-----
    |---main.py
    |---tools
    |---mips_31_mars_simulate.txt

需要注意的是这里的输入为:

coe->txt

没有前面两行的:

memory_initialization_radix = 16;
memory_initialization_vector =

还请认真比较与真正的 *.coe 文件的差别:

真正的 coe

之后切换到 main.py 所在路径下,在终端运行:

python main.py -d mips_31_mars_simulate.txt -o output.txt

短暂地运行后,当前目录就会有非常 nice 的输出文件啦!

nice!

有指令序号,有指令地址,有机器码,还有汇编指令。调试时你最需要的,这上面都有!

mips-disassembler.py's People

Contributors

skyleaworlder avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.