Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Semester 2 AY 2021-2022

RBE207TC Embedded Computer Systems

Laboratory Manual for Experiment

Experiment

Simulation  and  analysis  of  assembler  program  in ARM-based  embedded system

Firstly, you need to use the VisUAL2 and ARMSim# software to program, run, and simulate the ARM7 assembly language. Then you need to use the datapath diagrams to analyse  the  programmed  instructions.  Please  include  relevant  screenshots  and photographs from the simulation software in your results reporting, including a short description of the results.

The example program is referred to materials on LearningMall.

For instructions on using VisUAL2 and ARMSim# software, please find that in the example below.

For the experiment, every student must submit one file that includes simulation results and relevant simple descriptions.

Deadline: 28th May 2023 23:59

Here is an example.

I.     Introduction to ARMSim#

A.    Installing

ARMSim#  1.91  is  an  ARM7TDMI  simulator  developed  by  the  Department  of Computer science at the University of Victoria. The detailed information ofARMSim# can be found on the main website hosted by the University of Victoria.

http://webhome.cs.uvic.ca/~nigelh/ARMSim-V2.1/index.html

For your convenience, the software package of ARMSim# has been uploaded to the Learningmall. You need to extract the contents and run the .exe file in the folder. Please be noticed that the users must have the .NET 3.0 framework installed. If you don’t have that, please follow the instruction from Microsoft to install that.

 

B.    Getting start with ARMSim#

1. Open the ARMSim#

 

Load the sample code (RBE207TC – Sample Code – 1.s)

 

Run the code

 

 

2. Setting of ARMSim#

 


 

Click all plugins

 

Enable the Instruction Cache and Data Cache if you need those

 

Open the PluginsUI ifyou need that

 

 

Open the memory window if you need that

 

 

C.    SWI Codes for I/O in ARMSim#

Here is the simplified guide which referenced from officially User Guide. The officially User Guide has been uploaded on the Learningmall (ARMSim_UserGuide4Plus.pdf).

1.   Basic SWI Operations for I/O

The SWI codes numbered in the range 0 to 255 inclusive are reserved for basic instructions that ARMSim# needs for I/O and should not be altered. Their list is shown in Table. The example of their use can be found in the officially User Guide.

Table 1. SWI I/O operations (0x00  0xFF)

 

 

2.   SWI Operations for Other PlugIns: the Embest Board Plug‐In

The SWI codes numbered greater than 255 have special purposes. They are mainly used for interaction with Plug‐in modules which can be loaded with the ARMSim# simulator. Table 2 provides a current list of these codes used in the Embest Board Plug‐in View. Examples of their use can be found in the officially User Guide.

A diagram representing schematically the features of the Embest board is shown below:

 

There are 5 main components in this view available for programming:

1.   One 8-segment display (output).

2.   Two LED lights (output).

3.   Two black buttons (input).

4.   Sixteen blue buttons are arranged in a keyboard 4 x 4 grid (input).

5.   One LCD display screen, which is a grid of 40 columns by 15 rows of individual cells. The coordinates for each LCD cell are specified by a {column, row} pair. The  top‐left  cell  has  coordinates  {0,0},  while  the  bottom‐right  cell  has coordinates {39,14}. Each cell can contain exactly one ASCII character.

Table 2. SWI operations greater than 0xFF as currently used for

the Embest board PlugIn

 

 

 

II.     Introduction to VisUAL2

A.  Introduction of VisUAL

VisUAL2 is a highly visual ARM emulator that could let beginners easily write small and medium-sized ARM assembler programs, with no manual and intuitive visual debugging. This program was developed by the Department of Electrical & Electronic Engineering at Imperial College London. The detailed information of VisUAL2 can be founded on the main website

https://tomcl.github.io/visual2.github.io/

The VisUAL2 can be downloaded as portable Windows, OS-X and Linux binaries. For your convenience, The software package has been uploaded to the learningmall.

VisuAL is designed to be self-documenting: no manual needed. Try it and see!

B.  Getting start with VisUAL2

Open the VisUAL2

 

Open the example code (RBE207TC – Sample Code – 2.s)

 

Run the program

 

Observe the change of status

 

III.     Simulate the sample project

