Computer Organization and Design--计组作业习题(1)
Computer Organization and Design
----------------------个人作业,如果有后辈的作业习题一致,可以参考学习,一起交流,请勿直接copy
Problem 1:
Convert the following decimal values to both binary and hexadecimal representations using 8 bit two’s complement. If you cannot convert to twos complement please explain why.
2310= 00010111two=17hex
-1510= 11110001two=F1hex
-12810= 10000000two=80hex
12810: 关于 2’s complement,8 bit可以表示的数值范围只有【-128,+127】;故128无法用8 bit2’s complement 表示;
-110= 11111111two=FFhex
Problem 2:
Convert the following LC2K assembly code into machine code in hex. All unused bits should be 0 and the machine code instructions should be 32 bits long.
add 1 2 3 : 0x000A0003
start lw 4 5 ten : 0x00A50004
beq 3 5 start : 0x011DFFFE
halt : 0x01800000
ten .fill 10 : 0x0000000A
Problem 3:
Convert the following hex numbers to LC2K instructions.
0x00550003 : nand 2 5 3
0x01670000 : jalr 4 7
0x00CAFFFF : sw 1 2 -1
Problem 4:
Given the following MIPS assembly code (and assuming all registers start at 0):
addi $1 $0 3
addi $2 $0 8
loop add $1 $1 $2
nand $3 $1 $2
addi $2 $2 -2
bne $0 $2 loop
a) Translate the MIPS code into C Code that performs the same operations. Please use the variable names reg1, reg2, and reg3 for $1, $2, and $3.
int reg1, reg2, reg3;
reg1 = 3;
reg2 = 8;
do
{
reg1 = reg1+reg2;
reg3 = ~(reg1®2);
reg2 = reg2+(-2);
}
while (reg2 !=0);
b) How many times is the line, “nand $3, $1, $2” executed?
4 times;
c) What is the final value of $3?
-310;
Problem 5:
Below is the description of a new, stack-based ISA that only contains one register, REG. The ISA is byte addressable.
R-type Instructions bits 7-5: opcode
bits 4-0: unused
I-type Instructions bits 7-5: opcode
bits 4-0: immediate value in 2’s complement form
U-type Instructions bits 7-5: opcode
bits 4-2: unused
bits 1-0: math code
a) Translate the following instructions into machine code. Please write your answers in HEX.
Instruction |
Machine Code |
flip |
40 |
load-2 |
7E |
ALU. Sub |
C1 |
b) You are given the following C code that you are to translate into this ISA’s assembly.
a = b nand c
Assume that the stack is NOT initially empty and STACK[bottom] = 0.
a is located at memory address 10, b is at 20, c is at 30. REG is initially 0. Write your code below.
load 20
push
load 30
ALU.Nand
store 10
转载于:https://www.cnblogs.com/nanashi/p/6661603.html
Computer Organization and Design--计组作业习题(1)相关推荐
- Computer Organization and Design The Hardware/Software Interface: RISC-V Edition
Computer Organization and Design The Hardware/Software Interface: RISC-V Edition 学习RISC-V的 原版书籍. 下载链 ...
- 【Computer Organization笔记29】大作业展示
本次笔记内容: P57 计算机组成原理(57) P58 计算机组成原理(58) 我的计组笔记汇总:计算机组原理成笔记 视频地址:计算机组成原理 清华大学刘卫东 全58讲 国家精品课程 1080P 更完 ...
- 计组作业【题目记录】
A:真值为负时,原码补码反码并不均相同! B:真值为正时,原码即补码,表示形式相同. 原码:-127~127 反码:-127~127 补码:-128~127 在计算机中,所谓的机器字长一般是指寄存器 ...
- 【Computer Organization】The Core Design Thinking of single cycle CPU
1 Overview This section introduces someting that maybe you need to know before learning. Note:This C ...
- 【Computer Organization笔记15】清华计组大作业布置:奋战二十天,做台计算机!
本次笔记内容: P29 计算机组成原理(29):第25分钟起 P30 计算机组成原理(30) 我的计组笔记汇总:计算机组成笔记 视频地址:计算机组成原理 清华大学刘卫东 全58讲 国家精品课程 108 ...
- 西电软工计组II作业答案(2020-2021)
西电软工计组II作业答案(2020-2021) 文章目录 西电软工计组II作业答案(2020-2021) 第六章 6.5 6.9 6.10 第七章 7.2 7.6 7.7 7.16 7.22 7.23 ...
- python代写学生作业_CS1026A留学生作业代做、代写Python实验作业、代做Python程序设计作业、代写Computer Organization作业...
CS1026A留学生作业代做.代写Python实验作业.代做Python程序设计作业.代写Computer Organization作业 日期:2019-05-31 11:23 University ...
- 大二学科不挂科 速冲方法推荐(数据结构+计组+操作系统+算法+数据库+计网)
文章目录 前引 学科速成总结 1.数据结构 2.计算机组成原理 3.操作系统 4.数据库系统概论 5.算法设计与分析 结束语 前引 这段时间本来是紧锣密鼓的在准备面试 原本以为自己已经学过的科目 考试 ...
- 计算机组织简介(Computer Organization)
计算机组织简介(Computer Organization) 作者:弘树 尊重原创版权,未经许可禁止转载 本文遵循 中国学馆联盟Html-Markdown标准 计算机只是执行程序的机器.那么,什么是程 ...
最新文章
- Azure手把手系列 1:微软中国公有云概述
- python用递归方式实现最大公约数_关于python最大递归深度 - 998
- 互联网造富亲历者讲述:屌丝富了以后
- Java面向对象编程(中级)
- [JavaWeb-JavaScript]JavaScript运算符
- Linux_ppc下软件包安装,Linux下软件包安装详解
- 使用ArrayList对大小写字母的随机打印
- 移动web:转盘抽奖(幸运大转盘)
- python循环一段代码_Python循环语句代码详解:while、for、break
- Javascript特效:输入框焦点判断
- Matlab简单教程:函数
- easypr arm linux,zhangdy
- 使用js正则匹配和替换淘口令边界
- 微信小程序+微信管理后台+微信用户前台
- Windows 11 22H2 (KB5017321) 更新失败并显示下载错误 0x800F0806
- kindeditor文本编辑器使用
- Go字符串拼接的方式与性能对比
- 【JavaScript】分享一个定时到网站上签到/签退的JS脚本
- 小恐龙游戏制作挑战:第8天-确定图片如何制作
- 小程序经济大爆发,微信向左,百度向右
热门文章
- Android RecyclerView
- Xamarin.Android 使用Timer 并更改UI
- WIN7 数据源配置问题(32位64位)
- Why Java Sucks and C# Rocks(3):Attribute与Annotation
- 用OpenCV建立一幅只有几个像素且值可以自定义的图像,并输出保存到硬盘的方法
- jquery颜色转换html,jQuery颜色选取器插件COLPICK
- Golang 随机获取本机可用端口
- Open vSwitch VLAN相关字段详解(dl_vlan、dl_vlan_pcp、vlan_vid、vlan_pcp、vlan_tci)
- git回退commit_Git进阶 温故知新系列
- 在php中插入数据显示在html_PHP中的浮点型数据计算之程序员脱发问题