Skip to content

ICMC-IDE/assembler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assembler

Simple customizible assembler

CLI

Building

The CLI can be built with cargo using the following command:

cargo build --target <your-target-triple> --features=cli --bin assembler

If you dont know what is your target triple, please read this

Usage

assembler -i <source file> -s <syntax file> -o <output file>

For more information, use assembler -h

Defining syntaxes

The assembler syntaxes are defined in a TOML file containing the following tables:

Symbols

Defines the syntax symbols

[symbols]
r0 = { value = 0, tags = ["reg"] }
sp = { value = 1, tags = ["sp"] }
  • value: symbol value
  • tags: sumbol tags, used to separate symbols and as instructions argument types

Instructions

Defines the structure of the syntax instructions

[[instructions.mov]]
value = 0b1100110000000000
length = 16
arguments = [
    { type = "reg", index = 0, offset = 7, length = 3 },
    { type = "reg", index = 1, offset = 4, length = 3 },
]
documentation = "rx = ry"
  • value: intruction value
  • length: length of the instruction, if greater than the length of value, the remaining length will be assumed to be zeros
  • arguments: intruction arguments
    • type: argument type, can be a data type or a symbol tag
    • index: argument index
    • offset: argument starting offset, with 0 being the least significant bit
    • length: argument length, if greater than the length of argument value, the remaining length will be assumed to be zeros
  • documentation: optional key, used for documenting instructions

Metadata

Optional table, used for storing additional information about the syntax

[metadata]
name = "ICMC"
type = "instruction-set"

WebAssembly

This project supports packaging for WebAssembly using wasm-pack

Building

wasm-pack build --target web --reference-types --weak-refs --release

About

Assembler for the custom assembly language used for the in-house CPU

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages