Skip to content

toy handwritten assembler, emulator, compiler, toolchain for a lightweight RISC architecture

License

Notifications You must be signed in to change notification settings

redthing1/irre-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

icon

irre-tools

toy handwritten assembler, emulator, compiler, toolchain for a lightweight RISC architecture

documentation

documentation and specifications (arch, asm) are available in doc.

setup

grab submodules:

git submodule update --init --recursive

install dependencies:

quickstart build

./script/build_tools.sh

tools you now have:

  • ./src/irretool/irretool (irre multitool)
  • ./tools/chcc/chibicc (c->irre compiler)

compile a C program

// my_prog.c

int add(int a, int b) {
    return a + b;
}

int main() {
    int a = 3;
    int b = 4;
    int sum = add(a, b);
    return sum;
}

now build and run:

# compile to binary
./script/irrecc -v -o my_prog.bin my_prog.c
# run in emulator
./src/irretool/irretool -v emu my_prog.bin

run flow tracking

  1. run a compiled program and log commits and snapshots
./src/irretool/irretool -v emu --commit-log --save-commits t1_trace.bin my_prog.bin
  1. run analyzer
./src/irretool/irretool analyze --ift --pl --pl-threads 4 --ift-graph --ift-graph-analysis --ift-save-graph t1_graph.dot t1_trace.bin

About

toy handwritten assembler, emulator, compiler, toolchain for a lightweight RISC architecture

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published