Let's check out how to use
AssemblyConverter utilizes these functionalities automatically, so familiarizing yourself with them only serves for utility/debugging purposes. First, let's import it into our Python file:
From this, we now have access to the functions to parse instructions and organize them to their binary outputs. Let us examine both.
These functions are most useful if you know the instruction, rs1, rs2, rd, etc. already. Example usage:
R, I, S, SB, U, UJ.
These functions are most useful if you have only tokenized an instruction and have not determined which token corresponds to what parameters. There is a parser built into the package that can tokenize/clean the instruction for you, if you wish to use it. Observe:
If you know the parsing function to use in advance, you can also apply it directly. The functions for each instruction type, respectively, are
Rp, Ip, Sp, SBp, Up, UJp. All of this can also be accomplished with a built-in function: