From 033bafb137b632af5652a1cd739b2f31ac9e336b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E5=87=A0=E6=96=B9?= Date: Tue, 23 Nov 2021 11:05:13 +0800 Subject: [PATCH] top and datapath --- code/datapath.py | 8 +++++--- code/top(wating_to_filling).py | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/code/datapath.py b/code/datapath.py index d84cc5f..b1801cb 100644 --- a/code/datapath.py +++ b/code/datapath.py @@ -189,20 +189,22 @@ def dataPath(): PCB = PCA RD1B = RD1 RD2B = RD2 - rs1B = insnA[12:17] - rs2B = insnA[7:12] - rdB = insnA[20:25] + rs1B = BintoUInt(insnA[12:17]) + rs2B = BintoUInt(insnA[7:12]) + rdB = BintoUInt(insnA[20:25]) ImmGB = ImmG funct3B = insnA[17:20] funct7B = insnA[0:7] insnB = insnA nPC, insn = IF(BrPC, Brflush, stall, PC, IM) + if Brflush == '1': PCA = 4 insnA = '0' * 32 else: PCA = nPC insnA = insn + if insn == 32 * '0': break diff --git a/code/top(wating_to_filling).py b/code/top(wating_to_filling).py index 641e6f9..c0fc773 100644 --- a/code/top(wating_to_filling).py +++ b/code/top(wating_to_filling).py @@ -1 +1,4 @@ -from datapath import * \ No newline at end of file +from datapath import * + +if __name__ == '__main__': + dataPath() \ No newline at end of file