代做CMP-5013A作业、代写C/C++程序语言作业、代做Operating Systems作业、C/C++课程设计作业代写
School of Computing Sciences
Module: CMP-5013A Architectures and Operating Systems
Assignment: Simple cipher in ARMv-7 assesmbly language.
Set by: Michal Mackiewicz M.Mackiewicz@uea.ac.uk
Date set: 12th October 2018
Value: 25%
Date due: 14th November 2018 3pm week 8
Returned by: 12th December 2018
Submission: Blackboard
Learning outcomes
To become familiar with the basic ARMv7-A instruction set architecture. Improved low-level
programming skills with a focus on creating efficient solutions.
Specification
Overview
In this assignment you will implement a simple cipher in the ARMv7-A assembly language.
Description
The algorithm you will implement is based on letier transpositions according to the scheme
illustrated in Table 1.
The cipher requires a secret private key, which needs to be known to both parties to encrypt
and decrypt any messages. The key can be represented by a string of characters.
Table 1: A table containing the private key and the message.
d r a g o n
a t t a c k
a t f i v e
p a s t f o
u r t o m o
r r o w x x
Let’s assume that we want to encrypt the string attack at five past four tomorrow with the
private key string dragon. First, you enter the message into a table, row by row as shown in Table
1. If there is any space let in the last row, we fill it with one of the rare le?ers e.g. x. In order
to encrypt the message, we need to change the order of the columns in the table according to
the alphabe?c order of the le?ers in the private key as shown in Table 2. Then, the enciphered
1
Table 2: A table with the reordered columns. Cipher text can be read columnwise.
a d g n o r
t a a k c t
f a i e v t
s p t o f a
t u o o m r
o r w x x r
message is read columnwise. In this case, it would be ?stoaapuraitowkeooxcvfmxtiarr. Note,
to make the deciphering opera?on harder, you need to strip any message from all white spaces
and punctuation and convert any upper case letters to lower case.
Message decryption is a reverse process utlising the same table. The cipher text is written
into the columns of Table 2 and later read according to the private key letter order.
Your ARM assembly program, which you must name cw1, must accept two command line
arguments. First argument must be 0 or 1 denoting encrypt/decrypt. The second argument
must be a string representing the private key. The actual text to be encrypted/decrypted must
be passed to the program using standard input. Your program must first convert the upper case
letters to lower case before encryption. Further, it must strip the input text from any characters
and whitespaces other than the 26 lower case English alphabet letters. The program must
return its output i.e. depending on the first argument encrypted/decrypted text using standard
output. You should test your program with the following syntax:
cat textfile.txt | ./cw1 0 privatekeystring | ./cw1 1 privatekeystring
This should return the original text from textfile.txt, albeit lower case and without
white spaces and punctuation.
You are allowed to assume that the program input will not be longer than 1000 letter characters.
Relationship to formative assessment
The formative tests, which are available on Blackboard, should be helpful in learning the ARMv7
ISA. You should complete labsheets 5-7 before atempting this coursework.
Deliverables
This is an exercise that can be done in pairs. If you choose to work in a pair you must notify
me about your pair members by email by Wed 24th Oct 5pm. If you don’t, you must complete
your work individually.
The source code must be zipped into a file with the name containing Student IDs of both
members of the group or your student ID if you worked individually. Bothmembers of the group
must then submit this (same) file to the digital dropbox located on the module Blackboard page.
Make sure you test your solu?ons on a PiCluster machine BEFORE you submit.
Late submissions need to follow the appropriate late hand-in procedure. You can find out
this information from the Hub.
If you have medical or other problems you can seek extensions to coursework deadlines.
However, it is essential you obtain proper documentation in such cases (i.e. a medical certifi-
cate).
2
If one of the pair members is granted an extension, the other member of the pair also
receives an extension. However, remember that this will apply only to those pairs who notified
me that they will work in pairs, as explained above.
If you choose to work in a pair, both members of the pair are equally responsible for the joint
work. In case of any breakdown of co-operation, you should complete your work individually
and notify me by email. You will not receive any extra marks in such a case or for the fact that
you chose or had to work individually. To make this very clear, you should treat this coursework
as an individual exercise, which you are allowed to do in pairs.
If you cannot find your pair and would like me to help you find one, then please send me
an email with your details by Monday 22nd Oct 6pm and I will try to pair you with another
student. I strongly encourage everyone to engage in pair work.
Resources
You should do the Labsheets 5-7 which are available on BB. Labsheet 7 will contain exercises
which will be particularly relevant from the point of view of this coursework. You should also
consult the lecture notes on ARMv7 ISA.
Please also note the list of references below. In par?cular, I would encourage you to go
through the relevant chapters in references [2] and [3].
You should attend all the lab sessions and discuss your progress with the teaching staff who
will be able to provide you formative feedback.
My general advice on atempting this exercise as well as any other exercise in any assembly
language would be to break the problem into small tasks and tackle them one by one. For
each of these tasks, write a pseudo-code or the C code before you start writing in the assembly
language.
Marking Scheme
This coursework carries 25% of the module weight so you will receive up to 25 marks.
We will use the following marking scheme to award marks: All functionality implemented as requested. (up to 13 marks)
Code quality. (up to 6 marks).
Quality of the code comments. (up to 6 marks).
We will judge the code quality based on the following criteria. You should follow the AAPCS
Procedure Call Standard. The use of stack as well as frequent load/store instructions should
be avoided if possible. Try to keep your variables in registers to make your program more effi-
cient. Use ARM advanced addressing modes in cases when this can reduce the number of instructions.
Moreover, try to avoid short branches by using conditional execution of non-branch
instructions.
The comments need to be extensive and they might take more space than the assembly
code. The cw1.s you will need to submit should have a header with the usual information
you find in the file headers such as the authors, dates and short descriptions. All variable to
register mappings should be made clear. For each section you could a ach a commented-out
pseudo-code or C code. You should have both section and line comments.
Finally, you must not atempt to be ‘clever’ and submit the code that was produced by the
C compiler. The requested program is simple enough to be written in assembly language from
scratch. Any suspicious code will be thoroughly investigated and may result in 0 (zero) marks
3
awarded for this assignment. We also reserve the right to quiz both members of the pair about
any part of the code.
You should supplement your code with a brief commentary describing the individual contributions
of both members of the pair.
References
[1] ARM, The ARMv7AR reference manual, https://sta?c.docs.arm.com/ddi0406/c/DDI0406C C arm architecture reference manual.pdf
Last Accessed, Oct 2018.
[2] Roger Ferrer Ibanez, Think in geek - ARM assembler in Rasberry Pi, http://thinkingeek.com/armassembler-raspberry-pi/
Last Accessed, Oct 2018.
[3] Robert G. Plantz, Introduction to Computer Organization: ARM Assembly Language Using
the Raspberry Pi, http://bob.cs.sonoma.edu/IntroCompOrg-RPi/intro-co-rpi.html
Last Accessed, Oct 2018.
[4] ARM, Procedure call standard for the ARM architecture,
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042f/IHI0042F aapcs.pdf
Last Accessed, Oct 2018.
[5] ARM, ARM and Thumb-2 Instruction Set Quick Reference Card,
http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001m/QRC0001 UAL.pdf
Last Accessed, Oct 2018.
因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
微信:codinghelp