0% found this document useful (0 votes)
73 views4 pages

Experiment No. 4: Aim: Write A Simple NIOS II Program That Can Perform Simple I/O To Read Switches and Write

Experiment No. 4 aims to write a program that reads switches and writes to LEDs on an FPGA board. The document outlines the steps to create an NIOS II system using the SOPC builder, including assigning system components, generating the system, writing an assembly language program to set LEDs equal to switches, and a C program to do the same. It concludes that the experiment was successfully studied and executed.

Uploaded by

Mohammad Atique
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views4 pages

Experiment No. 4: Aim: Write A Simple NIOS II Program That Can Perform Simple I/O To Read Switches and Write

Experiment No. 4 aims to write a program that reads switches and writes to LEDs on an FPGA board. The document outlines the steps to create an NIOS II system using the SOPC builder, including assigning system components, generating the system, writing an assembly language program to set LEDs equal to switches, and a C program to do the same. It concludes that the experiment was successfully studied and executed.

Uploaded by

Mohammad Atique
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment No.

4
Aim: Write a simple NIOS II program that can perform simple I/O to read switches and write to LEDs. Write an assembly language program & c program to set LEDs = Switches. Theory: Steps for the system creation & generation are as follows:1. Specify the perfect name &environment. 2. Click on file New New project create directories.

3. Select kit on which working (Cyclone II), its model &version. 4. Click on SOPC builder on tools menu. 5. Assign the following system contents: NIOS module Memory & interface controller Interface protocol serial & JTAG UART Microcontroller peripherals (PIO)

6. Click on generate to generate system. 7. Use symbol tools to draw & design system with clock signals, reset pins, etc. 8. Using user manual assign switches & toggle buttons. 9. Compile the system generated. 10. Select text file & write the program. 11. Compile it, without errors. 12. Click on program device option. Select hardware (USB button) (USB blaster) & embed this created program in DE2 board. 13. Click on monitor program option & select our program file & embed in board. 14. Run this program on board. PROGRAM:Assembly language:. include nios_macros.s

.equ switches, 0x00001810 .equ LEDs, 0x00001810 . global _start _start: movia r2, switches movia r3 LEDs loop: ldbior4, o (r2) stbio r4, o (r3) br loop C language program: #define switches (volatile char *) 0x00001800 # define LEDs (char *) 0x00001810 Void main () { While (1) *LEDs =* switches; } Conclusion: Thus, we have studied & executed the above experiment successfully.

Experiment No. 5
Aim: Write a short program to compute A*B+C/D. Assume the values that have been defined according to DATA segment below; A: word 7 C: word 24 .equ B, 5 .equ D, 6 Theory: Steps for the system creation & generation are as follows:1. Specify the perfect name &environment. 2. Click on file New New project create directories.

3. Select kit on which working (Cyclone II), its model &version. 4. Click on SOPC builder on tools menu. 5. Assign the following system contents: NIOS module Memory & interface controller Interface protocol serial & JTAG UART Microcontroller peripherals (PIO)

6. Click on generate to generate system. 7. Use symbol tools to draw & design system with clock signals, reset pins, etc. 8. Using user manual assign switches & toggle buttons. 9. Compile the system generated. 10. Select text file & write the program.

11. Compile it, without errors. 12. Click on program device option. Select hardware (USB button) (USB blaster) & embed this created program in DE2 board. 13. Click on monitor program option & select our program file & embed in board. 14. Run this program on board. PROGRAM:Assembly language program:. include nios_macros.s .text .global _start A: .word 7 C: .word 24 .equ B, 5 .equ D, 6 _start: movia 616, A ldw r17, o (r16) muli r19, r17, B movi r16, D div r20, r18, r16 add r21, r19, r20 stop: br stop Conclusion: Thus, we have studied & executed the above experiment successfully.

You might also like