Search the whole station

计算机接口编程代写 Assembly Language代写 C语言编程代写

Dept of Electrical & Computer Engineering (ECE)

EE2024(E) Programming for Computer Interfaces

Assignment 1

ARM v7-M Assembly Language and C Programming

计算机接口编程代写 I. Background Concepts A function or subroutine can be programmed in assembly language and called from a C program.

I. Background Concepts

A function or subroutine can be programmed in assembly language and called from a C program. A well-written assembly language function usually executes faster than its C counterpart.

It is common in many engineering applications such as image processing and computer vision to do classification, which involves determining the class a given pattern comes from, e.g. determine from a photograph whether the person is male or female. In this case, there are 2 classes: male and female.

The performance of a classification method, for example a neural network pattern classifier, can be captured in a confusion matrix which indicates how many patterns, whose actual class is known, are correctly and wrongly classified.

II. Objective 计算机接口编程代写

The objective of this assignment is to develop an ARMv7-M assembly language function

pdm(CM,M,m)to compute the probability of detection PDm for class using m the information in a given M x M confusion matrix CM. (You may assume that M ≤ 10.)

III. Procedure

(a) Initial Configuration of Programs

The C program main.c in the project “EE2024Assign1S1AY201516” specifies a CM and the corresponding m value. This program calls pdm(CM,M,m) repeatedly for different values of m .

计算机接口编程代写

Table 1. Contents of consecutive memory locations containing elements of the confusion matrix CM for M=3. *Note: The actual memory addresses in your case may be different from those shown here.

Note: In C programs, the elements of each row and column of a square matrix are indexed from 0 to M-1, where M is the number of elements in each row and column. In this assignment, you do not need access the elements of the CM matrix in the C program. All necessary operations are to be done in the assembly language function.

(b) Preparations

After completing Lab Session 1, you should have the “Lib_CMSISv1p30_LPC17xx” project and several other projects, in the Project Explorer pane of the LPCXpresso IDE (LXIDE).

The “Lib_CMSISv1p30_LPC17xx” project contains the Cortex Microcontroller Software Interface Standard (CMSIS) files that will be explained later in lectures.

Import the “EE2024Assign1S1AY201516.zip” archive file which contains the “EE2024Assign1S1AY201516” project.

Within the “src” folder of this project, there are 3 files:

· cr_startup_lpc17.c, which is part of the CMSIS and does not need to be modified;

· pdm.s, which presently does nothing and returns to the calling C program immediately – this is where you will write the assembly language instructions that implement the pdm() function; and

· main.c, which is a C program that calls the pdm() function with the appropriate parameters, scales down the returned results and prints out the results on the console pane. You do not need to modify this file.

Note: Parameter passing between C program and assembly language function:

In general, parameters can be passed between a C program and an assembly language

function through the ARM Cortex-M3 registers. In the following example:

extern int asm_fn(arg1, arg2, …);

arg1 will be passed to the assembly language function asm_fn in the R0 register, arg2 will be passed in the R1 register, and so on. The return value of the assembly language function can be passed back to the C program through the R0 register.

(c) Procedure 计算机接口编程代写

Compile the “EE2024Assign1S1AY201516” project and execute the program. Explain the console window output that you see.

What is the address of the memory location containing element (1,1) of the CM matrix?

How do you determine this?

Write the code for the assembly language function pdm() after reading the following sub-section (d) carefully.

Pay attention to the note on contributions of each team member towards the end results of this assignment. Refer to Section IV and the Appendix of this manual.

Verify the correctness of the results computed by the function you have written that appears at the console window of the LXIDE.

Show the assembly language program and actual console output to the Graduate Assistant (GA) during the assessment session (in Week 6). See Section IV below.

(d) Assembly Language function containing a Subroutine 计算机接口编程代写

You are required to write the assembly language code for the function pdm() that computes the probability of detection PDm for class m whose formula is shown in Section I.

The assembly language program only needs to deal with integers. Note that the value returned by the pdm() is scaled down by a factor of 10000 in main.c to arrive at the final PDm value before it is printed out.

