def scoreboard(opcode, reg1):
oc = opcode
r = reg1
scoreboard[oc][r]
return scoreboard
print ('****PIPELINING*****')
while( 1 ):
stage_count = stage_count+1
print '\n---PIPE STAGE', stage_count, '---'
if (ic == 0):
ip, ic, opcode, reg1, reg2, addr = if_id(ip,ic)
clock = clock + 2;
opc, reg1 = scoreboard(opcode,reg1)
print scoreboard
#print ("----Instruction Fetch & Instruction Decode ----")
print 'IF&ID: operation:', opcodes[ opcode ] [1]
if_id_flag = 0
of_ex_flag = 0
wb_flag = 0
这是我的汇编程序执行代码的两个部分。我在记分牌代码中遇到错误:函数不可下标。还有其他方法可以实现此代码吗?我想打印一个 3 阶段管道的记分牌,即操作码和寄存器。