Understanding Memory in Nios II

Click For Summary
SUMMARY

The discussion focuses on determining the value held in register r7 after executing specific Nios II assembly instructions. The first method incorrectly assumes register values correspond to word addresses, resulting in an erroneous value of 0xABCDF01A. The second method correctly calculates r5 as 0x30, leading to the accurate conclusion that r7 will also hold the value 0x30. Understanding the distinction between register values and memory addresses is crucial for accurate assembly programming in Nios II.

PREREQUISITES
  • Familiarity with Nios II assembly language syntax
  • Understanding of register operations in Nios II architecture
  • Knowledge of memory addressing modes in assembly programming
  • Ability to read and interpret technical documentation for Nios II processors
NEXT STEPS
  • Study the Nios II Programming Model documentation for detailed register usage
  • Learn about Nios II instruction set and addressing modes
  • Explore the Nios II Assembler manual for syntax and operational guidelines
  • Practice writing and debugging simple Nios II assembly programs
USEFUL FOR

This discussion is beneficial for students learning assembly language, embedded systems developers working with Nios II processors, and anyone seeking to deepen their understanding of register operations and memory addressing in assembly programming.

Lapse
Messages
49
Reaction score
4

Homework Statement


s4q18TZhCjMbtN-asYlZYHKvnS8TxLoX6NuNq5hfDaX1yTWQfnYfLrNH_0-GRur2i-g4FKG3_9EOw7IUCW5bogCXL8Qr5gXd.png


My specific question is:
What is the value held in r7 (written in hexadecimal) after the following instructions execute?
addi r5, r0, 0x30 ldw r7, 0(r5)


Homework Equations



N/A

The Attempt at a Solution



There's a few things I'm not understanding...

Here are my attempts:

Method 1:
r5 = r0 + 0x30 = 0xABCDEFAA + 0x30 = 0xABCDF01A
r7 = r5 + 0 = 0xABCDF01A

Notice that I assigned the "word address" values as the "register values". Is this correct? Is a word address the same as a register?

Method 2:
r5 = r0 + 0x30 = 0 + 0x30 = 0x30
r7 = r5 + 0 = 0x30



Here, I assumed no value was given for the registers, so I assigned the register number as the register value; i.e. r0 = 0, or r2 = 2. Is this the correct method?
 

Attachments

  • s4q18TZhCjMbtN-asYlZYHKvnS8TxLoX6NuNq5hfDaX1yTWQfnYfLrNH_0-GRur2i-g4FKG3_9EOw7IUCW5bogCXL8Qr5gXd.png
    s4q18TZhCjMbtN-asYlZYHKvnS8TxLoX6NuNq5hfDaX1yTWQfnYfLrNH_0-GRur2i-g4FKG3_9EOw7IUCW5bogCXL8Qr5gXd.png
    10.8 KB · Views: 575
Physics news on Phys.org
Afraid you will have to read the documentation for the processor. It is available at:
https://www.intel.com/content/alter...tation/iga1420498949526.html#iga1409257893438

In the Table of Contents tree along the left side of the page, start at "Programming Model".
You may also need to find the manual for the Assembler to help in figuring out the instruction syntax and the addressing modes.

There is always the possibility that someone reading this is familiar with the NIos II and is willing to help, but don't count on it.

Sorry.
 
  • Like
Likes   Reactions: anorlunda

Similar threads

Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
10
Views
10K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K