Specifications

27
3.5 Running the Application Program:
Having configured the required hardware in the FPGA device, it is now necessary to create and
execute an application program that performs the desired operation. This can be done by writing
the required program either in the Nios II assembly language or in a high-level language such
as C.
A Nios II assembly-language program that implements the trivial task of light control circuit is
shown as:
.include "nios_macros.s"
.equ Switches, 0x00001800
.equ LEDs, 0x00001810
.global _start
_start:
movia r2, Switches
movia r3, LEDs
loop: ldbio r4, 0(r2)
stbio r4, 0(r3)
br loop