MIPS汇编代写

AND STRUCTURE OF C OMPUTADORES G Rado I NGINEERING I NFORMA

Computer Architecture Group

Practice one Introduction to assembly language

Course 2018/2019

one

Objectives of the practice ………………………………………. ………………………………………….. ……. 3 Exercise 1 ………………………………………… ………………………………………….. ……………………. 3 Exercise 2 ………………………………………… ………………………………………….. ……………………. 4

Important aspects to consider …………………………………….. ……………………………. 5 General rules ………………………………………… ………………………………………….. ………………… 5 Codes of practice ………………………………………. ………………………………………….. ……………… 5 ………………………………………. practice memory ………………………………………….. …………… 6

……………………………………….. test definition ………………………………………….. …….. 7 Delivery procedure …………………………………….. practice ……………………………. 8 ………………………………………. assessment practice ………………………………………….. ….. 9

Content

two

Objectives of the practice

The aim of the practice is to understand the basic concepts related to programming in assembler. To do this, it will be used as an example the MIPS32 assembler and simulator QtSpim. The practice consists of 2 exercises.

Exercise 1

The objective of this exercise is to develop a program in assembler to locate the number of occurrences of a word in an alphabet soup represented by a square array of characters. To this end, design and implement the code in a function named
searchwords which accepts three arguments:

  • –  Argument 1: starting address of the character array, which is stored by rows.
  • –  Plot 2: dimension of the matrix (N). It is considered that the matrix is ​​square.
  • –  Argument 3: direction of the string to be searched.

    The function will return a single value, the number of times the string appears in the matrix. Be aware that the array may include upper and lower case. The search will ignore if they are not case sensitive. The function must be able to run for any parent, of any size and any search word. They are considered only occurrences that appear in rows and columns (not diagonal) both from right to left and left to right. For example, the matrix shown below Chain “Hello”

    It appears 5 times (are marked in bold).

    HA L

    i

    KJTF Jc

    Consider the matrix only includes letters, both uppercase and lowercase letters, but no numbers and special characters. The string to search always have at least one letter, ie, never pass an empty string as an argument.

    Both the matrix to be used at all times as the search string should be defined in the data segment. To the above string will be defined as follows:

HO l

x OR LC c C

TO Konx ag

h kkme

EB

DIO

L X ALO

to s

L BBYUJ

olah OH

IO

or K

XO

Oh

H J

. data:

Word: .asciiz “Hello”
N: .word 8 # dimension of alphabet soup

WordSearch: .byte ‘H’, ‘O’, ‘l’, ‘A’, ‘K’, ‘O’, ‘N’, ‘X’,
‘A’, ‘g’, ‘h’, ‘k’, ‘k’, ‘m’, ‘e’, ​​’E’, ‘B’, ‘x’, ‘O’, ‘L’, ‘C ‘,’ c ‘,’ C ‘,’ D ‘,’ I ‘,’ O ‘,’ L ‘. ‘X’,

‘A,’ L ‘,’ O ‘,’ H ‘,’ A ‘,’ L ‘,’ a ‘,’ s’, ‘I’, ‘O’, ‘u’, ‘K’ , ‘L’, ‘B’, ‘B’, ‘Y’, ‘U’, ‘J’, ‘X’, ‘O’, ‘O’, ‘H’, ‘O’, ‘L’, ‘ A, ‘O’, ‘H’, ‘i’, ‘H’, ‘J’, ‘K’, ‘J’, ‘T’, ‘F’, ‘J’, ‘c’

3

The text segment of the program to be developed must include the function main, the function
searchwords and all those auxiliary functions deemed necessary for the development of the program. The function main should only be responsible for calling the function
searchwords with corresponding arguments ( WordSearch, Word Y N defined in the data segment) and print only the result returned.

The implementation of the program should produce the following output: X

Where X is the number of occurrences of the search word. For the above example, the program should print: 5

Exercise 2

