From f39145fa63afff80c113dbbf28a36e25e675729b Mon Sep 17 00:00:00 2001 From: Daniel Benusovich Date: Sat, 23 Feb 2019 10:17:12 -0800 Subject: [PATCH] Adding test utility class to help with assertions and common testing functions --- TLB/test_cam_entry.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) 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: -- 2.30.2