Introduction
The inline assembly is a feature in programming languages like C and C++ that allows you
to embed assembly language code directly within your high-level code. This feature
allows you to write your assembly instructions in line with your C or C++ code, instead
of having to write and compile the assembly language file separately. This is useful in
situations that need fine-grained control over hardware resources or performing
low-level operations that are not easily expressed in higher-level languages. Typically,
inline assembly can be useful if you need to:
- Access hardware resources—Inline assembly allows you access to hardware resources that is unaccessible or does not have suitable intrinsic function available in high-level language.
- Performance optimization—You may use inline assembly to design sections of code that are time-critical and more optimized than high-level language.
CAUTION: Inline assembly is a powerful tool for low-level
operations and optimization. However, inline assembly can make your design harder to
maintain. Therefore, you need to use it with caution and sparingly.
Note: All inline assembly syntax explained in this user guide is based
on GNU GCC v8.3.0, which is the out-of-box toolchain used by Efinity
RISC-V Embedded Software IDE. Refer to GNU GCC Online Documentation for more
information.