CPSC 355: Computing Machinery

UNIVERSITY OF CALGARY
DEPARTMENT OF COMPUTER SCIENCE
Spring 2019
CPSC 355: Computing Machinery I
Assignment 01
Weight: 6% of final grade
Due: May 17th (11:59 PM)
Basic Assembly Language Programming
Create an ARMv8 A64 assembly language program that finds the maximum of, by stepping through the range one by one in a loop and testing. Use
only long integers for x, and do not factor the expression. Use the printf() function to display to
the screen the values of x, y and the current maximum on each iteration of your loop.
You are to create 2 versions of your program:
1. Write the program without macros (i.e. don‘t use m4), and use only the mul, add, and mov
instructions to do your calculations. Use a pre-test loop, where the test is at the top of the
loop.
2. Optimize the above program by putting the loop test at the bottom of the loop (make sure it
is still a pre-test loop), and by making use of the madd instruction. Also, add macros to the
above program to make it more readable (use m4). In particular, provide macros for heavily
used registers.
Running Your Program
To verify that your assembly language program works, run both versions under gdb, capturing

CPSC 355作业代写、代做Computing Machinery I作业、代写Python/C++实验作业
output from each session using the script UNIX command. For version 1, single step through the
program (use ni) for at least one iteration of your loop, displaying the instruction being executed
(use display/i $pc). Also print out the contents of particular registers (use p) at key points in your
program to show that it is working as expected. For version 2, set a breakpoint just after the place
where the final result is calculated, and then print out the maximum. Do not single step through
this version.
Other Requirements
Make sure your code is properly formatted into columns, is readable and fully documented, and
includes identifying information at the top of each file. You must comment each line of assembly
code. Your code should also be well designed: make sure it is well organized, clear, and concise.
2
New Skills Needed for this Assignment:
Ability to work with basic arithmetic, loops, and if-else constructs in assembly.
Ability to print to standard output using the printf() function.
Ability to optimize assembly code by rearranging loops and using alternate instructions.
Ability to use macros in assembly code.
Ability to assemble programs using gcc and use m4 to process macros.
Ability to use gdb to debug and display assembly language programs.
Submit the following:
Your assembly source code files for both programs and 2 scripts via D2L. Use the Assignment 1
Dropbox Folder in D2L to submit electronically. Your TA will assemble and run your programs to
test them. Name your programs assign1a.s and assign1b.asm, and your scripts script1.txt and
script2.txt.
Marking Criteria
Functionality (Version 1)
Equation calculation 4 ______
Test for maximum 4 ______
Display to screen using printf() 2 ______
Loop 4 ______
Optimization (Version 2) 3 ______
Use of Macros (Version 2) 3 ______
2 Scripts showing use of gdb 4 ______
Complete documentation and commenting 4 ______
Design quality 2 ______
Total 30 ______

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected]

微信:codinghelp

原文地址:https://www.cnblogs.com/xifua/p/10886784.html

时间: 2024-10-10 19:56:49

CPSC 355: Computing Machinery的相关文章

Kattis - Association for Computing Machinery

Association for Computing Machinery ACM (Association for Computing Machinery) organizes the International Collegiate Programming Contest (ICPC) worldwide every year. In the ICPC, a team of three students is presented with a problem set that contains 

图灵的文章“Computing machinery and intelligence”译文

图灵奠基AI的力作“Computing  machinery and intelligence”全文译完,摘自http://blog.sciencenet.cn/blog-2322490-1122667.html,如有侵权及时联系我,我会第一时间删除. 计算机器与智能 目录 1,模仿游戏 2,对新问题的评价 3,游戏中的机器 4,数字计算机 5,数字计算机的通用性 6,主要问题的对立观点 7,学习机器 1,模仿游戏 我建议考虑这样一个问题:“机器能思考吗?”要回答这个问题,需先给出术语“机器”和

程序史记:从巴贝奇、爱达到图灵

书架上一直放在一本<信息简史>,最近终于读完了.这是一本从信息的视角来描述其进化史的书,一本充满了技术性描述的科普性书籍.也不乏一些有趣的故事,其中就有那么几个人,他们实际是和计算机和程序有关,而计算机和程序在今天这个信息时代早已是信息的载体和处理者了. 十八世纪 查尔斯·巴贝奇(Charles Babbage),90 后,恩,一个十八世纪的 90 后(1791 年生),出生于工业革命的高峰时期.那时英国工业革命的巅峰作品 -- 蒸汽机,在他出生前没几年才刚刚被发明出来. 那时,是一个崇尚机械

什么是人工智能?

目录 1. 概述 2. 基本问题 3. 人工智能的分支 4. 人工智能的应用 概述 本文为外行人解答一些关于人工智能的基本问题,这里表达的看法并不都是AI研究者的一致意见. 基本问题 Q: 什么是人工智能? A: 人工智能是制造智能机器的科学和工程学,尤其是制作智能计算机程序.它与使用计算机来理解人类智能相似,但并不局限于生物可观察的方式方法. Q: 什么是智能? A: 现实世界中实现目标需要能力,而能力之中计算的部分便是智能.人类,许多动物和一些机器身上都展现出了不同类型和程度的智能. Q:

SQLite剖析之动态内存分配

SQLite通过动态内存分配来获取各种对象(例如数据库连接和SQL预处理语句)所需内存.建立数据库文件的内存Cache.以及保存查询结果.我们做了很多努力来让SQLite的动态内存分配子系统可靠.可预测.健壮并且高效.本文概述SQLite的动态内存分配,软件开发人员在使用SQLite时可以据此获得最佳性能. 1.特性    SQLite内核和它的内存分配子系统提供以下特性:    (1)对内存分配失败的健壮处理.如果一个内存分配请求失败(即malloc()或realloc()返回NULL),SQ

SQL的发展史

在20世纪60年代,网状数据库系统(如CODASYL)和分层数据库系统(如IMS TM)是用于自动化银行业务.记帐和订单处理系统的一流技术,这些系统是由于商业大型计算机的引入才启用的.而SQL是在70年代创建的一种基于关系数据库管理系统(Relational Database Management System,RDBMS)模型的数据查询.操作语言. 1.1 CODASYL CODASYL是美国数据系统语言协会(Conference on Data System Language)的英文缩写,该

Method for balancing binary search trees

Method for balancing a?binary?search?tree. A computer implemented method for balancing a?binary?search?tree includes locating a node in a?binary?search?tree, determining whether a depth of the located node is greater than a threshold, and performing

Graph Cut and Its Application in Computer Vision

Graph Cut and Its Application in Computer Vision 原文出处: http://lincccc.blogspot.tw/2011/04/graph-cut-and-its-application-in.html 网络流算法最初用于解决流网络的优化问题,比如水管网络.通信传输和城市的车流等.Graph cut作为其中一类最常见的算法,用于求解流网络的最小割,即寻找一个总容量最小的边集合,去掉这个集合中的所有边将阻断这个网络.图像和视频也能被视作网络(或者

【转】软件工程研究领域最顶级的两个期刊

[1] IEEE Transactions on Software Engineering (IEEE T SOFTWARE ENG, 简称TSE) 中文名:IEEE软件工程汇刊 出版社:IEEE,1975年创刊 期刊网址:http://ieeexplore.ieee.org/xpl/RecentIssue.jsp?punumber=32 http://www.computer.org/portal/web/tse/home 影响因子(Impact Factor):2.588 (2013):JC