From: Daniel Benusovich Date: Sat, 23 Feb 2019 18:17:12 +0000 (-0800) Subject: Adding test utility class to help with assertions and common testing functions X-Git-Tag: div_pipeline~2384 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f39145fa63afff80c113dbbf28a36e25e675729b;p=soc.git Adding test utility class to help with assertions and common testing functions --- diff --git a/TLB/test_cam_entry.py b/TLB/test_cam_entry.py index 9b2b756c..53240fcb 100644 --- a/TLB/test_cam_entry.py +++ b/TLB/test_cam_entry.py @@ -1,5 +1,6 @@ from nmigen.compat.sim import run_simulation +from test_helper import check from CamEntry import CamEntry # This function allows for the easy setting of values to the Cam Entry @@ -19,19 +20,7 @@ def set_cam_entry(dut, c, k, d): yield dut.command.eq(0) yield dut.key_in.eq(0) yield dut.data_in.eq(0) - yield - -# Verifies the given values via the requested operation -# Arguments: -# p (Prefix): Appended to the front of the assert statement -# e (Expected): The expected value -# o (Output): The output result -# op (Operation): (0 => ==), (1 => !=) -def check(p, o, e, op): - if(op == 0): - assert o == e, p + " Output " + str(o) + " Expected " + str(e) - else: - assert o != e, p + " Output " + str(o) + " Not Expecting " + str(e) + yield # Checks the key state of the CAM entry # Arguments: