You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
615 B
21 lines
615 B
from instruction.ldst.ldst import Ldst
|
|
|
|
|
|
class Load(Ldst):
|
|
def __init__(self, hw):
|
|
super().__init__(hw)
|
|
|
|
def memAccess(self):
|
|
super().memAccess()
|
|
addr = self.hw.pplReg[3][0].read()
|
|
memData = self.hw.dataMem.read(addr)
|
|
rt = self.hw.pplReg[3][1].read()
|
|
self.hw.pplReg[4][0].write(memData) # 取内存数据
|
|
self.hw.pplReg[4][1].write(rt)
|
|
|
|
def writeBack(self):
|
|
super().writeBack()
|
|
rt = self.hw.pplReg[4][1].read()
|
|
memData = self.hw.pplReg[4][0].read()
|
|
self.hw.genReg[rt].write(memData) # 数据写回目标寄存器
|