最初にコードを説明することで、私の問題を説明しやすくなります。
def initialize_function(num,instruction,emplacement1,emplacement2,current_pipeline):
function_mapping={
"LOAD" : LOAD(num,emplacement1,emplacement2,current_pipeline),
"STORE" : STORE(num,emplacement1,emplacement2,current_pipeline),
"MOVE" : MOVE_IADD(num,emplacement1,emplacement2,current_pipeline),
"IADD" : MOVE_IADD(num,emplacement1,emplacement2,current_pipeline),
"FADD" : FADD(num,emplacement1,emplacement2,current_pipeline)
}
current_pipeline=function_mapping[instruction]
return(current_pipeline)
initialize_function関数には引数がありますinstruction。instruction辞書のキーの1つに相当する文字列ですfunction_mapping。したがって、私が行うときcurrent_pipeline=function_mapping[instruction]は、の値のみを実行することになっていますinstruction。しかし、そうではありません。実際には、辞書function_mappingはキーを探す前に初期化されるため、instructionすべての関数LOAD、STORE、MOVE、IADD、FADDが次々に実行されます。
私に何ができる ?
前もって感謝します :)
MFF