The objective of this exercise is to develop an assembly program that processes an array of floating point numbers in single-precision ( float). For this, a function is developed called ExtractExponents which accepts the following arguments in the following order:

  • –  Argument 1: Start address matrix floating point numbers (A).
  • –  Plot 2: Number of rows of the matrix (N).
  • –  Argument 3: Number of columns of the matrix (M)
  • –  Argument 4: Start address of an array of integers (B) of dimension NxM,
  • –  Argument 5: integer X.
    The function will process all the elements of the matrix A and perform the following functions:

    If exponent (A [i, j] <X) then B [i, j] = exponent (A [i, j]) Sino B [i, j] = 99999;

    Consider the matrix A will only include standard or non-standard numbers, but never contain NaN, positive infinity or minus infinity. The number 0 is considered a non-normalized number.

    The function will return the number of exponents satisfying the condition to be less than
    X. The function must consider the real value of the exponent stored in the number. Note that the exponents are represented in the IEEE 754 standard excess. Arrays are stored by rows. Thus, for example, to the number 8.5 ( 10 = 1000.1 ( 2 = 1.0001 3 (2 the exponene to be stored is three.

    The two matrices to be used at all times be defined in the data segment. Next, an example of data segment two matrices A and B representing two 2×3 matrices of dimension numbers is shown float and whole respectively. the X value (argument 5) is also defined.

4

. data:

A .float 8.3, 4.5, 0,
– 1.2, 0, 40000.57

B: .word 0, 0, 0
0, 0, 0

N: .word 2 M: .word 3 X: .word 10

On

text segment of the program to be developed must include the function main, the function
ExtractExponents and all those auxiliary functions deemed necessary for the development of the program. The function main should only be responsible for calling the function
ExtractExponents with corresponding motions (A, B, M, N and X defined in data segments) and print only the result returned. The function developed must operate properly for any matrix any dimension correctly defined in the data segment.

The result for the information specified above will be: 3, 2, -126
0, -126, 99999

Important things to consider general rules

one) Delivering practice done through entregadores enabled. Not allowed delivery via email.

two) Delivery will be made within the period given by the betrayers. It is possible that for a
Global Classroom entregador the deadline for delivery at 24:00 finish 10 minutes earlier. Check the support Aula Global.

3) Copied special attention to detect functionality between two practices will be provided. In case
finding common implementations in two practices (or the like contained in the memory), both will score 0.

Codes of practice

one) The two exercises performed must use mandatorily functions. To do this
followed agreement parameter passing described class. Those exercises that do not include any functions besides the main, be graded with 0. Those functions

5

who do not follow correctly the parameter passing convention will also be rated at 0.

two) All exercises should follow the output format requested in each statement.

3) They have to surrender the two years requested.

4) All exercises should follow the output format requested in each statement.

5) Exercises that do not compile or does not fit the functionality and requirements posed, They will score 0.

6) A program mentioned, get a rating of 0.

Memory Practice

one) Memory (one document) must contain at least the following sections:

or Home where the authors listed (including full name, address and NIA email).

or Index of contents.
or Contents orders in different exercises (one section per year). or Conclusions and problems encountered.

two) The length of memory should not exceed 10 pages ( cover and index included). 3) About the possible orders description of the programs:

or It has to detail the main functions implemented. The report must describe
the behavior of programs, as well as major design decisions.
It must include the pseudocode corresponding to each of the exercises in this practice.

or It must include the battery testing (as defined in the following section)
used to validate the functionality of the requested functions and results
obtained. It will be given highest score to advanced testing, extreme cases, and generally those tests to ensure the proper functioning of the practice in all cases.

or Avoid duplicate tests that evaluate the same program streams. The
score this section is not measured by the number of tests, but the degree of coverage of them. Better is little evidence evaluating different cases many tests always assess the same case.

NOTE: DO NOT NEGLECT THE QUALITY OF YOUR PRACTICE REPORT.

Approve memory is so essential to pass the practice as the correct operation thereof. If the memory evaluated practice, it is considered that does not reach the minimum permitted its practice will be suspended.

6

Definition test

For the definition section and battery testing each of the exercises to be included in the memory the following format is followed:

For example, for a program manager to determine if a 32-bit integer passed argument is greater than 0, the various tests that could be performed are shown below:

Data to be entered:

Test description:

Expected result:

Obtained result:

Data to be entered:

Test description:

Expected result:

Obtained result:

0

Check if it works on the limit value 0.

FALSE

FALSE

5

Check if it works with any number greater than

0.

Check if it works with any number less

0.

TRUE

TRUE

-fifteen

FALSE

FALSE

– 2147483648

Check if it works with the negative limit value of a 32-bit integer.

FALSE

FALSE

2147483647

Check if it works with the positive limit value of a 32-bit integer.

TRUE

TRUE

Despite not being able to complete an exercise code must submit the appropriate test design in memory indicating the result obtained inability to run the test.

7

Delivery procedure practice

Delivering practice 1 done electronically through Global Classroom

The submission deadline for both is the day November 4, 2017 at 23:55 hours.

It is possible to deliver as many times as you like within the deadline given, the only recorded version of his practice is the last delivered. Valuation practice is the assessment of the content of this latest installment. Always check what you deliver.

deliverer: He must deliver a single compressed file format zip with the name ec_p1_AAAAAAAAA_BBBBBBBBB.zip where A and B … A … B are the NIA team members.

The file zip must contain only the following files:

  • ejercicio1.s
  • ejercicio2.s
  • memoria.pdf

8

Assessment practice

The evaluation of the practice will be divided into two parts:

  • Code (7 points)
  • Memory (3 points)

    The score for each year shall be:

  • Exercise 1 (5 points)
  • Exercise 2 (5 points)

    If an exercise your score is not delivered will be 0. Note that, to follow the continuous evaluation process, the minimum grade in each practice should be 2 and the average of the two practices 4.

    NOTES :
    one. If a serious error concept in practice is detected (in any section

    any exercise), the overall assessment of the practical will be zero points (0 points).

    two. In case of finding common implementations in two practices (or content Similar memory), both will score 0.

    3. If found code snippets obtained directly from the Internet, practice will have a rating of 0.

9