def __init__(self, inst): self.inst = inst self.IF = IF() self.ID = ID(self.inst) self.M1 = M1() self.M2 = M2() self.M3 = M3() self.M4 = M4() self.M5 = M5() self.M6 = M6(self.inst) self.M7 = M7(self.inst) self.MEM = MEM(self.inst) self.WB = WB(self.inst) self.execution_order = [ 'IF', 'ID', 'M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'MEM', 'WB' ] self.execution_status = { 'IF': False, 'ID': False, 'M1': False, 'M2': False, 'M3': False, 'M4': False, 'M5': False, 'M6': False, 'M7': False, 'MEM': False, 'WB': False }
def __init__(self, inst): self.inst = inst self.IF = IF() self.ID = ID(self.inst) self.EX = EX() self.MEM = MEM(self.inst) self.WB = WB(self.inst) self.execution_order = ['IF', 'ID', 'EX', 'MEM', 'WB'] self.execution_status = { 'IF': False, 'ID': False, 'EX': False, 'MEM': False, 'WB': False }
def __init__(self, inst): self.inst = inst self.IF = IF() self.ID = ID(self.inst) self.EX = EX() self.MEM = MEM(self.inst) self.WB = WB(self.inst) self.execution_order = ['IF', 'ID', 'EX', 'MEM', 'WB'] self.execution_status = {'IF': False, 'ID': False, 'EX': False, 'MEM': False, 'WB': False}
class Load: def __init__(self, inst): self.inst = inst self.IF = IF() self.ID = ID(self.inst) self.EX = EX() self.MEM = MEM(self.inst) self.WB = WB(self.inst) self.execution_order = ['IF', 'ID', 'EX', 'MEM', 'WB'] self.execution_status = { 'IF': False, 'ID': False, 'EX': False, 'MEM': False, 'WB': False } #print "in Load class : ", inst def next_execution_stage(self, clock, clock_execution_dict, instruction_index): #print self.inst completed = False start_next_instruction = False next_stage = '' for i in self.execution_order: if self.execution_status[i] is False: if i == 'IF': self.execution_status[i] = True next_stage = i elif i == 'ID': if self.ID.decode_instruction(): next_stage = i self.execution_status[i] = True start_next_instruction = True else: next_stage = 's' #start_next_instruction = True elif i == 'EX': self.execution_status[i] = True next_stage = i elif i == 'MEM': self.MEM.execute_stage() self.execution_status[i] = True self.MEM.execute() next_stage = i else: self.execution_status[i] = True #self.WB.execute_writeback() completed = True next_stage = i break if clock in clock_execution_dict: clock_execution_dict[clock][instruction_index] = next_stage else: clock_execution_dict[clock] = {instruction_index: next_stage} return clock_execution_dict, completed, start_next_instruction
def __init__(self, inst): self.inst = inst self.IF = IF() self.ID = ID(self.inst) self.A1 = A1() self.A2 = A2() self.A3 = A3(self.inst) self.A4 = A4(self.inst) self.MEM = MEM(self.inst) self.WB = WB(self.inst) self.execution_order = ['IF', 'ID', 'A1', 'A2', 'A3', 'A4', 'MEM', 'WB'] self.execution_status = {'IF': False, 'ID': False, 'A1': False, 'A2': False, 'A3': False, 'A4': False, 'MEM': False, 'WB': False}
def __init__(self, inst): self.inst = inst self.IF = IF() self.ID = ID(self.inst) self.A1 = A1() self.A2 = A2() self.A3 = A3(self.inst) self.A4 = A4(self.inst) self.MEM = MEM(self.inst) self.WB = WB(self.inst) self.execution_order = [ 'IF', 'ID', 'A1', 'A2', 'A3', 'A4', 'MEM', 'WB' ] self.execution_status = { 'IF': False, 'ID': False, 'A1': False, 'A2': False, 'A3': False, 'A4': False, 'MEM': False, 'WB': False }
class Store: def __init__(self, inst): self.inst = inst self.IF = IF() self.ID = ID(self.inst) self.EX = EX() self.MEM = MEM(self.inst) self.WB = WB(self.inst) self.execution_order = ['IF', 'ID', 'EX', 'MEM', 'WB'] self.execution_status = {'IF': False, 'ID': False, 'EX': False, 'MEM': False, 'WB': False} #print "in Store class : ", inst def next_execution_stage(self, clock, clock_execution_dict, instruction_index): #print self.inst completed = False start_next_instruction = False next_stage = '' for i in self.execution_order: if self.execution_status[i] is False: if i == 'IF': self.execution_status[i] = True next_stage = i elif i == 'ID': if self.ID.decode_instruction(): next_stage = i self.execution_status[i] = True start_next_instruction = True else: next_stage = 's' #start_next_instruction = True elif i == 'EX': self.execution_status[i] = True next_stage = i elif i == 'MEM': #self.MEM(self.inst) self.execution_status[i] = True self.MEM.execute() next_stage = i else: self.execution_status[i] = True #self.WB.execute_writeback() completed = True next_stage = i break if clock in clock_execution_dict: clock_execution_dict[clock][instruction_index] = next_stage else: clock_execution_dict[clock] = {instruction_index: next_stage} return clock_execution_dict, completed, start_next_instruction
def __init__(self, inst): self.inst = inst self.IF = IF() self.ID = ID(self.inst) self.M1 = M1() self.M2 = M2() self.M3 = M3() self.M4 = M4() self.M5 = M5() self.M6 = M6(self.inst) self.M7 = M7(self.inst) self.MEM = MEM(self.inst) self.WB = WB(self.inst) self.execution_order = ['IF', 'ID', 'M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'MEM', 'WB'] self.execution_status = {'IF': False, 'ID': False, 'M1': False, 'M2': False, 'M3': False, 'M4': False, 'M5': False, 'M6': False, 'M7': False, 'MEM': False, 'WB': False}
class Mul: def __init__(self, inst): self.inst = inst self.IF = IF() self.ID = ID(self.inst) self.M1 = M1() self.M2 = M2() self.M3 = M3() self.M4 = M4() self.M5 = M5() self.M6 = M6(self.inst) self.M7 = M7(self.inst) self.MEM = MEM(self.inst) self.WB = WB(self.inst) self.execution_order = [ 'IF', 'ID', 'M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'MEM', 'WB' ] self.execution_status = { 'IF': False, 'ID': False, 'M1': False, 'M2': False, 'M3': False, 'M4': False, 'M5': False, 'M6': False, 'M7': False, 'MEM': False, 'WB': False } #print "In Multiply class : ", inst def next_execution_stage(self, clock, clock_execution_dict, instruction_index): completed = False start_next_instruction = False next_stage = '' for i in self.execution_order: if self.execution_status[i] is False: if i == 'IF': self.execution_status[i] = True next_stage = i elif i == 'ID': if self.ID.decode_instruction(): next_stage = i self.execution_status[i] = True start_next_instruction = True else: next_stage = 's' #start_next_instruction = True elif i == 'M1': self.execution_status[i] = True next_stage = i elif i == 'M2': self.execution_status[i] = True next_stage = i elif i == 'M3': self.execution_status[i] = True next_stage = i elif i == 'M4': self.execution_status[i] = True next_stage = i elif i == 'M5': self.execution_status[i] = True next_stage = i elif i == 'M6': self.execution_status[i] = True self.M6.execute_stage() #self.WB.execute_writeback() next_stage = i elif i == 'M7': self.execution_status[i] = True self.M7.execute_stage() self.M7.execute() next_stage = i elif i == 'MEM': self.execution_status[i] = True next_stage = i else: self.execution_status[i] = True #self.WB.execute_writeback() completed = True next_stage = i break if clock in clock_execution_dict: clock_execution_dict[clock][instruction_index] = next_stage else: clock_execution_dict[clock] = {instruction_index: next_stage} return clock_execution_dict, completed, start_next_instruction
class Add: def __init__(self, inst): self.inst = inst self.IF = IF() self.ID = ID(self.inst) self.A1 = A1() self.A2 = A2() self.A3 = A3(self.inst) self.A4 = A4(self.inst) self.MEM = MEM(self.inst) self.WB = WB(self.inst) self.execution_order = ['IF', 'ID', 'A1', 'A2', 'A3', 'A4', 'MEM', 'WB'] self.execution_status = {'IF': False, 'ID': False, 'A1': False, 'A2': False, 'A3': False, 'A4': False, 'MEM': False, 'WB': False} #print "In Multiply class : ", inst def next_execution_stage(self, clock, clock_execution_dict, instruction_index): completed = False start_next_instruction = False next_stage = '' for i in self.execution_order: if self.execution_status[i] is False: if i == 'IF': self.execution_status[i] = True next_stage = i elif i == 'ID': if self.ID.decode_instruction(): next_stage = i self.execution_status[i] = True start_next_instruction = True else: next_stage = 's' #start_next_instruction = True elif i == 'A1': self.execution_status[i] = True next_stage = i elif i == 'A2': self.execution_status[i] = True next_stage = i elif i == 'A3': self.execution_status[i] = True self.A3.execute_stage() next_stage = i elif i == 'A4': self.execution_status[i] = True self.A4.execute_stage() self.A4.execute() next_stage = i elif i == 'MEM': self.execution_status[i] = True next_stage = i else: self.execution_status[i] = True #self.WB.execute_writeback() completed = True next_stage = i break if clock in clock_execution_dict: clock_execution_dict[clock][instruction_index] = next_stage else: clock_execution_dict[clock] = {instruction_index: next_stage} return clock_execution_dict, completed, start_next_instruction
class Mul: def __init__(self, inst): self.inst = inst self.IF = IF() self.ID = ID(self.inst) self.M1 = M1() self.M2 = M2() self.M3 = M3() self.M4 = M4() self.M5 = M5() self.M6 = M6(self.inst) self.M7 = M7(self.inst) self.MEM = MEM(self.inst) self.WB = WB(self.inst) self.execution_order = ['IF', 'ID', 'M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'MEM', 'WB'] self.execution_status = {'IF': False, 'ID': False, 'M1': False, 'M2': False, 'M3': False, 'M4': False, 'M5': False, 'M6': False, 'M7': False, 'MEM': False, 'WB': False} #print "In Multiply class : ", inst def next_execution_stage(self, clock, clock_execution_dict, instruction_index): completed = False start_next_instruction = False next_stage = '' for i in self.execution_order: if self.execution_status[i] is False: if i == 'IF': self.execution_status[i] = True next_stage = i elif i == 'ID': if self.ID.decode_instruction(): next_stage = i self.execution_status[i] = True start_next_instruction = True else: next_stage = 's' #start_next_instruction = True elif i == 'M1': self.execution_status[i] = True next_stage = i elif i == 'M2': self.execution_status[i] = True next_stage = i elif i == 'M3': self.execution_status[i] = True next_stage = i elif i == 'M4': self.execution_status[i] = True next_stage = i elif i == 'M5': self.execution_status[i] = True next_stage = i elif i == 'M6': self.execution_status[i] = True self.M6.execute_stage() #self.WB.execute_writeback() next_stage = i elif i == 'M7': self.execution_status[i] = True self.M7.execute_stage() self.M7.execute() next_stage = i elif i == 'MEM': self.execution_status[i] = True next_stage = i else: self.execution_status[i] = True #self.WB.execute_writeback() completed = True next_stage = i break if clock in clock_execution_dict: clock_execution_dict[clock][instruction_index] = next_stage else: clock_execution_dict[clock] = {instruction_index: next_stage} return clock_execution_dict, completed, start_next_instruction
class Sub: def __init__(self, inst): self.inst = inst self.IF = IF() self.ID = ID(self.inst) self.A1 = A1() self.A2 = A2() self.A3 = A3(self.inst) self.A4 = A4(self.inst) self.MEM = MEM(self.inst) self.WB = WB(self.inst) self.execution_order = [ 'IF', 'ID', 'A1', 'A2', 'A3', 'A4', 'MEM', 'WB' ] self.execution_status = { 'IF': False, 'ID': False, 'A1': False, 'A2': False, 'A3': False, 'A4': False, 'MEM': False, 'WB': False } #print "In Multiply class : ", inst def next_execution_stage(self, clock, clock_execution_dict, instruction_index): completed = False start_next_instruction = False next_stage = '' for i in self.execution_order: if self.execution_status[i] is False: if i == 'IF': self.execution_status[i] = True next_stage = i elif i == 'ID': if self.ID.decode_instruction(): next_stage = i self.execution_status[i] = True start_next_instruction = True else: next_stage = 's' #start_next_instruction = True elif i == 'A1': self.execution_status[i] = True next_stage = i elif i == 'A2': self.execution_status[i] = True next_stage = i elif i == 'A3': self.execution_status[i] = True self.A3.execute_stage() next_stage = i elif i == 'A4': self.execution_status[i] = True self.A4.execute_stage() self.A4.execute() next_stage = i elif i == 'MEM': self.execution_status[i] = True next_stage = i else: self.execution_status[i] = True #self.WB.execute_writeback() completed = True next_stage = i break if clock in clock_execution_dict: clock_execution_dict[clock][instruction_index] = next_stage else: clock_execution_dict[clock] = {instruction_index: next_stage} return clock_execution_dict, completed, start_next_instruction