Since specific elements of CM needs to be accessed many times, it is convenient to have a subroutine named ELEMENT that can be called to retrieve a specified element (i,j) from memory. Similar to a C function, the relevant parameters have to be passed to this subroutine when it is called and the subroutine needs to be able to pass back results (if any) to the calling part of the program.

Write the ELEMENT subroutine that first determines the address of the memory location containing the requested data value before loading the data value from that memory location to a designated register. Note: it is compulsory for you to use the ELEMENT subroutine in this assignment.

The method to call and return from the ELEMENT subroutine within the pdm() assembly language function has already been implemented in the pdm.s program file.

Note: the assembly language program that you write should work for any value of M where M ≤ 10. During the assessment for Assignment 1, the Graduate Assistant (GA) will modify the main.c program and specify a different value of M and initialize another CM accordingly.

There are several aspects that you should pay attention to: 计算机接口编程代写

· It is a good practice to push the contents in the affected general purpose registers onto the stack upon entry into the assembly language function, and to pop those values at the end of the assembly language function, just before returning to the calling main program.

· In the case with a subroutine, special care must be taken with the link register (LR/R14). If the content of this register is lost, the program will not be able to return correctly from the subroutine to the calling program or function.

· If a set of actions are conditional, you may use the ARM assembly language IF-THEN (IT) block feature.

· In a RISC processor such as the ARM, arithmetic and logical operations only operate on values in registers. However, there are only a limited number of general purpose registers, and programs, e.g. complex mathematical functions, may have many variables.

Hint: Use and reuse the registers in a systematic way. Maintain a data dictionary or table to help you keep track of the storage of different variables in different registers at different times.

· The printf() function enables output from the C program running on the LPC1769 to appear on the console window within the LXIDE. However, note that the operation of printf() and data transfer speed to the console window of the LXIDE are slow compared the general execution speed of other C and assembly language instructions.

IV. Assessment (Week 6) 计算机接口编程代写

For each group of 2 students:

Write a short report of about 3 pages long to answer the questions raised in Section III (c) above and explain how your assembly language program works.

Write your names and matriculation numbers, and the name of Graduate Assistant (GA) supervising or assessing your group, clearly on the top left corner of the first page of your report.

Attach the statement of contributions to the end of the report (see the Appendix of this manual).

Bring a hardcopy of your report when you attend the assessment session and hand it up to the GA assessing your group. Show the execution of your programs and the console output from the programs and explain how your programs work.

Note:

your assembly language program will be copied onto the lab PC at the start of your assessment session. It will be compiled and tested on the lab PC.

The GA will modify your program slightly, e.g. specify a different value of M and initialize another CM accordingly, to assess whether the correct PDm values in that case can be obtained.

The final Assignment 1 mark for each student will consist of a group component and an individual component.

The supervising and assessing GA(s) will look at both aspects and will ask each student some questions in turn during the assessment. Both students need to be familiar with all aspects of the assignment and your solution as the GA can choose any one of you to explain any part of the assignment. The GA will also ask you additional questions to test your understanding.

Appendix 计算机接口编程代写

Statement of Contributions

Please prepare the following Statement of Contributions and attach it to the end of your report that is to be submitted during the assessment session (Week 6).

The information in this statement should be jointly agreed by both group members.

Here is the suggested format:

Statement of Contributions

Student 1: (name, matric.)

Student 2: (name, matric.)

A. Joint Work in algorithm development, programming and report writing (briefly list a few specific aspects):

B. Student 1’s Work in algorithm development, programming and report writing (briefly list a few specific aspects):

C. Student 2’s Work in algorithm development, programming and report writing (briefly list a few specific aspects):

We both agree that the statements above are truthful and accurate.

Signatures and Names:

(Student 1)  (Student 2)

计算机接口编程代写
计算机接口编程代写

更多代写:计算机网课托管代托  gre代考多少钱  英国商科分析金融代写  人权学代写论文  全英文作业代写 研究生毕业论文代写

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

The prev: The next:

Related recommendations

1
您有新消息,点击联系!