一条指令走完三拍
运行下面这段程序,填写它打印出来的结果。
PROG = [0b00001001, 0b01000111, 0b10000011, 0b11000000]
def decode(w):
return (w >> 6) & 3, (w >> 5) & 1, w & 31
pc = 0
w = PROG[pc]
stage1 = str(w)
op, rd, imm = decode(w)
stage2 = str(op) + "-" + str(imm)
R = [0, 0]
R[rd] = imm
stage3 = str(R[0])
print(stage1 + "/" + stage2 + "/" + stage3)
全部评论