- 1、本文档共31页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
MIPS Assembly Language CPSC 321 Computer Architecture Andreas Klappenecker MIPS Assembly Instructions add $t0, $t1, $t2 # $t0=$t1+$t2 sub $t0, $t1, $t2 # $t0=$t1-$t2 lw $t1, a_addr # $t1=Mem[a_addr] sw $s1, a_addr # Mem[a_addr]=$t1 Assembler directives .text assembly instructions follow .data data follows .globl globally visible label = symbolic address Addressing modes lw $s1, addr # load $s1 from addr lw $s1, 8($s0) # $s1 = Mem[$s0+8] register $s0 contains the base address access the address ($s0) possibly add an offset 8($s0) Load and move instructions la $a0, addr # load address addr into $a0 li $a0, 12 # load immediate $a0 = 12 lb $a0, c($s1) # load byte $a0 = Mem[$s1+c] lh $a0, c($s1) # load half word lw $a0, c($s1) # load word move $s0, $s1 # $s0 = $s1 Control Structures Assembly language has very few control structures: Branch instructions if cond then goto label Jump instructions goto label We can build while loops, for loops, repeat-until loops, if-then-else structures from these primitives Branch instructions beqz $s0, label if $s0==0 goto label bnez $s0, label if $s0!=0 goto label bge $s0, $s1, label if $s0=$s1 goto label ble $s0, $s1, label if $s0=$s1 goto label blt $s0, $s1, label if $s0$s1 goto label beq $s0, $s1, label if $s0==$s1 goto label bgez $s0, $s1, label if $s0=0 goto label if-then-else structures if ($t0==$t1) then /* blockA */ else /* blockB */ beq $t0, $t1, blockA j blockB blockA: … instructions of then block … j exit blockB: … instructions of else block … exit: … subsequent instructions … repeat-until loop repeat … until $t0$t1 loop: … instructions of loop … ble $t0, $t1, loop # if $t0=$t1 goto loop Other loop structures are similar… Exercise: Derive templates for various loop structures System calls load argument registers load call code syscall li $a0, 10 # load argument $a0=10 li $v0, 1 # call code to print integer syscall #
您可能关注的文档
- CEO stcok option awards and company news announcementsCEO股票期权奖励和公司新闻公告资料讲解.pptx
- ch67productandbrandstrategies产品和品牌策略和新产品开发教案资料.pptx
- ChallengesforChineseERPVendors挑战中国ERP供应商知识讲稿.ppt
- EFKidsandTeensSchoolIntroduction英孚教育儿童和青少年学校介绍幻灯片资料.ppt
- HIV口腔表征教学教材.ppt
- How Does a Successful CEO Sound如何成功的CEO教学提纲.pptx
- ISO14000环境管理体系培训讲学.ppt
- iso14001_2004专业解答培训教材.pptx
- ISO相关培训知识课件.ppt
- KPI制定操作培训资料讲解.ppt
- 2025年市国资委党委开展深入贯彻中央八项规定精神学习教育工作方案与开展学习中央八项规定主题教育工作方案(2篇文).docx
- 在2025年市商务局党组研究部署深入贯彻中央八项规定精神学习教育专题会上的讲话稿、教育动员部署会议上的讲话提纲【2篇文】.docx
- 开展2025年学习八项规定主题教育工作方案与领导在局机关深入贯彻八项规定精神学习教育部署会上的讲话稿(两篇文).docx
- 2025年深入贯彻中央八项规定精神学习教育实施方案与全面落实中央八项规定精神情况总结(2篇文).docx
- 2025年落实中央八项规定精神情况总结稿与领导在深入贯彻中央八项规定精神学习教育工作会议的主持讲话稿(2篇文).docx
- 2025年组织部长在八项规定学习教育工作专班座谈会的讲话稿与开展学习中央八项规定主题教育工作方案(两篇文).docx
- 学习2025年深入贯彻中央八项规定精神知识测试题135题【附答案】与全面深入贯彻中央八项规定精神学习教育实施方案.docx
- 2025年县委书记在中央八项规定精神学习教育动员会上的讲话稿遵守党的政治纪律和落实中央八项规定精神情况个人对照检查材料(2篇文).docx
- 2025年在深入贯彻中央八项规定精神学习教育动员部署会上的讲话稿与在市委党的建设工作领导小组会议暨部署深入贯彻中央八项规定精神学习教育专题会讲话稿(两篇文).docx
- 2025年市工业园区党工委开展深入贯彻中央八项规定精神学习教育工作方案与深入贯彻中央八项规定精神学习教育动员部署会讲话提纲【2篇文】.docx
文档评论(0)