BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

计算机结构代写|CMPUT 229 – Assignment #3

计算机结构代写|CMPUT 229 – Assignment #3

这是一个加拿大的计算机结构assignment代写

Question 1: (20 points)

You are participating in the Computing Science Industrial Internship Program and your
placement is with Tiny Inc., a company that produces TinyProc— a new processor de
veloped for the automobile industry. All instructions in TinyProc have 16 bits. TinyProc
also works with 16-bit addresses. The format of a branch instruction in TinyProc is as
shown below:

Where rs and rt specify the source and target registers for the branch instruction,
respectively. The address of the target of a branch instruction is computed using
the same mechanism used in the MIPS processor, but the increment of the PC and
the shift left have to be adjusted for a 16-bit address machine: first the Program
Counter (PC) is incremented by two, then the bitfield address of the branch instruction
is shifted left by one, sign-extended to sixteen bits, and added to the incremented PC.

There are two branch instructions in the Instruction Set Architecture of TinyProc. The
opcode for beq is 010 and the opcode for blt is 011. When writing the MIPS assembly
code below, you cannot use pseudo-instructions that use constants that are larger than
16 bits.

a. (10 points) Write, in MIPS assembly, a subroutine called IsBranch that receives
in $a0 a memory address. If the TinyProc instruction at that address is a branch,
then IsBranch returns $v0 = 1, otherwise IsBranch returns $v0 = 0. Obey all
the MIPS calling conventions.

b. (10 points) Write, in MIPS assembly, a subroutine called CountBranches that re
ceives the address of the first instruction in a TinyProc program in $a0 and returns
in $v0 the number of branches found in the program. The instructions of this
TinyProc are stored continuously in memory and the end of the program is sig
nalled by a half word containing 0xFFFF. CountBranches must call IsBranch to
identify if an individual instruction is a branch. It must follow all the MIPS calling
conventions.

bestdaixie

评论已关闭。