From 58816fdcb263b84955a97124da99478f523d5c55 Mon Sep 17 00:00:00 2001 From: Daniel Benusovich Date: Mon, 18 Feb 2019 21:24:40 -0800 Subject: [PATCH] Adding comments --- TLB/CamEntry.py | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/TLB/CamEntry.py b/TLB/CamEntry.py index 6294ded9..e4f1d784 100644 --- a/TLB/CamEntry.py +++ b/TLB/CamEntry.py @@ -50,6 +50,12 @@ def set_cam(dut, w, k, d): yield dut.data_in.eq(d) yield +# Verifies the given values via the requested operation +# Arguments: +# pre (Prefix): Appended to the front of the assert statement +# e (Expected): The expected value +# out (Output): The output result +# op (Operation): (0 => ==), (1 => !=) def check(pre, e, out, op): if(op == 0): yield @@ -57,19 +63,43 @@ def check(pre, e, out, op): else: yield assert out != e, pre + " Output " + str(out) + " Expected " + str(e) - + +# Checks the key state of the CAM entry +# Arguments: +# dut: The CamEntry being tested +# k (Key): The expected key +# op (Operation): (0 => ==), (1 => !=) def check_key(dut, k, op): out_k = yield dut.key check("K", out_k, k, op) - + +# Checks the data state of the CAM entry +# Arguments: +# dut: The CamEntry being tested +# d (Data): The expected data +# op (Operation): (0 => ==), (1 => !=) def check_data(dut, d, op): out_d = yield dut.data check("D", out_d, d, op) - + +# Checks the match state of the CAM entry +# Arguments: +# dut: The CamEntry being tested +# m (Match): The expected match +# op (Operation): (0 => ==), (1 => !=) def check_match(dut, m, op): out_m = yield dut.match check("M", out_m, m, op) - + +# Checks the state of the CAM entry +# Arguments: +# dut: The CamEntry being tested +# k (key): The expected key +# d (data): The expected data +# m (match): The expected match +# kop (Operation): The operation for the key assertion (0 => ==), (1 => !=) +# dop (Operation): The operation for the data assertion (0 => ==), (1 => !=) +# mop (Operation): The operation for the match assertion (0 => ==), (1 => !=) def check_all(dut, k, d, m, kop, dop, mop): yield from check_key(dut, k, kop) yield from check_data(dut, d, dop) -- 2.30.2