Related reference articles:
Assembly language compiler environment build:
After writing the assembler, you can compile it with as.exe to generate the x.bin file. In the early stage of learning, some parameters need to be set and the generated files need to be converted. Therefore, our teaching and R&D department organized C language and assembly language to form an effective toolchain for students to use. The toolchain is shown in Figure 3-1:
1. Copy the toolchain directory to the hard disk ( asm_compile )
2. To develop a program, first create a directory (folder) in the toolchain directory such as asm_run_led.
3. Create a subdirectory src in the newly created folder
4. Write the required assembly or C language files in the src in the newly created folder, and the stored file name is xx. S or xx. C and editing software such as Notepad++ can be used.
5. Return to the upper-level directory and see that there is a run.bat file, which is a batch file. This batch file combines executable files such as compilation and linking under DOS, and finally generates a binary file (such as asm_run_led .bin ).
6. Run run asm_run_led, the following files will be generated in the asm_run_led folder:
a. The binary files asm_run_led.bin and fii.bin can be downloaded directly to the program memory inside the FPGA to run through the serial port
b. COE, mif files fii.coe , fii.mif . This type of file can be directly combined with FPGA RAM (FPGA RAM IPCore) as an initialization file.
c. Disassemble the file fii.txt. This file type can observe and analyze the relationship between assembly language and binary instruction encoding
Note: Assembly language compilation is actually a process of translation and encoding, that is, compiling assembly instructions into machine code. The CPU decodes and executes instructions when reading them.
Disassembler: The fii.txt file is also generated in the toolchain, which can be used to observe the relationship between assembly instructions and machine code.
The RISC-V CPU executes the instruction:
1. First download the compiled FPGA file ( fii_cpu_sys.bit ) into the fpga (using the FII-PRX100-D development board)
2. Connect the USB cable to the computer and the B-type port of the FII-PRX100-D’s USB TO UART,
3. Open the serial communication software
a. sscom tool software
4. Press the ” OK ” button and wait for the program to be sent to the development board
5. Select the corresponding file and send it to the development board.
6. The tool software settings are shown in the following figure:
7. Observe the experimental results
Download the assembly editing environment:
FPGA MCS file download:
Download gadgets such as sscom: