第一题
.data
outputd: .asciiz "Alpha","November","First","alpha","november","Bravo","Oscar","Second","bravo","oscar","China","Paper","Third","china","paper","Delta","Quebec","Fourth","delta","quebec","Echo","Research","Fifth","echo","research","Foxtrot","Sierra","Sixth","foxtrot","sierra","Golf","Tango","Seventh","golf","tango","Hotel","Uniform","Eighth","hotel","uniform","India","Victor","Ninth","india","victor","Juliet","Whisky","zero","juliet","whisky","Kilo","X-ray","kilo","x-ray","Lima","Yankee","lima","yankee","Mary","Zulu","mary","zulu","",""
vald: .asciiz "A","N","1","a","n","B","O","2","b","o","C","P","3","c","p","D","Q","4","d","q","E","R","5","e","r","F","S","6","f","s","G","T","7","g","t","H","U","8","h","u","I","V","9","i","v","J","W","0","j","w","K","X","k","x","L","Y","l","y","M","Z","m","z","?"
unvald: .asciiz "*"
offs: .word 0,6,15,21,27,36,42,48,55,61,67,73,79,85,91,97,103,110,117,123,130,135,144,150,155,164,172,179,185,193,200,205,211,219,224,230,236,244,251,257,265,271,278,284,290,297,304,311,316,323,330,335,341,346,352,357,364,369,376,381,386,391,396,398

.text
st: li $v0,0xc
syscall
li $t1,0
ju: mul \(t2,\)t1,2 #judje the input
la $t4,vald
add \(t3,\)t2,$t4
lb \(t3,0(\)t3)
beq \(v0,\)t3,out
bgt $t1,62,out
add \(t1,\)t1,1
j ju

out: #output seq
beq $t1,62,over
# read the offset
la $t5,offs
mul \(t7,\)t1,4
add \(t6,\)t5,$t7
lw \(t6,(\)t6)
#add the offset
la $t4,outputd
add \(t3,\)t6,$t4
li $v0,4
la \(a0,(\)t3)
syscall
j st

over:

数据是程序跑出来的不贴了

第二题
.data
stringdata: .space 100
h: .byte 10
g: .byte 13
ok: .asciiz "Success! Location: "
no: .asciiz "Fail!"
.text
li $v0 8
la $a0 stringdata
li $a1 100
syscall
st:
li $v0 0xc
syscall
move $v1 $v0
j ln2
st2:
move $v0 $v1
li $t0 0
la $a0 stringdata
la $a1 h
lb \(a1 (\)a1)
lo:
add $t1 $t0 $a0
lb \(t1 (\)t1)
beq $t1 $v0 Find
beq $t1 $a1 Fail
add $t0 $t0 1
j lo

Find:
li $v0 4
la $a0 ok
syscall
add $t0 $t0 1
li $v0 1

lw $a0 $t0

move $a0 $t0
syscall
j ln

Fail:
li $v0 4
la $a0 no
syscall
j ln

ln:li $v0,0xb
lb $a0,h
syscall
j st
# lb $a0,g
# syscall
ln2:li $v0,0xb
lb $a0,h
syscall
j st2

