Giter VIP home page Giter VIP logo

riscv's Introduction

RISC-V Explorations

Observations

I think the general strategy I am trying to follow is to use the RISC-V as assembler to generate output, and then use objdump to get the expected output, then trying to match that.

Encoding and Decoding Fun

In the following example, I used the la pseudoinstruction that could not be directly reconciled at disassembly time -- you can see it understands the effective address based on the comment for the addi instruction, but it stopped short of decoding it as la.

    la a0,0x12345

   0:   00012537                lui     a0,0x12
   4:   34550513                addi    a0,a0,837 # 0x12345

However, in the case of the nop pseudoinstruction, it is generated as addi x0,x0,0 which always decodes as nop.

    nop
    addi x0,x0,0

   0:   00000013                nop
   4:   00000013                nop

Interestingly, other addi operations with rd as the x0 register decode as mv pseudoinstructions.

    addi x0,x0,0
    addi x0,x1,0
    addi x1,x2,0

   0:   00000013                nop
   4:   00008013                mv      zero,ra
   8:   00010093                mv      ra,sp

Useful Links

https://stackoverflow.com/questions/1484817/how-do-i-make-a-simple-makefile-for-gcc-on-linux https://riscv.org/wp-content/uploads/2017/05/riscv-spec-v2.2.pdf

riscv's People

Contributors

bcr 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.