GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Fittiboy/ziscv: RISC-V assembler and simulator for a small subset of the RV32I instruction set.

BranchesTags
Open more actions menu

Latest commit

 

History

102 Commits
102 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
build.zig
build.zig
 
 
build.zig.zon
build.zig.zon
 
 
parser_grammar.txt
parser_grammar.txt
 
 

Repository files navigation

ZISC-V

This is a simplified Assembler and Simulator for a small subset of the RV32I instruction set.

It runs on 128KiB of unified instruction and data memory.

Why?

Just for Fun. No, Really.

justforfunnoreally.dev badge

Building

Zig version

Minimum Zig version is 0.16.0, and is verified to work with 0.17.0 as well.

Build process

Run zig build, and you will find ziscv-assembler and ziscv-simulator in ./zig-out/bin/.

You can choose an optimization mode with the --release=[fast,small,safe] option.

Usage

ziscv-assembler

Write a small Assembly program, using only the add, sub, or, and, slt, addi, lw, sw, and beq instructions. Comments are allowed.

Register aliases, like sp or s11 are supported, but you can of course use x0, x1, …, x31 instead. Note also that instructions and data share the same memory, and instructions are loaded starting at address 0x00000000. Trying to overwrite any of the instruction memory addresses is an error.

The program halts once it reaches the end of instruction memory. It does not halt if you decide to jump past that point deliberately. Halting happens when the program counter moves precisely one instruction beyond the final original instruction. You may write a program that writes instructions into data memory, and simply jump there with beq. You can then halt the program by jumping to the first address past instruction memory, to hit the halting condition.

Assuming the program is in src/my_program.s (try src/hello.s!), you then run ./zig-out/bin/ziscv-assembler src/my_program.s > my_program.bin to assemble the program into machine code.

ziscv-simulator

Assuming you have a my_program.bin file ready, you simply run ./zig-out/bin/ziscv-simulator my_program.bin > my_dump.bin to run the program. The raw memory content as it as at the end of the simulation is then dumped into stdout, and in this case redirected into my_dump.bin, ready to be inspected with a hex viewer/editor of your choice!

About

RISC-V assembler and simulator for a small subset of the RV32I instruction set.

Topics

educationallearning-projectriscv-assemblerriscv-simulatorrv32izig

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.