MARS使用手册

更新时间:2023-07-22 15:33:52 阅读: 评论:0

MARS使用手册
MARS是MIPS汇编语言的模拟机,由密苏里州立大学开发,其下载地址是www.cs.missouristate.edu/MARS 目前最新版本为3.6。
下面我们将分三个部分介绍MARS。
第一部分:MARS的基本使用
我们将根据示例程序Fibonacci.asm----用于计算斐波那契序列,来具体演示MARS的操作步骤。
1、双击,启动MARS程序。
2、点击菜单File…Open或者双击打开工具栏按钮,打开Fibonacci.asm程序。(所有的工具栏按钮都具有相应的菜单项,在后续的具体操作中我们将尽可能地使用工具栏按钮。
3、双击工具栏按钮,汇编该程序。
4、熟悉程序初始数据在内存中的位置和具体的数值。单击复选框,在“10进制显示”和“16进制显示”之间进行切换。
长度为19的数组fibs被初始化为0,其内存地址为0x10010000 … 0x10010048。
变量size的内存地址为0x1001004c,其值为19.描写泰山的诗句
地址0x10010050 … 0x1001006c中存放着一些非空的ASCII串。
5、使用“Settings”菜单配置MARS的显示内容。我国教育的目的
6、观察寄存器显示窗口,这里显示了32个通用MIPS寄存器的内容。寄存器显示窗口里的另外两个标签页显示了浮点运算寄存器(Coproc 1)和(Coproc 0),暂时可以不看。
7、使用滑动条来改变运行速度,便于观察汇编程序的执行过程,而不是瞬间运行完毕。
8、选择程序运行方式:
:直接运行程序:通过黄色高亮部分来观察程序的运行,并在数据段显示窗口Data Segment display中观察斐波那契序列数值的变化。如下图中黄色和蓝色部分。
:重置程序为初始值。
:单步执行程序,和(单步回退程序)功能相反。
9、在输入输出窗口中观察程序的输出,如下图所示:
10、修改某个内存地址中的内容。(修改寄存器的内容类似)
优秀设计师在输出结果子程序的第一条指令前添加断点,即勾中该指令的复选框。
单击,重新运行程序后,程序将在断点处停止运行。
早安的唯美句子
双击存储菲波那契序列 某个内存位置,该单元将高亮显示,并接受键盘输入。输入一个数值,按回车键结束输入,如下图所示,内存地址0x10010008中现在存放的数据是0x00000024。
单击,从断点处继续执行程序。程序的输出将会包含刚才输入的数值,而不是原来的菲波那契数。
11、单击,查看帮助文件,熟悉MIPS指令、伪指令、directives和syscalls。
12、修改程序,使得 程序运行时提示用户输入菲波那契序列的长度。
选择Edition标签页,返回程序编辑界面。
MIPS注释符号是#。一行中#后面的所有符号都是注释内容。
唐朝著名诗人去掉第12行到第19行代码的注释标志,这几行用于提示用户输入 菲波那契序列的长度,允许输入的长度范围为2-19(主要是受32位数的大小限制)。
查找帮助文件,找出执行读入整数功能的syscall指令的参数值。
13、重新运行程序,观察结果值。
Part 2 : MARS Tools
You may have noticed that MARS has a Tools menu.  The capabilities provided through this menu really catapult MARS into a different league of computer science educational software.
We call each of the items in the Tools menu a MARS Tool.  A MARS Tool is best described as a pop-up application that obrves MIPS memory and/or register activity during MIPS program execution then communicates that activity to the tool ur to rve a particular purpo.  This is best en by example.
MARS Tools Activity 1 : Running the Data Cache Simulator tool
1.Clo any MIPS programs you are currently using.
周代2.Open the program row-major.asm from the Examples folder.  This program will traver a 16 by 16 element integer matrix in row-major order, assigning elements the values 0 through 255 in order.  It performs the following algorithm:

for (row = 0; row < 16; row++) 
  for (col = 0; col < 16; col++) 
      data[row][col] = value++;
3.Asmble the program.
4.From the Tools menu, lect Data Cache Simulator牡丹亭电影.  A new frame will appear in the middle of the screen.
This is a MARS Tool that will simulate the u and performance of cache memory when the underlying MIPS program executes.  Notice its three major ctions:
Cache Organization:  You can u the combo boxes to specify how the cache will be con
figured for this run.  Feel free to explore the different ttings, but the default is fine for now.
是可忍孰不可忍的意思Cache Performance:  With each memory access during program execution, the simulator will determine whether or not that access can be satisfied from cache and update the performance display accordingly.
Tool Control:  The buttons perform generic control functions as described by their labels.
5.Click the tool's Connect to MIPS button.  This caus the tool to register as an obrver of MIPS memory and thus respond during program execution.
6.Back in MARS, adjust the Run Speed slider to 30 instructions per cond.  It is located at the right side of the toolbar.  This slows execution so you can watch the Cache Performance animation.
7.In MARS, run the program using the Run toolbar button , the menu item or keyboard shortcut.  Watch the Cache Performance animate as it is updated with every access to MIPS memory.
8.What was the final cache hit rate?  _____________.  With each miss, a block of 4 words are written into the cache.  In a row-major traversal, matrix elements are accesd in the same order they are stored in memory.  Thus each cache miss is followed by 3 hits as the next 3 elements are found in the same cache block.  This is followed by another miss when Direct Mapping maps to the next cache block, and the patterns repeats itlf.  So 3 of every 4 memory access will be resolved in cache.
9.Given that explanation, what do you predict the hit rate will be if the block size is incread from 4 words to 8 words?  ______________.  Decread from 4 words to 2 words? ___________.
10.Verify your predictions by modifying the block size and re-running the program from step 7. 
NOTE: when you modify the Cache Organization, the performance values are automatically ret (you can always u the tool's Ret button). 
NOTE: You have to ret    the MIPS program before you can re-run it.
NOTE: Feel free to adjust the Run Speed slider to maximum speed anytime you want.

本文发布于:2023-07-22 15:33:52,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1092100.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:程序   输入   显示   运行
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图