OutLine of Tutorial 5 - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

OutLine of Tutorial 5

Description:

Get answer using Simulator, Exercise 1. data{ value0: asciiz 'ab'; value1: byte 0x12; ... Continue with above exercise, indicate how the contents of registers ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 10
Provided by: citrAuc
Category:
Tags: outline | tutorial

less

Transcript and Presenter's Notes

Title: OutLine of Tutorial 5


1
OutLine of Tutorial 5
  • Summary of Load/Store instructions
  • Exercises reading memory in Simulator
  • Exercises writing code

2
Summary of Load/Store instructions
  • Format
  • Opcode regA, displacement(regB)
  • displacement is less than 16 bit
  • Code like ldq regA, label wont be executed in
    the Simulator, it needs to be replaced by
    following code
  • ldiq regA, label
  • ldq regA, (regA)
  • vitual memory displacement value of regB

3
Summary of Load/Store instructions
  • Load instructions in Simulator
  • ldbu
  • filling remaining bytes in register with 0
  • ldwu
  • filling remaining bytes in register with 0
  • Memory address has to be multiple of 2
  • ldl
  • filling remaining bytes in register with signed
    bit
  • Memory address has to be multiple of 4
  • ldq
  • Memory address has to be multiple of 8
  • lda
  • Load the memory address rather than the value

4
Summary of Load/Store instructions
  • Store instruction in Simulator
  • stb
  • stw
  • Memory address has to be multiple of 2
  • stl
  • Memory address has to be multiple of 4
  • stq
  • Memory address has to be multiple of 8

5
Get answer using Simulator, Exercise 1
following code is in example 5
Show the contents of memory and the labels
  • data
  • value0 asciiz "ab"
  • value1 byte 0x12
  • value2 long 0x3456
  • value3 quad 0x87654321

With above memory allocated, indicate how the
contents of registers are changed by following
instructions, and which instructions cant be
executed
ldiq t0, value0 ldq t1,
(t0) ldwu t2, 4(t0) lda t3,
3(t0) ldbu t2, (t3) ldl t3,
8(t0) ldl t4, 6(t0) ldq t5, 4(t0)
6
Continue exercise 1
Continue with above exercise, indicate how the
contents of registers are changed by following
instructions, and which instructions cant be
executed
stq t1, (t0) stb t2, 1(t0) stw t3,
2(t0) stl t3, 8(t0) ldiq t0,
value2 stq t3, (t0) stl t3, 2(t0)
7
Get answer using Simulator, Exercise 2
following code is in example 6
Show the contents of memory and the labels
  • data
  • align quad
  • value0 asciiz "ab"
  • align word
  • value1 byte 0x12
  • align long
  • value2 word 0x3456
  • value3 long 0x7890

With above memory allocated, indicate how the
contents of registers are changed by following
instructions, and which instructions cant be
executed
ldiq t0, value0 ldq t1,
(t0) ldwu t2, 4(t0) lda t3,
3(t0) ldbu t2, (t3) ldl t3,
8(t0) ldl t4, 6(t0) ldq t5, 4(t0)
8
Continue exercise 2
Continue with above exercise, indicate how the
contents of registers are changed by following
instructions, and which instructions cant be
executed
stq t1, (t0) stb t2, 1(t0) stw t3,
2(t0) stl t3, 8(t0) ldiq t0,
value2 stq t3, (t0) stl t3, 2(t0)
9
Exercise 3 add code to example 7
  • Write code to load value0,value1,value2,value3 to
    register t1,t2,t3,t4
  • Write code to store values in register
    t1,t2,t3,t4 in memory label value0,value1,value2,v
    alue3
Write a Comment
User Comments (0)
About PowerShow.com