Skip to content

Assembling your Program

Diogo Valadares Reis dos Santos edited this page Aug 28, 2025 · 4 revisions

[Português]

[← Previous Page]

Assembling Your Program

After writing your assembly code, you may want to compile it for use in simulations. To do this, you'll need the assembler located in the ./DRISC Programs folder. There, you'll find a collection of compiled programs along with a shortcut to the assembler.

By default, your assembly file should be saved in the ./DRISC Programs/src directory with the .dasm extension.

When you run the assembler, it will display the current version, the folders in use, the address width, and a list of programs found in the source directory.

Assembler prompt

If the program list appears empty, the folder path may be incorrect. To fix this, navigate to the folder where your programs are stored using your file explorer. Copy the path, return to the assembler, type f, press Enter, and paste the folder path. Repeat the same process for the output folder if needed.

Once the folders are correctly configured, your programs should appear in the list. Select one by typing its corresponding number. The assembler will then display information about the compilation process. During the pre-processing stage, you'll typically see defines, macros, labels, and variables being added to a dictionary, followed by their substitution or translation within the code.

Pre-processing output

If your code contains errors in any defines, macros, labels, or variables, they will usually be flagged with readable error messages. However, some issues may not be detected and could result in cryptic output. In such cases, review your code to ensure that all elements are correctly defined and that parameters are properly placed. You're also encouraged to report any issues you encounter on the repository's issues page.

After pre-processing, the assembler will begin compiling each instruction. You'll see a list of instructions as modified by the pre-processing stage, which may differ from your original code. Each entry includes the memory address, the binary machine code, and the corresponding instruction. The last two elements are color-coded to help you visualize how the code is translated.

image

Once the assembly process is complete, the assembler will prompt you to create a file for SystemVerilog simulation. This generates a secondary output file that excludes the header and memory addresses used by the Logisim simulation. You can move this file to the ./verilog/programs folder to use it with the SystemVerilog simulation.

Depending on the program you're compiling, its size may exceed the default memory limit, resulting in an error at the end of execution. In such cases, you can increase the address width using the a option. However, be cautious — larger address widths can produce significantly larger files. It's recommended to stay within 16 bits, which should be sufficient for most applications.

Clone this wiki locally