Giter Site home page Giter Site logo

riscv_asm_tools's Introduction

A collection of small programs and tools fully written in RiscV 64bit assembly

This is for learning and fun. I restrict myself to actual syscalls and RiscV 64bit. All written for the GNU-as.

Currently implemented: cat, mandelbrot.

mandelbrot

This code creates a buffer, injects a BMP header, generates an RGB palette table and computes a mandelbrot graphic to be written as a BMP file in 2048x1024 pix as default. You can provide two integers as command line arguments for a specific x y size (new ATOI() asm code). ./mandelbrot 8192 4096 takes 10 seconds on my VisionFive2. -> 708 Bytes.

cat

This tool comes in several flavors, in order of creation/complexity.

cat_buf

Reads/writes into 1K buffer repeatedly over file, over all files -> 800 Bytes with C-ext: 768 Bytes

cat_mmap_full

uses mmap syscall to fetch each input file as a whole at once and then write it out, over all files -> 760 Bytes with C-ext: 696 Bytes

cat_mmap_full_elf

Same as cat_mmap_full but includes its own minmal(ish) ELF64 header -> 352 Bytes with C-ext: 288 Bytes

TODOs

  • maybe add error handling to cat family
  • mandelbrot using fork()

Notes/Warnings

  • compressed instructions don't take x0 as second argument for mv anymore.
  • GNU-as translates mv a0,zero into li a0,0 but will NOT compress it. Use li a0,0 straight away.

riscv_asm_tools's People

Contributors

enthusi avatar

Stargazers

Paul G 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.