计算机组成原理作业一 熟悉MIPS指令的更多相关文章

  1. [计算机组成原理][实验十.R-I-J型指令CPU设计实验总结]

    总算解决一大心头之患了,比想象中容易,通宵两夜,刷完了十个实验,这个实验就是最后的了.感慨颇多.特地写篇总结. 想做一件事,就立马去做把.你会发现没那么困难,往往最大的困难,是心里的困难. 培养了HD ...

  2. 重学计算机组成原理(五)- "旋转跳跃"的指令实现

    CPU执行的也不只是一条指令,一般一个程序包含很多条指令 因为有if-else.for这样的条件和循环存在,这些指令也不会一路平直执行下去. 一个计算机程序是怎么被分解成一条条指令来执行的呢 1 CP ...

  3. 3.6 MIPS指令简介

    计算机组成 3 指令系统体系结构 3.6 MIPS指令简介 MIPS秉承着指令数量少,指令功能简单的设计理念.那这样的设计理念是如何实现的呢?在这一节,我们就将来分析MIPS指令的特点. 相比于X86 ...

  4. 计算机组成原理 — CPU 中央处理器

    目录 文章目录 目录 前文列表 逻辑电路部件 组合逻辑电路 时序逻辑电路 阵列逻辑电路 中央处理器(CPU) 控制单元(控制器) 运算单元(运算器) 存储单元(寄存器组和片内缓存) CPU 的工作原理 ...

  5. 《计算机组成原理 》& 《计算机网络》& 《数据库》 Roadmap for self-taugh student

    计算机组成原理: UCB的这门课绝对是不错的资源. Great Ideas in Computer Architecture (Machine Structures) B站:https://www.b ...

  6. MIPS指令 MIPS架构

    华中科技大学 - 计算机组成原理 华中科技大学 - 计算机硬件系统设计 Microprocessor without Interlocked Pipleline Stages 无内部互锁流水级的微处理 ...

  7. MIPS指令学习二

    1.MIPS寻址方式 MIPS架构的寻址模式有寄存器寻址.立即数寻址.寄存器相对寻址和PC相对寻址4种,其中寄存器相对寻址.PC相对寻址介绍如下: 1.1.寄存器相对寻址 这种寻址模式主要被加载/存储 ...

  8. 计算机组成原理实验之CPU组成与指令周期实验

    (实验五  CPU组成与指令周期实验) 课程 计算机组成原理实验 实验日期 2015 年 12 月  8 日 一.实验目的 1.将微程序控制器同执行部件(整个数据通路)联机,组成一台模型计算机. 2. ...

  9. 【0725 | Day 1】计算机编程/计算机组成原理/计算机操作系统

    什么是编程 编程语言:人与计算机交流的手段 编程:通过编程语言编写文件 学习编程的目的:让计算机代替人力,为我们服务 计算机组成原理 计算机由五大部分组成:控制器.运算器.存储器.输入设备.输出设备. ...

随机推荐

  1. kuangbin带我飞QAQ 并查集

    1. POJ 2236 给出N个点,一开始图是空白的,两个操作,一个是增加一个点(给出坐标),一个是查询两个点间是否相通,当两点间的距离小于D或者两点通过其他点间接相连时说这两个点相通.并查集维护,每 ...

  2. Leetcode953. Verifying an Alien Dictionary验证外星语词典

    某种外星语也使用英文小写字母,但可能顺序 order 不同.字母表的顺序(order)是一些小写字母的排列. 给定一组用外星语书写的单词 words,以及其字母表的顺序 order,只有当给定的单词在 ...

  3. [转]绑定到异步的ObservableCollection

    在进行WPF开发过程中,需要从一个新的线程中操作ObservableCollection,结果程序抛出一个NotSupportedException的错误: This type of Collecti ...

  4. Range的范围

    range(N,M)的范围应为: [N,M) 例如:

  5. noi.openjudge 二分法求函数的零点

    二分法求函数的零点 总时间限制: 1000ms 内存限制: 65536kB 描述 有函数:f(x) = x5 - 15 * x4+ 85 * x3- 225 * x2+ 274 * x - 121 已 ...

  6. Navicat12.1.7破解教程

    https://blog.csdn.net/qq_39344689/article/details/85161342

  7. 用Python输出一个杨辉三角的例子

    用Python输出一个杨辉三角的例子 这篇文章主要介绍了用Python和erlang输出一个杨辉三角的例子,同时还提供了一个erlang版杨辉三角,需要的朋友可以参考下 关于杨辉三角是什么东西,右转维 ...

  8. vue 路由 URL传参

    源码如下: import Vue from 'vue' import VueRouter from 'vue-router' Vue.use(VueRouter) //全局使用该组件 const ro ...

  9. 【DM8168学习笔记6】学习思路整理

        DavinciDM8168的开发是一套大的系统,包括ARM.DSP.以及他们的通信协作.对学习思路做简单总结:     一.  对于整体框架的把握 参考了一些文章.介绍davinci整体基础知 ...

  10. webService cxf学习

    1.首先去官网下载cxf包 http://archive.apache.org/dist/cxf/ 记住要选.zip结尾 大概40兆的样子 2.把上边的包都放项目里.如果你用的jeecg框架,那它自带 ...