1.   Open the sample code (RBE207TC- Sample Code - 3 - for ARMSim.s is for ARMSim#, RBE207TC- Sample Code - 3 - for VisUAL.s is for VisUAL2)

2.   Run the program code

3.   Record your observation

-    Performed function on the simulation software

-    Assembled language & Instruction code

-    Register

-    Memory

-     Cache (please make sure the Cache has been enabled)

-    PluginsUI (for ARMSim# only)

-    Instructions: Clock cycles (for VisUAL2 only)

4.   Discuss  the   difference  between  the  ARMSim#   and  VisUAl2.   (e.g.  the PluiginsUI and swi instructions inARMSim# ). Why is the PluginsUI important for the ARMSim#? It could be considered a kind of I/O in the embedded system.

5.   Use the datapath diagrams (shown below) to analyse each type of instruction.

 

6.   Explain the relationship between Instructions and Clock cycles, discuss how to reduce the CPI for the program.

Note: you can use Ctrl + PrScm to copy the screen if you like to

IV.     Code your own program

Code the program

In this section, you need to use both VisUAL2 and ARMSim# to code the required program. After that, you need to analyse the code you write and discuss how to further decrease the program's CPI.

1.   Compare two numbers A and B, ifA<B, turn on the right LED (for ARMSim#), if A>B, swap two numbers, turn on the left LED (for ARMSim#), if A=B, turn on both LEDs (for ARMSim#).

2.   Use the following codes as the beginning of your program. Write a program to find the largest and smallest number. The largest and smallest number needs to be saved in register r7 and r8, respectively. For ARMSim#, these numbers also need to be displayed in the console and LCD screen (use the Embest Board

MOV MOV STR  MOV STR  MOV STR  MOV STR  MOV STR  MOV STR  MOV STR  MOV STR  MOV STR  MOV STR

r0, #0x00002000

r1, #9

r1, [r0],#4

r1, #3

r1, [r0],#4

r1, #1

r1, [r0],#4

r1, #4

r1, [r0],#4

r1, #8

r1, [r0],#4

r1, #5

r1, [r0],#4

r1, #7

r1, [r0],#4

r1, #2

r1, [r0],#4

r1, #10

r1, [r0],#4

r1, #6

r1, [r0],#4

3.   Use the following codes as the beginning of your program. Write a sort program to sort these ten numbers from largest to smallest, then save them to memory. For ARMSim#, the sorted number also need to be displayed in the console and LCD screen (use the Embest Board Plug‐In).

MOV

r0, #0x00002000

MOV

r1, # 18

STR

r1, [r0],#4

MOV

r1, #6

STR

r1, [r0],#4

MOV

r1, #2

STR

r1, [r0],#4

MOV

r1, #8

STR

r1, [r0],#4

MOV

r1, # 16

STR

r1, [r0],#4

MOV

r1, # 10

STR

r1, [r0],#4

MOV

r1, # 14

STR

r1, [r0],#4

MOV

r1, #4

STR

r1, [r0],#4

MOV

r1, #20

STR

r1, [r0],#4

MOV

r1, # 12

STR

r1, [r0],#4

Lab Report Guideline

The experimental report for Lab will cover the following parts:

1)  Cover Page

The cover page contains the experimental title, student name and ID number.

2)  Abstract (5%)

The abstract is a short section of 50 to 300 words which must be capable of being read and understood independently of the rest of the report. This section should briefly summarise

(a)     purpose and scope of the experiment,

(b)     experimental procedures that were carried out, and

(c)     main conclusions.

This section is possibly the most difficult to write and you are advised to write it last.

3)      Introduction (10%)

The introduction session is a brief section, which describes, in general terms, the scope of the experiment and its relevance to the field of study you are engaged in. A statement of objectives should be given along with general comments about how the experiment will be carried out. The organization of the report should be provided at the end of the introduction session.

4)      Experiment procedure (70%)

The  section gives details of how experiments/measurements are carried out. Experiment results are recorded and analysed properly via tables and graphs. The comments of the code are provided to further demonstrate the understanding of the   code.   The  procedure   and  the  report   subsections   should   follow  the requirements as shown in the lab script for each of the experiments.

Simulate the Project:

i.   Run the sample program on VisUAL2 and ARMSim# (5%)

ii.  Explain your observation(10%)

iii. The difference between the ARMSim# and VisUAl2 (5%)

iv. Use the datapath diagrams to analyse each type of instruction. (10%)

iv. Explain the relationship between Instructions and Clockcycles (5%)

Code your own program:

i.   Comparison of two numbers (10%)

a.   Design the flowchart of the program. (3%)

b.   Complete the appropriate code. (3%)

c.   Demonstration of the output. (4%)

ii.  Find the largest and smallest number. (10%)

d.   Design the flowchart of the program. (3%)

e.   Complete the appropriate code. (3%)

f.   Demonstration of the output. (4%)

iii. The sort program (15%)

a.   Design the flowchart of the program. (5%)

b.   Complete the appropriate code. (5%)

c.   Demonstration of the output. (5%)

5)       Conclusion (10%)

The section provides a concise statement of what has been learnt or confirmed by the experiment. It might include an assessment of the significance and reliability of the results, implications of experimental errors and possible alternative  experimental  approaches.  It  must  be  consistent  with  earlier sections.

6)       Overall standard of presentation (5%)

English Grammar, Cover page, contents, abstract, I. introduction (Section 1), II.  main body (Section 2 & 3), III.conclusion, acknowledgment, references,              appendices etc,