-
Notifications
You must be signed in to change notification settings - Fork 4
Description
The example programs have labels like fib: and fib_loop: plus directives like .section .text and .global fib but none of this works so the examples can't be assembled. Need labels for function entries and loop targets, section directives (.section .text/.data/.rodata), symbol directives (.global/.local), and label resolution so when you write beq x1, x2, loop or jal fib it computes the right offset or target address.
Probably need two-pass assembly - first pass collects all labels and addresses, second pass encodes instructions and resolves label references. Need a symbol table to map names to addresses, handle forward references (using a label before defining it), catch undefined/duplicate label errors. Branch offsets (B-type) and jump offsets (J-type) are relative to PC so gotta compute the difference correctly.
Look at zkir-assembler/src/parser.rs, zkir-assembler/src/lib.rs, and the example programs. Needs parser, pseudo-instructions, and encoder working first.