文件名称:windlx
介绍说明--下载内容均来自于网络,请自行研究使用
经统计,某机器14条指令的使用频度分别为:0.01,0.15,0.12,0.03,0.02,0.04,0.02,0.04,0.01,0.13,0.15,0.14,0.11,0.03。分别求出用等长码、Huffman码、只有两种码长的扩展操作码3种编码方式的操作码平均码长。
解:
等长操作码的平均码长=4位 Huffman编码的平均码长=3.38位 只有两种码长的扩展操作码的平均码长=3.4位。
9.若某机要求:三地址指令4条,单地址指令255条,零地址指令16条。设指令字长为12位.每个
地址码长为3位。问能否以扩展操作码为其编码?如果其中单地址指令为254条呢?说明其理由。
答:①不能用扩展码为其编码。
∵指令字长12位,每个地址码占3位;
∴三地址指令最多是2^(12-3-3-3)=8条, 现三地址指令需4条,
∴可有4条编码作为扩展码,
∴单地址指令最多为4×2^3×2^3=2^8=256条,
现要求单地址指令255条,∴可有一条编码作扩展码
∴零地址指令最多为1×2^3=8条
不满足题目要求
∴不可能以扩展码为其编码。
②若单地址指令254条,可以用扩展码为其编码。
∵依据①中推导,单地址指令中可用2条编码作为扩展码
∴零地址指令为2×2^3=16条,满足题目要求-By the statistics, a machine 14 commands the use of frequency were: 0.01,0.15,0.12,0.03,0.02,0.04,0.02,0.04,0.01,0.13,0.15,0.14,0.11,0.03. Were obtained using such a long code, Huffman code, there are only two yards of the three kinds of expansion opcode opcode encoding of the average code length
解:
等长操作码的平均码长=4位 Huffman编码的平均码长=3.38位 只有两种码长的扩展操作码的平均码长=3.4位。
9.若某机要求:三地址指令4条,单地址指令255条,零地址指令16条。设指令字长为12位.每个
地址码长为3位。问能否以扩展操作码为其编码?如果其中单地址指令为254条呢?说明其理由。
答:①不能用扩展码为其编码。
∵指令字长12位,每个地址码占3位;
∴三地址指令最多是2^(12-3-3-3)=8条, 现三地址指令需4条,
∴可有4条编码作为扩展码,
∴单地址指令最多为4×2^3×2^3=2^8=256条,
现要求单地址指令255条,∴可有一条编码作扩展码
∴零地址指令最多为1×2^3=8条
不满足题目要求
∴不可能以扩展码为其编码。
②若单地址指令254条,可以用扩展码为其编码。
∵依据①中推导,单地址指令中可用2条编码作为扩展码
∴零地址指令为2×2^3=16条,满足题目要求-By the statistics, a machine 14 commands the use of frequency were: 0.01,0.15,0.12,0.03,0.02,0.04,0.02,0.04,0.01,0.13,0.15,0.14,0.11,0.03. Were obtained using such a long code, Huffman code, there are only two yards of the three kinds of expansion opcode opcode encoding of the average code length
(系统自动生成,下载前可以参看下载内容)
下载文件列表
FACT.S
GCM.S
INPUT.S
PRIM.S
README
SJZ.WDC
WDLXTUT.DOC
WINDLX.EXE
WINDLX.HLP
GCM.S
INPUT.S
PRIM.S
README
SJZ.WDC
WDLXTUT.DOC
WINDLX.EXE
WINDLX.HLP