Update uftb-with-ftq to mlvp v0.1.0
This commit is contained in:
parent
5ff250c113
commit
97d0e6f46b
|
@ -10,3 +10,4 @@ split_verilogs
|
||||||
**/UT_*
|
**/UT_*
|
||||||
NemuBR/
|
NemuBR/
|
||||||
report/
|
report/
|
||||||
|
reports/
|
||||||
|
|
|
@ -74,13 +74,13 @@ if __name__ == "__main__":
|
||||||
# Create DUT
|
# Create DUT
|
||||||
uftb = DUTFauFTB()
|
uftb = DUTFauFTB()
|
||||||
# Init DUT with clock pin name
|
# Init DUT with clock pin name
|
||||||
uftb.init_clock("clock")
|
uftb.InitClock("clock")
|
||||||
|
|
||||||
# Your testcases here
|
# Your testcases here
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
# Destroy DUT
|
# Destroy DUT
|
||||||
utb.finalize()
|
utb.Finish()
|
||||||
```
|
```
|
||||||
|
|
||||||
其他待验证模块,例如 TAGE-SC,FTB也可以通过类似命令生成。
|
其他待验证模块,例如 TAGE-SC,FTB也可以通过类似命令生成。
|
||||||
|
@ -166,7 +166,7 @@ def test_mydut(request):
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
# 结束测试,并录入覆盖率信息,覆盖率文件名称应该与上述指定的覆盖率文件名称相同
|
# 结束测试,并录入覆盖率信息,覆盖率文件名称应该与上述指定的覆盖率文件名称相同
|
||||||
my_dut.finalize()
|
my_dut.Finish()
|
||||||
set_func_coverage(request, [g1, g2])
|
set_func_coverage(request, [g1, g2])
|
||||||
set_line_coverage(request, "my_test_coverage.dat")
|
set_line_coverage(request, "my_test_coverage.dat")
|
||||||
```
|
```
|
||||||
|
|
|
@ -74,13 +74,13 @@ if __name__ == "__main__":
|
||||||
# Create DUT
|
# Create DUT
|
||||||
uftb = DUTFauFTB()
|
uftb = DUTFauFTB()
|
||||||
# Init DUT with clock pin name
|
# Init DUT with clock pin name
|
||||||
uftb.init_clock("clock")
|
uftb.InitClock("clock")
|
||||||
|
|
||||||
# Your testcases here
|
# Your testcases here
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
# Destroy DUT
|
# Destroy DUT
|
||||||
utb.finalize()
|
utb.Finish()
|
||||||
```
|
```
|
||||||
|
|
||||||
Other modules to be verified, such as TAGE-SC, FTB can also be generated by similar commands.
|
Other modules to be verified, such as TAGE-SC, FTB can also be generated by similar commands.
|
||||||
|
@ -167,7 +167,7 @@ def test_mydut(request):
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
# End the test, and enter the coverage information. The coverage file name should be the same as the coverage file name specified above
|
# End the test, and enter the coverage information. The coverage file name should be the same as the coverage file name specified above
|
||||||
my_dut.finalize()
|
my_dut.Finish()
|
||||||
set_func_coverage(request, [g1, g2])
|
set_func_coverage(request, [g1, g2])
|
||||||
set_line_coverage(request, "my_test_coverage.dat")
|
set_line_coverage(request, "my_test_coverage.dat")
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,18 +1,9 @@
|
||||||
TEST=.
|
TEST=.
|
||||||
TEST_FOLDER=./$(TEST)
|
TEST_FOLDER=./$(TEST)
|
||||||
|
|
||||||
PYTHON=python3
|
PYTHON=python3
|
||||||
|
|
||||||
START_CODE="from mlvp.reporter import *;\
|
|
||||||
set_meta_info('test_case', '$(TEST)');\
|
|
||||||
report = 'report/$(TEST)/report.html';\
|
|
||||||
generate_pytest_report(report, args=['-s', '$(TEST_FOLDER)'], );\
|
|
||||||
"
|
|
||||||
|
|
||||||
run:
|
run:
|
||||||
@echo "Running test $(TEST)..."
|
pytest --mlvp-report -sv $(TEST_FOLDER)
|
||||||
@mkdir report/$(TEST) -p
|
|
||||||
@$(PYTHON) -c $(START_CODE)
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf report/ *.fst *.dat *.log *.hier
|
rm -rf reports/
|
||||||
|
|
|
@ -150,10 +150,10 @@ class FauFTB(DUTFauFTB):
|
||||||
self.io_out_s1_full_pred = self.Io_out_s1_full_pred(self)
|
self.io_out_s1_full_pred = self.Io_out_s1_full_pred(self)
|
||||||
self._io_out_last_stage_meta = self.Io_out_last_stage_meta(self)
|
self._io_out_last_stage_meta = self.Io_out_last_stage_meta(self)
|
||||||
self.io_update_bits_ftb_entry = self.Io_update_bits_ftb_entry(self)
|
self.io_update_bits_ftb_entry = self.Io_update_bits_ftb_entry(self)
|
||||||
self.init_clock("clock")
|
self.InitClock("clock")
|
||||||
|
|
||||||
def finalize(self):
|
def finalize(self):
|
||||||
super().finalize()
|
super().Finish()
|
||||||
|
|
||||||
def check_dup_equation(self, *inputs):
|
def check_dup_equation(self, *inputs):
|
||||||
return all(i == inputs[0] for i in inputs)
|
return all(i == inputs[0] for i in inputs)
|
||||||
|
|
|
@ -57,7 +57,7 @@ def test_raw(request):
|
||||||
print("main", pred[0], pred[1].__dict__)
|
print("main", pred[0], pred[1].__dict__)
|
||||||
uFTB.Step(1)
|
uFTB.Step(1)
|
||||||
|
|
||||||
uFTB.finalize()
|
uFTB.Finish()
|
||||||
|
|
||||||
set_line_coverage(request, "report/uftb_raw_coverage.dat")
|
set_line_coverage(request, "report/uftb_raw_coverage.dat")
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from mlvp import *
|
from mlvp import *
|
||||||
|
from mlvp.triggers import *
|
||||||
from .bundle import *
|
from .bundle import *
|
||||||
from .ftq import *
|
from .ftq import *
|
||||||
from .uftb_model import uFTBModel
|
from .uftb_model import uFTBModel
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from mlvp.modules import PLRU, TwoBitsCounter
|
from mlvp.utils import PLRU, TwoBitsCounter
|
||||||
from mlvp import *
|
from mlvp import *
|
||||||
from .ftb import *
|
from .ftb import *
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import mlvp
|
import mlvp
|
||||||
import logging
|
import pytest
|
||||||
|
from mlvp.triggers import *
|
||||||
|
|
||||||
import os
|
import os
|
||||||
os.sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/..")
|
os.sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/..")
|
||||||
|
@ -12,8 +13,6 @@ os.sys.path.append(DUT_PATH)
|
||||||
|
|
||||||
from UT_FauFTB import *
|
from UT_FauFTB import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def set_imm_mode(uFTB):
|
def set_imm_mode(uFTB):
|
||||||
imm_mode = uFTB.io_s0_fire_0.xdata.Imme
|
imm_mode = uFTB.io_s0_fire_0.xdata.Imme
|
||||||
need_to_write_imm = ["io_s0_fire_0", "io_s0_fire_1", "io_s0_fire_2", "io_s0_fire_3",
|
need_to_write_imm = ["io_s0_fire_0", "io_s0_fire_1", "io_s0_fire_2", "io_s0_fire_3",
|
||||||
|
@ -23,27 +22,31 @@ def set_imm_mode(uFTB):
|
||||||
getattr(uFTB, name).xdata.SetWriteMode(imm_mode)
|
getattr(uFTB, name).xdata.SetWriteMode(imm_mode)
|
||||||
|
|
||||||
|
|
||||||
async def uftb_test(uFTB):
|
@pytest.mark.mlvp_async
|
||||||
|
async def test_uftb(mlvp_request):
|
||||||
|
uFTB = mlvp_request
|
||||||
|
set_imm_mode(uFTB)
|
||||||
|
|
||||||
uFTB_update = UpdateBundle.from_prefix("io_update_").set_name("uFTB_update").bind(uFTB)
|
uFTB_update = UpdateBundle.from_prefix("io_update_").set_name("uFTB_update").bind(uFTB)
|
||||||
uFTB_out = BranchPredictionResp.from_prefix("io_out_").set_name("uFTB_out").bind(uFTB)
|
uFTB_out = BranchPredictionResp.from_prefix("io_out_").set_name("uFTB_out").bind(uFTB)
|
||||||
pipeline_ctrl = PipelineCtrlBundle.from_prefix("io_").set_name("pipeline_ctrl").bind(uFTB)
|
pipeline_ctrl = PipelineCtrlBundle.from_prefix("io_").set_name("pipeline_ctrl").bind(uFTB)
|
||||||
enable_ctrl = EnableCtrlBundle.from_prefix("io_ctrl_").set_name("enable_ctrl").bind(uFTB)
|
enable_ctrl = EnableCtrlBundle.from_prefix("io_ctrl_").set_name("enable_ctrl").bind(uFTB)
|
||||||
|
|
||||||
mlvp.create_task(mlvp.start_clock(uFTB))
|
mlvp.start_clock(uFTB)
|
||||||
mlvp.create_task(BPUTop(uFTB, uFTB_out, uFTB_update, pipeline_ctrl, enable_ctrl).run())
|
mlvp.create_task(BPUTop(uFTB, uFTB_out, uFTB_update, pipeline_ctrl, enable_ctrl).run())
|
||||||
|
|
||||||
await ClockCycles(uFTB, MAX_CYCLE)
|
await ClockCycles(uFTB, MAX_CYCLE)
|
||||||
|
|
||||||
|
pred_stat.summary()
|
||||||
|
|
||||||
import mlvp.funcov as fc
|
import mlvp.funcov as fc
|
||||||
from mlvp.reporter import *
|
from mlvp.reporter import *
|
||||||
|
from mlvp import PreRequest
|
||||||
|
|
||||||
def test_uftb(request):
|
@pytest.fixture()
|
||||||
# Create DUT
|
def mlvp_request(mlvp_pre_request: PreRequest):
|
||||||
uFTB = DUTFauFTB(waveform_filename="report/uftb_with_ftq.fst", coverage_filename="report/uftb_with_ftq_coverage.dat")
|
mlvp.setup_logging(mlvp.INFO)
|
||||||
uFTB.init_clock("clock")
|
uFTB = mlvp_pre_request.create_dut(DUTFauFTB, "clock")
|
||||||
set_imm_mode(uFTB)
|
|
||||||
|
|
||||||
# Set Coverage
|
# Set Coverage
|
||||||
g1 = fc.CovGroup("interaction")
|
g1 = fc.CovGroup("interaction")
|
||||||
|
@ -63,15 +66,6 @@ def test_uftb(request):
|
||||||
g2.add_watch_point(uFTB.io_out_s1_full_pred_0_br_taken_mask_1, { "br_taken_mask_1": fc.Eq(1), "br_taken_mask_1_invalid": fc.Eq(0) }, name="s1_full_pred_0_br_taken_mask_1")
|
g2.add_watch_point(uFTB.io_out_s1_full_pred_0_br_taken_mask_1, { "br_taken_mask_1": fc.Eq(1), "br_taken_mask_1_invalid": fc.Eq(0) }, name="s1_full_pred_0_br_taken_mask_1")
|
||||||
g2.add_watch_point(uFTB.io_out_s1_full_pred_0_is_br_sharing, { "is_br_sharing": fc.Eq(1), "is_br_sharing_invalid": fc.Eq(0) }, name="s1_full_pred_0_is_br_sharing")
|
g2.add_watch_point(uFTB.io_out_s1_full_pred_0_is_br_sharing, { "is_br_sharing": fc.Eq(1), "is_br_sharing_invalid": fc.Eq(0) }, name="s1_full_pred_0_is_br_sharing")
|
||||||
|
|
||||||
uFTB.xclock.StepRis(lambda _: g1.sample())
|
mlvp_pre_request.add_cov_groups([g1, g2])
|
||||||
uFTB.xclock.StepRis(lambda _: g2.sample())
|
|
||||||
|
|
||||||
# Run the test
|
|
||||||
mlvp.setup_logging(log_level=logging.INFO, log_file="report/uftb_with_ftq.log")
|
|
||||||
mlvp.run(uftb_test(uFTB))
|
|
||||||
uFTB.finalize()
|
|
||||||
|
|
||||||
pred_stat.summary()
|
|
||||||
set_func_coverage(request, [g1, g2])
|
|
||||||
set_line_coverage(request, "report/uftb_with_ftq_coverage.dat")
|
|
||||||
|
|
||||||
|
return uFTB
|
||||||
|
|
Loading…
Reference in New Issue