env-xs-ov-00-bpu/tests/bpu_top/env/bpu_env.py

63 lines
1.9 KiB
Python

#from mlvp import Bundle, Signals
from mlvp import *
import mlvp
from mlvp.env import *
from config import *
import os
os.sys.path.append(TESTS_PATH)
os.sys.path.append(DUT_PATH)
from UT_Predictor import *
import random
ENV_PATH = os.path.dirname(os.path.abspath(__file__))+"/../"
os.sys.path.append(ENV_PATH)
from env.bpu_bundle import *
from env.bpu_agent import *
class BpuEnv(Env):
def __init__(self, SubPrediCtrlBundle, Ftq2BpuUpdateFtbEntryBundle,Ftq2BpuUpdateOtherBundle,
Ftq2BpuUpdateFoldHistBundle, Ftq2BpuRedirectOtherBundle, Ftq2BpuRedirectFoldHistBundle,
Ftq2BpuRedirectAfhobBundle):
super().__init__()
self.sub_predi_ctrl_agent = SubPrediCtrlAgent(SubPrediCtrlBundle)
self.update_ftb_entry_agent = Ftq2BpuUpdateFtbEntryAgent(Ftq2BpuUpdateFtbEntryBundle)
self.update_other_agent = Ftq2BpuUpdateOtherAgent(Ftq2BpuUpdateOtherBundle)
self.update_fold_hist_agent = Ftq2BpuUpdateFoldHistAgent(Ftq2BpuUpdateFoldHistBundle)
self.redirect_other_agent = Ftq2BpuRedirectOtherAgent(Ftq2BpuRedirectOtherBundle)
self.redirect_fold_hist_agent = Ftq2BpuRedirectFoldHistAgent(Ftq2BpuRedirectFoldHistBundle)
self.redirect_afhob_agent = Ftq2BpuRedirectAfhobAgent(Ftq2BpuRedirectAfhobBundle)
################################# Only for Test_ENV #####################
# async def test_env():
# sub_predic_ctrl_bundle = SubPrediCtrlBundle()
# spec_info_bundle = Ftq2BpuUpdateSpecInfoBundle()
#
# dut: DUTPredictor = DUTPredictor()
# sub_predic_ctrl_bundle.bind(dut)
# spec_info_bundle.bind(dut)
#
# bpu_env = BpuEnv(sub_predic_ctrl_bundle, spec_info_bundle)
#
# #the transaction
# enable_dict = {
# 'ubtb_en' : 1,
# 'btb_en' : 1,
# 'tage_en' : 1,
# 'sc_en' : 1,
# 'ras_en' : 1
# }
#
# await bpu_env.sub_predi_ctrl_agent.set_sub_predic_ctrl_en(dut, enable_dict)
#
# print("exec bottom!!!")
# if __name__ == "__main__":
# mlvp.run(test_env())